• 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: Greg Herlihy <email@hidden>
  • Date: Tue, 28 Mar 2006 18:48:00 -0800
  • Thread-topic: 1.0 divided by 10 = 0.10000000000000001?

There are two number classes that have come up in this discussion, hence the
confusion: NSDecimal and its likely replacement: "long double".

The former is base-10 while the latter is not. But since long doubles have
such great precision and are much faster than NSDecimals when performing
calculations, it is likely that NSDecimalNumbers will be deprecated in favor
of long doubles - probably whenever Leopard is released. Another necessary
change before that could happen though will be to add long double support to
NSNumber.

Greg


On 3/28/06 5:42 PM, "Derrick Bass" <email@hidden> wrote:

>> Folks
>>
>> If there is a documentation bug here, or even if it isn't clear,
>> then please file a bug.
>>
> The documentation quite clearly says NSDecimalNumber is base-10.
> We're trying to determine is whether or not that is correct. Marcel,
> based on (what I think is a pretty inconclusive) comment from Chris
> Kane, thinks yes (NSDecimalNumber is base-2), while I see no reason
> to doubt the docs based on what he's presented.
>
> Since both Marcel and I are both using the fallacy of appealing to
> authority (Chris Kane is his case, the Apple documentation in mine),
> I'd thought I'd throw in a little evidence.
>
> I ported the first portion of Kahan's famous (another appeal to
> authority) "paranoia" program (see, e.g. <http://
> orion.math.iastate.edu/burkardt/c_src/paranoia/paranoia.html>) to
> test NSDecimalNumber. It confirms that it is base-10, although the
> precision is less than the documentation says (34 digits; the docs
> say 38).
>
> I'm enclosing my port so anyone who's interested can check to be sure
> I did it right.
>
> 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


 _______________________________________________
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: 
 >Re: 1.0 divided by 10 = 0.10000000000000001? (From: Derrick Bass <email@hidden>)

  • Prev by Date: Re: 1.0 divided by 10 = 0.10000000000000001?
  • Next by Date: Re: requestUserAttention:NSInformationalRequest
  • 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