RD> understand. If you have a look at lines nine and ten
RD> cout << 1.e3 << endl; // 1000
RD> cout << 1.e-3 << endl; // 0.001
RD> Does 1.e3 mean one multiplied by a thousand, and 1.e-3 mean one
RD> multiplied by
RD> minus a thousand?
yes. it's scientific notation. e2 is *100, e1 is *10, e0 does nothing,
e-2 does /100, e/5 does /10000, e12 does *1000000000000, and so on. In
scientific notation, at the right of the e stands a number which is
used as an exponent to the current base (10) and multiplied by the
number at the left of the e which is called the mantissa.
incidentally, floating point processors use a similar scheme to store
and compute values. a 'float' number has something like 23 bits of
mantissa which is always in the interval 0.5 < x < 1 (either that or 1
< x < 2) and an exponent of 8 bits that goes from -128 to +127 or
nearly that; the base is 2. there is one sign bit and that sums up to a
total of 32 bits.
another standard is the 'double' format, 64-bit (52,11,1). other
formats are optional and/or redundant. Long ago, several large
companies had their own formats. Also, the 'long double' format on PC's
is 80 bits (63,15,1, and 1 bit wasted), but is not guaranteed of
existing (or being the same) on other machines, where the biggest might
be 64 bit, or 96 bit, or 128 bit.
matju
--- Terminate 4.00/Pro
---------------
* Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42)
|