Re: Rounding to two decimals
Re: Rounding to two decimals
- Subject: Re: Rounding to two decimals
- From: "Ihar 'Philips' Filipau" <email@hidden>
- Date: Sun, 18 Jul 2004 13:16:27 +0200
Ken Garden wrote:
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?
Did you tryed using NSString initWithFormat: ?
Last decade I'm working as software developer and last 30 years of
Unices, formating were doing right thing.
I'm absolutely sure that NeXT got it right too - I cannot test it
fast - i'm not a /visual/ programmer.
[ifilipau@diana ~]$ cat a.c
#include <stdio.h>
int main()
{
float a = 123.159;
printf("%f\n", a);
printf("%.2f\n", a);
return 0;
}
[ifilipau@diana ~]$ ./a
123.158997
123.16
[ifilipau@diana ~]$
_______________________________________________
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.