Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Double Limit

Double Limit

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stan the man
    wrote on last edited by
    #1

    HI. I have alwasy assumed for some bad reason that DBL_MIN means the minimum value for a double. But it is actually the minimum position number. I was wondering is there a CONSTANT that holds the minimum double (negative) number? Thanks in advance.

    S 1 Reply Last reply
    0
    • S Stan the man

      HI. I have alwasy assumed for some bad reason that DBL_MIN means the minimum value for a double. But it is actually the minimum position number. I was wondering is there a CONSTANT that holds the minimum double (negative) number? Thanks in advance.

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      First include <limits>. Now get minimum like this:

      -std::numeric_limits<double>::max();
      

      Steve

      S 1 Reply Last reply
      0
      • S Stephen Hewitt

        First include <limits>. Now get minimum like this:

        -std::numeric_limits<double>::max();
        

        Steve

        S Offline
        S Offline
        Stan the man
        wrote on last edited by
        #3

        DO I also need to do something else? It says that std is not a namesapce etc. THanks for the help.

        S R 2 Replies Last reply
        0
        • S Stan the man

          DO I also need to do something else? It says that std is not a namesapce etc. THanks for the help.

          S Offline
          S Offline
          Stephen Hewitt
          wrote on last edited by
          #4

          Just have to make sure you have this line in the file: #include <limits> Steve

          1 Reply Last reply
          0
          • S Stan the man

            DO I also need to do something else? It says that std is not a namesapce etc. THanks for the help.

            R Offline
            R Offline
            Rilhas
            wrote on last edited by
            #5

            For strict ANSI you should only use and assume the the most negative double representable is -DBL_MAX (the negative of DBL_MAX). This will result in -1.7976931348623158e+308, which is, in fact the most negative number that can be represented. This assumption is reasonable since the sign bit can always be used to represent any negative form of any positive number and vice-versa. Note, however, that the "resolution" is only of about 15 digits. This means that 10e20 + 1.0 will result in 10e20. And you can keep adding 1.0 and the result will never change from 10e20. So, it is important to note the difference between dynamic range (308 exponent) and resolution (about 15 decimal digits). Rilhas

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups