I need to represent 10 raised to the power of 100 (10 E 100) in a c program. Does C have a datatype that can do this natively?
Printable View
I need to represent 10 raised to the power of 100 (10 E 100) in a c program. Does C have a datatype that can do this natively?
You mean like:
Code:itsme@itsme:~/C$ cat float.c
#include <stdio.h>
int main(void)
{
double close_to_pi = 22./7.;
printf("%e\n", close_to_pi);
return 0;
}
Code:itsme@itsme:~/C$ ./float
3.142857e+00
Not exactly. I am trying to represent this number: 10000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 0. And I can't find a datatype large enough to represent it.
long long (in C99)? A long long variable usually occupies 64 bits.
Take itsme86's example. A double can easily hold that number. But there might be some loss of precision.
Code:#include <stdio.h>
int main(void) {
double big = 1e100;
printf("%f\n", big);
return 0;
}
Thanks. :-)