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).
The number to the right of the E is called the exponent. If the exponent is negative, this means that the decimal point is to be shifted to the left, instead of to the right. So:
  • 4.5E–3 is the same as 0.0045 (four and a half thousandths).
  • 1E–6 is the same as 0.000001 (one millionth).
You can write numbers like this in expressions, and also when entering numeric data requested by REXX programs. The language processor will use this notation when displaying results that are too big or too small to be expressed conveniently as ordinary numbers or decimals. When the language processor uses this notation, the part of the number that comes before the E (the mantissa) will usually be a number between 1 and 9.99999999.
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.