Re: Rounding to two decimals
Re: Rounding to two decimals
- Subject: Re: Rounding to two decimals
- From: Ken Garden <email@hidden>
- Date: Sun, 18 Jul 2004 00:18:02 +0200
Probably it's just a slight mistake. Here's the relevant code snippet
with some sample data filled for the integers:
[BEGIN]
int total, multiply;
float average;
total = 5;
multiply = 8;
average = (float)multiply / total;
average = round(average * 100) / 100;
[averageLabel setFloatValue:average];
[END]
The text printed in averageLabel is "1.6000000238...". It seems the
rounding is done quite nicely, I'm just wondering why there's such a
strange extension. An idea how I can get rid of this?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.