Re: NSNumberFormatter Strangeness
Re: NSNumberFormatter Strangeness
- Subject: Re: NSNumberFormatter Strangeness
- From: Jean-Daniel Dupas <email@hidden>
- Date: Fri, 25 Nov 2011 09:45:23 +0100
Le 25 nov. 2011 à 04:26, Conrad Shultz a écrit :
> On 11/24/11 3:20 PM, Jean-Daniel Dupas wrote:
>> A formatter is used to convert an internal number representation
>> (integer, floating point, fixed point) into a string. Is has nothing
>> to do with the precision of the represented value.
>>
>> If you use double to do your math, you will get as much precision as
>> double provide, whatever the formatter you use.
>
> I realize that, and I'm not using the formatter per se to do the actual
> math - it uses NSDecimalNumber for that, which works quite well.
>
> I was configuring the formatter for maximal *display precision* of the
> result. Since the input (and significant digits therein) is not known
> in advance, and since the calculations performed are of a kind that will
> never produce irrational numbers, in the context of the application it
> makes sense to simply display all the digits that are available.
Not all rationals numbers have a finite representation (1÷3), and even with a big screen and lot of times, you will have a hard time displaying 100001871036415 digits ;-)
>> If you managed to prove that such case may exist, why not, but I
>> really don't see how having more than hundred of digits can be useful
>> as there is no internal representation able to represent a decimal
>> with such precision.
>
> Yeah, it's not so much that I want absurd precision, more that I
> generally expect to be able to use the defined type maximum or minimum
> constants whenever my intent is "really big" or "really small"
> respectively. In this case, NSUIntegerMax caused things to break
> silently and in such a way that I thought _I_ had a bug.
> I guess I will go ahead and open a Radar.
>
> (Erk... looks like bugreport.apple.com is down again. Not my lucky day,
> I suppose.)
>
-- Jean-Daniel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden