Exponential Notation
Numbers much bigger or smaller than these are difficult to read
and write,
because it is easy to make a mistake counting the zeros. It is simpler
to use exponential
notation. Very big numbers can be written as an ordinary (fixed
point) number, followed by a letter E, followed by a whole number.
The whole number says how many places to the right the decimal point
of the fixed point number would have to be moved to obtain the same
value as an ordinary number. So:
- 4.5E6 is the same as 4500000 (four and a half million).
- 23E6 is the same as 23000000 (twenty-three million).
- 1E12 is the same as 1000000000000 (a million million).
- 4.5E–3 is the same as 0.0045 (four and a half thousandths).
- 1E–6 is the same as 0.000001 (one millionth).
For example:
j = 1
do until j > 1e12
say j /* says "1" */
j = j * 11 /* "11" */
end /* "121" */
/* "1331" */
/* "14641" */
/* "161051" */
/* "1771561" */
/* "19487171" */
/* "214358881" */
/* "2.35794769E+9" */
/* "2.59374246E+10" */
/* "2.85311671E+11" */
Numbers
written in exponential notation (for example, 1.5e9) are sometimes
called floating point numbers. Conversely, ordinary numbers (for example, 3.14) are sometimes
called fixed
point numbers.