Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Finding minimum normalized positive number

  1. Jan 20, 2008 #1
    I was asked to write a C program to find minimum normalized positive number that can be represented in my computer. I know that the value is 2.2250738585072014e-308.
    I wrote the program to find the machine precision. Now i need to make some parameter changes to this program to find the min. number given above.
    Epsilon = Epsilon/2.0 ; //Variable value is halved until the smallest
    //value of 'e' is found while meeting the
    //required condition
    while ((float)((Epsilon+1.0))>1.0);

    Epsilon = 2*Epsilon;

    this gave me the machine precision. Any help would be appreciated.
    thanks in advance.
  2. jcsd
  3. Jan 22, 2008 #2

    jim mcnamara

    User Avatar
    Science Advisor
    Gold Member

    I'm confused. You've casted Epsilon to a float (single precision), yet the value you shows is the POSIX value for min double precision numbers. Make Epsilon a double precision variable, and change the cast (float) to (double) - for starters.

    Also, look in the limits.h file (unless you are on windows) for DBL_MIN and FLT_MIN.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Finding minimum normalized positive number