• 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: Strange behavior of -Wfloat-equal on clang (Xcode 5)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange behavior of -Wfloat-equal on clang (Xcode 5)


  • Subject: Re: Strange behavior of -Wfloat-equal on clang (Xcode 5)
  • From: Sean McBride <email@hidden>
  • Date: Fri, 03 Jan 2014 14:23:09 -0500
  • Organization: Rogue Research Inc.

On Fri, 3 Jan 2014 18:28:29 +0000, Asiga Nael said:

>First of all, I don't understand why a==2.1 triggers the warning and
>a==2.0 doesn't.

Then you need to read up on how floating point numbers are encoded... there is certainly much on the Internet about this.

Not every decimal number can be expressed exactly as a floating point number.  You can see that here:
<http://www.h-schmidt.net/FloatConverter/>

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Strange behavior of -Wfloat-equal on clang (Xcode 5) (From: Asiga Nael <email@hidden>)
 >Re: Strange behavior of -Wfloat-equal on clang (Xcode 5) (From: Fritz Anderson <email@hidden>)
 >Re: Strange behavior of -Wfloat-equal on clang (Xcode 5) (From: Asiga Nael <email@hidden>)

  • Prev by Date: Re: Strange behavior of -Wfloat-equal on clang (Xcode 5)
  • Next by Date: Re: Calling fopen() from a simple C++ program in Xcode 5.0.2 raises EXC_BAD_ACCESS, code=2
  • Previous by thread: Re: Strange behavior of -Wfloat-equal on clang (Xcode 5)
  • Next by thread: Re: Strange behavior of -Wfloat-equal on clang (Xcode 5)
  • Index(es):
    • Date
    • Thread