Re: Decimal Rounding...
Re: Decimal Rounding...
- Subject: Re: Decimal Rounding...
- From: Hasan Diwan <email@hidden>
- Date: Mon, 26 Aug 2002 21:23:46 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
// remember to link with libm
#import <math.h>
#import <Cocoa/Cocoa.h>
(NSNumber *)roundThree:(float)f {
return [NSNumber numberWithFloat:(rint(f*1000))/1000];
}
On Monday, August 26, 2002, at 06:10 PM, Joshua D. Orr wrote:
I am trying to find a class to help me round floats to three decimal
places.
I thought about using NSDecimalNumber, but I am having trouble finding
an easy way to make one using a number from a float. Does any one have
suggestions for a simple way to do rounding? Thanks!
_______________________________________________
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.
Hasan Diwan
OpenPGP KeyID: 0xBE42DCA6
Fingerprint: 1CB0 47E3 0A24 DAC1 DCCA 4225 F166 40C2 BE42 DCA6
http://www.cs.rpi.edu/~diwanh/gpg.key
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)
iD8DBQE9atSx8WZAwr5C3KYRAv0KAJ9I+LQ0HACHKWhvG8t6Sm3Tiy9IlgCeMFNr
zcVagn6LVuuJL2cUI+3Umyg=
=EnW4
-----END PGP SIGNATURE-----
_______________________________________________
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.