Thread: max double, a la INT_MAX

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    82

    max double, a la INT_MAX

    I've been working on some projects involving prime-generation/factoring, during which I've been trying to keep close track of the numeric limits on the program. But I'm stumped on one part: is there a way to find the maximum value of the floating point types?

    It appears that limits.h only has info on integer types, and I wasn't having any luck with google.

  2. #2
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    float.h has FLT_MAX

  3. #3
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Use <limits> instead
    Code:
    #include <limits>
    
    std::numeric_limits<double>::max();
    Last edited by Sang-drax; 01-30-2005 at 05:18 AM. Reason: spelling
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    On the topic of std::numeric_limits, has anyone ever tried using min()/max() together with including windows.h? There are some stupid min/max macros there that has to be undefined for numeric_limits to work...
    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.

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Or you #define NOMINMAX before including windows.h.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. expected primary expression
    By mju4t in forum C Programming
    Replies: 2
    Last Post: 03-27-2007, 06:59 PM
  2. Unknown Math Issues.
    By Sir Andus in forum C++ Programming
    Replies: 1
    Last Post: 03-06-2006, 06:54 PM
  3. Certain functions
    By Lurker in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2003, 01:26 AM
  4. Please HELP!!
    By traz in forum C++ Programming
    Replies: 4
    Last Post: 04-14-2003, 09:20 PM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM