Formulas 2.1. Representation of numbers

Formulas can work with integer numbers as well as with real numbers.

Real numbers

You can type many real numbers by using a decimal notation, for instance 3.14159, 299792.5, or -0.000123456789. For very large or small numbers, you can use the e-notation: 6.022·1023 is typed as 6.022e23 or 6.022e+23, and -1.6021917·10-19 is typed as -1.6021917e-19. You can use also use the percent notation: 0.157 can be typed as 15.7%.

There are some limitations as to the values that real numbers can have in Praat. The numbers must lie between -10308 and +10308. If you type

    1e200 * 1e100

the outcome will be


but if you type

    1e300 * 1e100

the outcome will be


Another limitation is that the smallest non-zero numbers lie near -10-308 and +10-308. If you type

    1e-200 / 1e100

the outcome will be


but if you type

    1e-300 / 1e100

the outcome will be


Finally, the precision of real numbers is limited by the number of bits that every real number is stored with in the computer, namely 64. For instance, if you type


the outcome will be


because only 16 digits of precision are stored. This can lead to unexpected results caused by rounding. For instance, the formula

    0.34999999999999999 - 0.35

will result in


rather than the correct value of 1e-17. This is because the numbers 0.34999999999999999 and 0.35 cannot be distinguished in the computer's memory. If you simply type


the outcome will be


(as in this example, the calculator will always come up with the minimum number of digits needed to represent the number unambiguously).

Another example of inaccuracy is the formula

    1 / 7 / 59 * 413

Because of rounding errors, the result will be


Integer numbers

Formulas can work with integer (whole) numbers between -1,000,000,000,000,000 and +1,000,000,000,000,000. You type them without commas and without the plus sign: 337, -848947328345289.

You can work with larger numbers than that (up to 10308), but there will again be rounding errors. For instance, the formula

    1000000000000000 + 1

correctly yields


but the formula

    10000000000000000 + 1

yields an incorrect outcome:


Links to this page

© ppgb 20170916