`prev Menu next`

Numbers ☆☆☆
Numerical Constants
A Numerical constant without exponent part is written using numerals, a decimal point(.), and a plus sign or minus sign. The figure 0 preceding the decimal point can be omitted.
Example. '0.12' can be written as '.12'

（Note) Omitting 0's succeeding the decimal point, a numeric can be written as '23.', while Full BASIC does not distinguish '23.' from '23'.

Numerical constants with exponent parts
Example.
2.3E4，.23E5，and 23E3 stand for 23000.
2.3E-2，.23E-1，and 23E-3 stand for 0.023.
(Note) 'E' can be written in lower case. No space character can be written just before or just after 'E'.

Four arithmetic operations and power operation
Addition, subtraction, multiplication and division are denoted by +, -, *, / respectively.
ab, a raised to b, is denoted by a^b.
The priority is power operation first, multiplication and division second, and addition and subtraction third. Multiplication and division have the same priority. Addition and subtraction have the same priority. Operations with the same priority are applied from left. For example, 2^3^4 is evaluated as (2^3)^4.
Parentheses can be used for changing the priority. All parentheses are round parentheses even if they are nested.
0^0 is defined to be 1.

(Note) While minus signs are used for changing sign, those minus signs have the same priority with subtraction. Note that this is different from Microsoft BASIC.

(Note) Every non-integral power of a negative number causes an exception. For example, (-32)^0.2 causes an error, although it is -2 mathematically.

Numeric Expressions on the DECIMAL mode
On the decimal mode, the result of an arithmetic operation has precision greater than 16 digits.
If the true value of an operation can be represented by a decimal floating point of at most 16 digits, the result of the operation is accurate, that is, it has no error.
For example, the result of SQR(49) is accurately 7. The result of 7^2 is accurately 49.
(note)
The accuracy of the result of continued operations can not be guaranteed.
For example, it is uncertain whether the result of SQR(7)^2 becomes 7.
(note2)
When using 64 bit version of FPC on Windows, the precision of arithmetic operations is greater than 14 digits but not 16 digits.
Refer to Option menu Numbers and Precision