> Am 07.03.2016 um 21:05 schrieb Richard Frith-Macdonald > <[email protected]>: > > >> On 7 Mar 2016, at 17:45, Bertrand Dekoninck <[email protected]> >> wrote: >> >> > >> Here's mine, on debian wheezy, ppc (64 bit kernel). >> >> Testing test02.m... >> Running base/NSNumber/test02.m... >> Start set: test02.m:12 ... NSDecimalNumber >> Failed test: test02.m:31 ... rounding 0.009 >> Expected '0.01' and got '0.0' >> Failed test: test02.m:37 ... rounding 0.019 >> Expected '0.02' and got '0.0' >> Failed test: test02.m:51 ... rounding 0.0009 >> Expected '0.001' and got '0.0' >> Failed test: test02.m:57 ... rounding 0.0019 >> Expected '0.002' and got '0.0' >> End set: test02.m:59 ... NSDecimalNumber >> Completed file: test02.m >> >> >> >> Not a lot more info. What other part of this 8mb file should I give ? > > > I think that's it ... tells us the rounded value in each case was zero. > > I wonder if the fact that it's 64bit ppc indicates a byte ordering issue > somewhere?
I was suspecting the same and dug out my old PowerBook, but in the end it turns out that it's really a locale issue. The test program uses code like n1 = [NSDecimalNumber decimalNumberWithString: @"0.009"]; to define the decimal numbers. According to Apple's documentation this method works with an unspecified locale, so the code works as long as this default locale is English (or any other locale that uses a '.' as decimal separator), but it breaks as soon as you are in a locale where '.' is not the decimal separator (in my case German, where ',' is the decimal separator). I guess, the test needs to be changed to use a fixed locale. On the other hand, on OS X with Apple's foundation the test seems to work for me even though my default locale is set to German. Perhaps while the default locale used by -decimalNumberWithString: is unspecified according to Apple's documentation they really use a fixed locale regardless of the user's locale nevertheless? Wolfgang _______________________________________________ Discuss-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnustep
