std::numeric_limits<float>::min()

This is a discussion on std::numeric_limits<float>::min() within the C++ Programming forums, part of the General Programming Boards category; Why does std::numeric_limits<float>::min() give 0.0f instead of -XXX (whatever it is)?...

  1. #1
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    std::numeric_limits<float>::min()

    Why does std::numeric_limits<float>::min() give 0.0f instead of -XXX (whatever it is)?
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,805
    What compiler? I get 1.17549e-038 with mingw
    Woop?

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    According to the section in C++ standard about min() (18.2.1.2): "For floating types with denormalization, returns the minimum positive normalized value."

    This is probably because floating point numbers are all signed anyway, and knowing the smallest value representable is more useful than knowing the most negative number (which is just the max() * -1).

Popular pages Recent additions subscribe to a feed

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