Mail Archives: djgpp/1997/07/30/10:04:25
In article <33DE6FA3 DOT 460B59E AT voyager DOT net> Mark Levis <mlevis AT voyager DOT net> writes:
# Michèle C. Dupré wrote:
# >>I want to be able to have more than 10 digits print out (if the age were
# >>10,000 years for example).
# >>I am new to C (and programming in general) and teaching myself, so any
# >>criticism will be appreciated.
#
# Use a double. It will have precision up to 14 digits.
Nope. The Standard guarantees only a number of 10 significant digits
minimum. The actual limit on your system is available with DBL_DIG
from <float.h>. If DBL_DIG is too small, you could try long double
with LDBL_DIG digits. However, LDBL_DIG is only guaranteed to be at
least 10 as well.
# An int will only handle number from -32767 to 32768.
Nope. An int will handle at least any number from -32767 to 32767. It
might be able to hold 32, 42 or 64 bit. (Note that on many 16bit 2s
complement machines your sign needs to be reversed: INT_MIN from
<limits.h> may be -32768 and INT_MAX may be 32767).
# unsigned int 0 65535
Dito. These are minimum values only. See UINT_MAX from <limits.h>.
Regards,
Jens
--
Jens Schweikhardt http://www.uni-stuttgart.de/People/schweikhardt/home.html
SIGSIG -- signature too long (core dumped)
- Raw text -