Negative values in KVC's @sum?
Negative values in KVC's @sum?
- Subject: Negative values in KVC's @sum?
- From: marc hoffman <email@hidden>
- Date: Fri, 3 Jul 2009 23:53:40 +0200
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 (email@hidden)
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:
This email sent to email@hidden