Could anyone give me a hint to write a program that prints the smallest and the largest double value available on the system that the program is running on?
I mean by using c language! thanks
Printable View
Could anyone give me a hint to write a program that prints the smallest and the largest double value available on the system that the program is running on?
I mean by using c language! thanks
AFAIK it is the same for all OS types, and is strictly a C thing:
2.2E-308 to 1.8E308
Where E is X 10 raised to the power...
http://bwilkins.panola.cc.tx.us/COSC...&Constants.htm
EDIT: I tryed to print the range, I can print 2.2E-308 but for some reason I get infinity for 1.8E308
It might be one of C's limitation,
double x = 2.2E-308,y = 1.8E308;
cout << "double ranges from " << (double) x << " to " << (double) y << endl;
system("PAUSE");
double ranges from 2.2e-308 to infinity
Press any key to continue...
That's usually specified in limits.h
Ammo
wouldn't that have an issue with the word size? I.E.(as my post got answered before), a 64 bit word has a 1 bit sign, an 11 digit exponent, and a 35 bit mantissa.
I made some code:
what do you think?
anyone know how to copy some words from my own file to this website under Linux?
you click in your text with the left mouse button at the start of the line you want to coppy.
keep the left button down and selelect the text..
release the left mouse button..
move your mouse to the input box below... and click your middle mouse button..
that's all.
The limits are defined in limits.h.Try help on the header.