Thread: float comparisons info

  1. #1
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472

    float comparisons info

    Found this very good article on the issues with float precision and using them in comparisons:

    Comparing Floating Point Numbers

    It was key to solving a crafty bug that only occured in a very particular instance of the program settings and only using an -O2 build, after debugging i realised it had to be the float comparisons in a statement. The article was a wake up call!

    cheers.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  2. #2
    Registered User \007's Avatar
    Join Date
    Dec 2010
    Posts
    179
    Pretty interesting. I have always found floating points a bit tricky and mysterious in C~

  3. #3
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    C~ ???
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Class won't call
    By Aalmaron in forum C++ Programming
    Replies: 3
    Last Post: 04-13-2006, 04:57 PM
  2. multiple file loading. so fruturated! help!
    By psychopath in forum Game Programming
    Replies: 5
    Last Post: 05-09-2005, 05:13 PM
  3. File input question
    By Beast() in forum C Programming
    Replies: 16
    Last Post: 07-09-2004, 03:23 PM
  4. error declaration terminated incorrectly help
    By belfour in forum C++ Programming
    Replies: 7
    Last Post: 11-25-2002, 09:07 PM
  5. Why does it work in Visual Studio and Not Borland
    By MonteMan in forum C++ Programming
    Replies: 14
    Last Post: 10-20-2002, 09:36 PM