• 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: Possible GCC float comparison bug? Or am I doing it wrong?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible GCC float comparison bug? Or am I doing it wrong?


  • Subject: Re: Possible GCC float comparison bug? Or am I doing it wrong?
  • From: Marshall Clow <email@hidden>
  • Date: Tue, 19 Feb 2008 19:41:01 -0800

Title: Re: Possible GCC float comparison bug? Or am I doing it wr
At 9:27 PM -0600 2/19/08, David Rogers wrote:
This may be completely obvious but I can't tell what's going on.  As far as I know the comparison should be true.  I've tried it with Xcode 3.0 on both Intel and PPC and get the same results on both.

-0.001 is less than -0.1, right?  Or does the compiler see things differently?  Here's a sample app to illustrate the behavior that I'm seeing.

No, it's not.

0.001 is less than 0.1 but, -0.001 is _greater_ than -0.1
Put them on a number line if that helps:

                -1                0                 1
-inf -----------|--------|-----|--|--|-----|--------|--------- +inf
                       -0.1  -0.001 0.001 0.1

--
-- Marshall

Marshall Clow     Idio Software   <mailto:email@hidden>

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed,
the hands acquire shaking, the shaking becomes a warning.
It is by caffeine alone I set my mind in motion.
 _______________________________________________
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: 
 >Possible GCC float comparison bug? Or am I doing it wrong? (From: David Rogers <email@hidden>)

  • Prev by Date: Re: Possible GCC float comparison bug? Or am I doing it wrong?
  • Next by Date: Re: Possible GCC float comparison bug? Or am I doing it wrong?
  • Previous by thread: Re: Possible GCC float comparison bug? Or am I doing it wrong?
  • Next by thread: SCM in Xcode 3.0
  • Index(es):
    • Date
    • Thread