• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Best way to compare CGFloats
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Best way to compare CGFloats (From: "Rimas M." <email@hidden>)
 >Re: Best way to compare CGFloats (From: Alastair Houghton <email@hidden>)
 >Re: Best way to compare CGFloats (From: "Rimas M." <email@hidden>)
 >Re: Best way to compare CGFloats (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: NSImage drawing on 10.5 issue [SOLVED]
  • Next by Date: Re: Best way to compare CGFloats (Rick B.)
  • Previous by thread: Re: Best way to compare CGFloats
  • Next by thread: CALayer-hosting view and child NSView's
  • Index(es):
    • Date
    • Thread