more float rounding info
more float rounding info
- Subject: more float rounding info
- From: "Jay Rimalrick" <email@hidden>
- Date: Sat, 29 Nov 2003 23:32:11 -0500
here is my problem upfront and personal:
float aFloat = 0.615;
int aInt = 0;
aFloat = aFloat * 100.0;
aFloat = round(aFloat); //roundf acts the same way as round for me
aInt = (int)aFloat; //just making sure the decimal values are gone
aFloat = aInt / 100.0;
NSLog(@"%f", aInt / 100.0); //this outputs 0.62
NSLog(@"%f", aFloat); //this outputs 0.619999
-this is very weird to me, any and all help is greatly appreciated
________________________________________________________________
Sent via the WebMail system at 1st.net
_______________________________________________
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.