Hi,

i'm wondering if i am missing something, but is KVC's @sum operator supposed to handle negative values? i'm using it to calculate the sum (duh) of NSDecimalNumber in a custom class. all is going fine, but as soon as i have a negative value, i get a huge negative number as result.

for example, the following two lines on sample data illustrate the odd result. note how the array shows a range of numbers in a "reasonable" range, but the sum is completely out of whack. in all my test cases without negative numbers, the sum is fine.


NSLog(@"%f", [[rows valueForKeyPath:@"@sum.FooField"] floatValue]);
NSLog(@"%@", [rows valueForKeyPath:@"@sum.FooField"]);
NSLog(@"%@", [rows valueForKeyPath:@"FooField"]);

2009-07-03 23:48:21.881 FooApp[16072:a0f] -7922816051279260559605760.000000 2009-07-03 23:48:21.881 FooApp[16072:a0f] -7922816251426433759342309.0336
2009-07-03 23:48:21.881 FooApp[16072:a0f] (
    899.0000,
    899.0000,
    2598.0000,
    799.0000,
    -899.0000,
    899.0000,
    599.0000,
    599.0000,
    699.0000,
    1798.0000,
    699.0000,
    599.0000,
    999.0000,
    899.0000
)

what could i possibly be missing? any thoughts would be appreciated.

yours,
marc
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to