On 11 Dec 2009, at 21:14, Bryan Henry wrote:
> You should not compare floating point numbers for equality in most cases. 
> This is true of any language on any platform.

Indeed, some floating-point numbers (such as the one represented by the integer 
0x7fc00000) will compare as not equal to themselves:

{
    union { float f; long i; } u;
    u.i = 0x7fc00000;
    if(u.f == u.f)
        printf("As expected.\n");
    else
        printf("How strange.\n");
}_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to