Arithmetic Mode | Trigonometric Exponential Logarithmic |
SQR(x) | INTSQR(x) | GCD(a,b) | Multi-Precision |
---|---|---|---|---|---|
Decimal | ✓ | ✓ | |||
Decimal 1000-digit | ✓ | ||||
Binary | ✓ | ✓ | |||
Complex | ✓ | ✓ | |||
Rational | ✓ | ✓ | ✓ |
When any of following OPTION ARITHMETIC statements is written in each program unit, the program goes irrespective of the mode indicated by the toolbar icons.
Decimal OPTION ARITHMETIC DECIMAL (Full BASIC Compatible) Decimal 1000-digit OPTION ARITHMETIC DECIMAL_HIGH Binary OPTION ARITHMETIC NATIVE (Full BASIC Compatible) Complex OPTION ARITHMETIC COMPLEX Rational OPTION ARITHMETIC RATIONAL
Notice that OPTION statements written in the mainprogram is ineffective to external procedures.
How to select an arithmetic mode
Decimal 1000-digit mode should be used for approximated calculation in decimal fractions.
If you do not prefer approximation or you need to handle with indefinitely large integers, use the rational operation mode.
Example.
Collatz Conjecture
(If n is even, divide it by 2, if n is odd multiply it by 3 and add 1, and repeat the process indefinitely until it becomes 1.)
OPTION ARITHMETIC RATIONAL INPUT n DO UNTIL n=1 IF MOD(n,2)=0 THEN LET n=n/2 ELSE LET n=3*n+1 PRINT n END IF LOOP END