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

1e+300

but if you type

1e300 * 1e100

the outcome will be

--undefined--

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

1e-300

but if you type

1e-300 / 1e100

the outcome will be

0

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

pi

the outcome will be

3.141592653589793

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

0

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

0.34999999999999999

the outcome will be

0.35

(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

0.9999999999999999

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

1000000000000001

but the formula

10000000000000000 + 1

yields an incorrect outcome:

1e16