Re: Best way to compare CGFloats
Re: Best way to compare CGFloats
- Subject: Re: Best way to compare CGFloats
- From: "Rimas M." <email@hidden>
- Date: Wed, 30 Jun 2010 16:47:11 +0300
On Wed, Jun 30, 2010 at 1:06 PM, Alastair Houghton
<email@hidden> wrote:
> I think they test for exact equality. Whether that's documented or not I'm
> not certain, but disassembling those functions appears to support that
> conclusion.
I see. Hope that will not cause any unexpected problems. For now I am
going to use:
#define cDefaultFloatComparisonEpsilon 0.0001
#define cEqualFloats(f1, f2, epsilon) ( fabs( (f1) - (f2) ) < epsilon )
#define cNotEqualFloats(f1, f2, epsilon) ( !cEqualFloats(f1, f2, epsilon) )
Thank you for your help.
Regards,
Rimas M.
_______________________________________________
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