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

V

Viery

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
 
E

Emmanuel Delahaye

In said:
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.

The values are defined by macros belonging to <float.h>
 
M

Malcolm

Viery said:
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;
}
 
J

Joe Wright

Malcolm said:
#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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top