NSDecimalNumber and 10.2.x: is this bug a secret?
NSDecimalNumber and 10.2.x: is this bug a secret?
- Subject: NSDecimalNumber and 10.2.x: is this bug a secret?
- From: Stéphane Sudre <email@hidden>
- Date: Sun, 29 Feb 2004 21:25:40 +0100
Problem:
--------
NSDecimalNumber seems to include a bug in 10.2.8 and probably 10.2.6.
Step to reproduce:
------------------
1) Set a NSNumberFormatter on a NSTextField as follow:
NSNumberFormatter * tNumberFormatter;
NSDictionary * tZeroAttributes;
NSAttributedString * tZeroAttributedString;
tNumberFormatter=[NSNumberFormatter new];
[tNumberFormatter setPositiveFormat:@"0"];
[tNumberFormatter setNegativeFormat:@"0"];
tZeroAttributes=[tNumberFormatter textAttributesForPositiveValues];
tZeroAttributedString=[[NSAttributedString alloc] initWithString:@"0"
attributes:tZeroAttributes];
[tNumberFormatter setAttributedStringForZero:tZeroAttributedString];
[tZeroAttributedString release];
[tNumberFormatter setMinimum:[NSDecimalNumber zero]];
[tNumberFormatter setAllowsFloats:NO];
[tNumberFormatter setHasThousandSeparators:NO];
[textfield setFormatter:tNumberFormatter];
[tNumberFormatter release];
[textfield setObjectValue:[NSNumber numberWithInt:0]];
2) Type 10000000 in the text field and then get the object value via
[textfield objectValue]
3) Save the object value in a Property List.
4) Look at the .plist file in 10.2.8
RESULTS:
--------
<real>1.0650296874854702e-310</real>
RESULTS ON 10.2.6:
------------------
<real>6.4551111961163584e-311</real>
RESULTS on 10.3.2:
------------------
<real>10000000</real>
TECH DRILL:
-----------
Guess which one is the correct result.
QUESTIONS:
---------
- Is this a bug?
- Is there a workaround for this bug? I see no Tech Note, Tech Q&A or
Release note on this.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.