Hi folks,
I think I need some help understanding floats.

I have a class that calculates a balance and places it in a table column. At the end of this method I NSLog the output like so;

NSLog(@"current balance is: %@",balance);

and get

current balance is: 18976.69

in the console. So far so good.

The method plonks the balance into a table and returns it to whence it came. The table is sourced by the normal datasource delegate methods and the column has a number formatter on it set to Decimal #,##0,00## with half even rounding. I placed the last ##'s in there to check that the floats weren't producing decimals with more than 2 places but in my table column I get 18976.6995 which doesn't make sense. The float calculation is exactly 2 decimal places, I know that for a fact and NSLog proves it. Yet somehow, the table datasource appears to produce random decimal digits where i have the last ##.

Am I totally misunderstanding something about floats? Or is the extra ##'s in the formatter making things up?
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to