bugGNUstep - Bugs: bug #60871, NSNumberFormatter does not behave...


bug #60871: NSNumberFormatter does not behave as in Mac OS X

Submitter:  Larry Campbell <lcampbel>
Submitted:  Thu 01 Jul 2021 06:13:10 PM UTC
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


Thu 09 Dec 2021 12:41:31 AM UTC, comment #2: 

This bug is invalid, see below...

[heron@glados-debian-vm Products] % ./NSNumberFormatter_test                                    [0]
2021-12-08 19:34:37.156 NSNumberFormatter_test[78444:78444] Pass
2021-12-08 19:34:37.160 NSNumberFormatter_test[78444:78444] got = 0.9, expected = 0.9
[heron@glados-debian-vm Products] %    

Please see the test at 

I am also adding a test to the gnustep-base unit tests.

Gregory John Casamento <gcasa>
Project Administrator
Thu 09 Dec 2021 12:18:10 AM UTC, comment #1: 

Works for me:
number formatter botch, expected "0.9", got "0.9"

Riccardo Mottola <rmottola>
Project Member
Thu 01 Jul 2021 06:13:10 PM UTC, original submission:  

The following snippet demonstrates an incompatibility with Mac OS X. On Mac OS X the test succeeds; on gnustep-base (linux, libicu) the test fails, returning ".9" instead of "0.9".

    NSNumberFormatter *nf = [[NSNumberFormatter new] autorelease];
    NSString *expected = @"0.9";
    NSString *got;
    [nf setMaximumFractionDigits:3];
    got = [nf stringFromNumber:[NSNumber numberWithDouble:0.9]];
    NSAssert([expected isEqualToString:got], @"number formatter botch, expected \"%@\", got \"%@\"", expected, got);

On linux:

2021-07-01 18:09:42.517 gnustep-base-tests[55286:55286] gnustep-base-tests.m:593  Assertion failed in GnustepBaseTests(instance), method numberFormatterTest.  number formatter botch, expected "0.9", got ".9"

Larry Campbell <lcampbel>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by gcasa (Posted a comment)
  • -email is unavailable- added by rmottola (Posted a comment)
  • -email is unavailable- added by lcampbel (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.





    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-12-09 gcasa StatusNone Invalid
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.9