How to get the limit on it's range of the double type?

Discussion in 'C Programming' started by Viery, Mar 6, 2004.

  1. Viery

    Viery Guest

    Hi,
    I want to write some codes to get the limit of range in real
    number.
    Could you please give me some sample? Because I am not familiar
    with C language.

    Thanks,
    Viery
     
    Viery, Mar 6, 2004
    #1
    1. Advertisements

  2. The values are defined by macros belonging to <float.h>
     
    Emmanuel Delahaye, Mar 6, 2004
    #2
    1. Advertisements

  3. Viery

    Malcolm Guest

    #include <float.h>
    #include <stdio.h>

    int main(void)
    {
    printf("Biggest double %g\n", DBL_MAX);
    printf("Smallest fraction %g\n", DBL_MIN);
    printf("Decimal precison %d digits\n", (int) DBL_DIG);
    return 0;
    }
     
    Malcolm, Mar 6, 2004
    #3
  4. Viery

    Joe Wright Guest

    Why the cast? DBL_DIG is int.
     
    Joe Wright, Mar 6, 2004
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.