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. Emmanuel Delahaye, Mar 6, 2004
    #2
    1. Advertisements

  3. Viery

    Malcolm Guest

    "Viery" <> wrote in message
    > Hi,
    > I want to write some codes to get the limit of range in real
    > number.
    > Could you please give me some sample?
    >

    #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

    Malcolm wrote:

    > "Viery" <> wrote in message
    >
    >>Hi,
    >> I want to write some codes to get the limit of range in real
    >>number.
    >> Could you please give me some sample?
    >>

    >
    > #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;
    > }
    >
    >

    Why the cast? DBL_DIG is int.

    --
    Joe Wright mailto:
    "Everything should be made as simple as possible, but not simpler."
    --- Albert Einstein ---
     
    Joe Wright, Mar 6, 2004
    #4
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. luna
    Replies:
    1
    Views:
    7,050
  2. Jeffrey
    Replies:
    0
    Views:
    1,480
    Jeffrey
    Jul 9, 2003
  3. Sydex
    Replies:
    12
    Views:
    7,183
    Victor Bazarov
    Feb 17, 2005
  4. =?ISO-8859-1?Q?Martin_J=F8rgensen?=

    cast from function call of type int to non-matching type double

    =?ISO-8859-1?Q?Martin_J=F8rgensen?=, Jun 18, 2006, in forum: C Programming
    Replies:
    16
    Views:
    1,088
    CBFalconer
    Jun 19, 2006
  5. Replies:
    1
    Views:
    1,398
    Victor Bazarov
    Jun 28, 2005
  6. nicknack

    limit date range with calendar

    nicknack, Mar 11, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    1,015
    nicknack
    Mar 12, 2007
  7. Replies:
    2
    Views:
    428
  8. DFS
    Replies:
    133
    Views:
    3,462
    Tim Rentsch
    Jun 12, 2014
Loading...