Re: Best way to compare CGFloats (Rick B.)
Re: Best way to compare CGFloats (Rick B.)
- Subject: Re: Best way to compare CGFloats (Rick B.)
- From: Alastair Houghton <email@hidden>
- Date: Wed, 30 Jun 2010 20:35:56 +0100
On 30 Jun 2010, at 17:37, Michael Ash wrote:
> While we're being pedantic, note that == is not always the same as
> "binary equivalence". For example, 0.0 == -0.0, and x != x when x =
> NAN.
That's a good point. I spoke inaccurately.
> Using == can make sense when you know that your values are exact
> integers, which is not an uncommon scenario, but neither is it the
> usual one.
It may also make sense sometimes with floating point values. An example might be where you have an object that you're using as the key for an NSDictionary; in that case, your -isEqual: method may well want to do a proper equality test.
These are, however, special situations.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden