float comparisons info

This is a discussion on float comparisons info within the C++ Programming forums, part of the General Programming Boards category; Found this very good article on the issues with float precision and using them in comparisons: Comparing Floating Point Numbers ...

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

    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
    1,625
    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, 05:57 PM
  2. multiple file loading. so fruturated! help!
    By psychopath in forum Game Programming
    Replies: 5
    Last Post: 05-09-2005, 06:13 PM
  3. File input question
    By Beast() in forum C Programming
    Replies: 16
    Last Post: 07-09-2004, 04: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, 10:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21