discuss-gnustep
[Top][All Lists]
Advanced

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

Re: NSNumber Bug


From: Andreas Höschler
Subject: Re: NSNumber Bug
Date: Mon, 27 Oct 2008 17:29:01 +0100

Hi David,

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...

The version of GNustep I use is a couple of months old (probably even a bit older). Upgrading to CVS is no option right now since I need Etoile. I implemented your patch but this did not do the trick!? :-(

If you find anything else ...

Thanks a lot,

  Andreas

reply via email to

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