discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNumber Bug


From: David Ayers
Subject: Re: NSNumber Bug
Date: Mon, 27 Oct 2008 15:41:03 +0000

Hello Andreas,


Am Montag, den 27.10.2008, 15:12 +0100 schrieb Andreas Höschler:

> The following code
> 
>        double value = 29.84;
>        NSNumber *num = [NSNumber numberWithDouble:value];
>        NSDecimalNumber *result = [NSDecimalNumber  
> decimalNumberWithDecimal:[num decimalValue]];
>        NSLog(@"value %f num %@ result %@", (float)value, num, result);
> 
> gives me
> 
>       value 29.840000 result 29.84 result 29
> 
> after doing
> 
>       defaults write NSGlobalDomain NSDecimalSeparator ","
> 
> The after comma digits get lost!? Without this default everything is  
> fine!? Any idea?

I vaguely remember having an issue like this... [in a German (Austrian)
locale with an implicit NSDecimalSeparator of ","] and I thought I
committed a fix for it... Ah!:

2008-06-11  David Ayers  <ayers@fsfe.org>

        * Source/NSNumberFormatter.m ([-stringForObjectValue:]): Implement
        handling of localizesFormat.

http://svn.gna.org/viewcvs/gnustep?view=rev&rev=26627

So the question is... which version are you using?

I currently cannot check with the system on which I debugged the issue,
but still have this patch-let floating around which I don't really think
is related but I thought I'd post it anyway ... 

Index: Source/NSNumberFormatter.m
===================================================================
--- Source/NSNumberFormatter.m  (Revision 26918)
+++ Source/NSNumberFormatter.m  (Arbeitskopie)
@@ -258,10 +258,10 @@
          [self setDecimalSeparator:
            [decoder decodeObjectForKey: @"NS.decimal"]];
        }
-      if ([decoder containsValueForKey: @"NS.hasthousands"])
+      if ([decoder containsValueForKey: @"NS.hasthousand"])
         {
          [self setHasThousandSeparators:
-           [decoder decodeBoolForKey: @"NS.hasthousands"]];
+           [decoder decodeBoolForKey: @"NS.hasthousand"]];
        }
       if ([decoder containsValueForKey: @"NS.localized"])
         {


I'll try to have a deeper look tonight sometime...

Cheers,
David





reply via email to

[Prev in Thread] Current Thread [Next in Thread]