NUMERIC Instruction
tcSCRIPT uses floating point arithmetic of arbitrary precision that operates on strings representing the numbers. The NUMERIC statement is used to control most aspects of arithmetic operations.
NUMERIC DIGITS [ expr ] ;
FORM [ SCIENTIFIC | ENGINEERING | [ VALUE ] expr ] ;
It has two distinct forms: DIGITS and FORM; which one to choose is given by the second token in the instruction.
- DIGITS
- Is used to set the number of significant digits in arithmetic operations. The initial value is 9, which is also the default value if expr is not specified. Large values for DIGITS may slow down some arithmetic operations considerably. If specified, expr must be a positive integer.
- FORM
- Is used to set the form in which exponential numbers are written. It can be set
to either SCIENTIFIC or ENGINEERING. SCIENTIFIC uses a mantissa in the range
1.000... to 9.999..., and an exponent that can be any integer. ENGINEERING uses
a mantissa in the range 1.000... to 999.999..., and an exponent that is
divisible by 3. The initial and default setting is SCIENTIFIC. Following the
keyword FORM may be the keywords SCIENTIFIC and ENGINEERING or the keyword
VALUE. In this case the rest of the statement is considered an expression which
will evaluate to either SCIENTIFIC or ENGINEERING. However, if the first token
of the expression following VALUE is neither a symbol nor literal string, the
VALUE keyword can be omitted.
The setting of FORM never affects the decision about whether to choose exponential form or normal floating point form. It only affects the appearance of the exponential form once that form has been selected.