Re: Pure newbie :(
Re: Pure newbie :(
- Subject: Re: Pure newbie :(
- From: "Mike R. Manzano" <email@hidden>
- Date: Tue, 11 Nov 2003 11:37:17 -0800
Floats and doubles are approximations of numbers because of the way
they are represented internally; some numbers require an unlimited
number of bits to be represented in memory exactly. You should not
compare floats with the == operator, but instead use < and > to bound
it to some very close range.
Here is an article on ways to compare floats:
<
http://www.adtmag.com/joop/crarticle.asp?ID=396>
On Nov 11, 2003, at 10:45 AM, Denis Vaillant wrote:
Hello,
I do not understand why the comparison does not work :
rxNext1 = 0.400000;
if(rxNext1==0.400000)
{
NSLog(@"Should work :(");
}
PS : rxNext1 is a float.
Cheers,
Denis
_______________________________________________
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.
_______________________________________________
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.