• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: 1.0 divided by 10 = 0.10000000000000001?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 1.0 divided by 10 = 0.10000000000000001?


  • Subject: Re: 1.0 divided by 10 = 0.10000000000000001?
  • From: Derrick Bass <email@hidden>
  • Date: Mon, 27 Mar 2006 19:44:06 -0600

On Mar 27, 2006, at 4:53 PM, Marcel Weiher wrote:

Actually no. NSDecimalNumber is a floating point representation, with mantissa and exponent, just like doubles. It's just able to represent a larger range/more precision than what had been available natively from C-based languages and the compiler. "long double" -- available in gcc 4.0 -- is about the same precision and a much greater value range. Not to mention that any "native" compiler support is going to be a thousand times faster than doing arithmetic with NSDecimalNumber.

Yes, true. It wasn't exactly clear what the OP needed, but it appeared that the real problem might be needing exact representation of base-10 numbers, rather than precision problems. If so, the NSDecimalNumber is exactly what's needed.


Derrick

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >1.0 divided by 10 = 0.10000000000000001? (From: Axman <email@hidden>)
 >Re: 1.0 divided by 10 = 0.10000000000000001? (From: Derrick Bass <email@hidden>)
 >Re: 1.0 divided by 10 = 0.10000000000000001? (From: Marcel Weiher <email@hidden>)

  • Prev by Date: Re: Cocoa-dev Digest, Vol 3, Issue 385
  • Next by Date: Re: Draw a single bitmap multiple times into an NSView?
  • Previous by thread: Re: 1.0 divided by 10 = 0.10000000000000001?
  • Next by thread: Re: 1.0 divided by 10 = 0.10000000000000001?
  • Index(es):
    • Date
    • Thread