1

I'm doing some gnustep programming specifically with NSDecimalNumber and I don't understand the result here, this is a simple division

NSDecimalNumber *n = [[NSDecimalNumber one] decimalNumberByDividingBy: [NSDecimalNumber     decimalNumberWithString:@"3.0"]];
NSLog(@"N1/ %lf", [n doubleValue]);
NSDecimalNumber *n2 = [[NSDecimalNumber decimalNumberWithString:@"1.0"] decimalNumberByDividingBy: [NSDecimalNumber decimalNumberWithString:@"3.0"]];
NSLog(@"N2/ %lf", [n2 doubleValue]);

// results of the log
// expected result is naturally stored in n2

2014-02-20 05:56:14.286 main[9627] N1/ 333.333333 
2014-02-20 05:56:14.286 main[9627] N2/ 0.333333

do you know if it is a bug from gnustep or a mistake I made ? I've already searched thru gnustep bug report but nothing relevant has been reported

$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

gnustep package version 7.6

uname -a
Linux devbox2 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 16:19:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

command for compilation :

gcc `gnustep-config --objc-flags` -o main main.m -L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base -Wall

0 Answers0