&fabs(4)&fabs, &fadd, &fsub, &fmul, &fdiv, &fsqrt - Floating point macro operators
&fabs num
&fadd num1 num2
&fsub num1 num2
&fmul num1 num2
&fdiv num1 num2
&fsqrt num
The floating point numeric operators operate on variables or literals (strings in the form of numbers) to perform floating point computations, returning double precision floating point numbers in scientific format. The contents of the variables are interpreted as floating point numbers with a 15 digits of precision and a range of +/-1.7e308.
The operators may all be abbreviated to their three letter abbreviation (i.e. &fmultiply may be expressed as &fmu). In all cases the first argument is completely evaluated before the second argument.
&fabs num
&fadd num1 num2
&fsub num1 num2
&fmul num1 num2
&fdiv num1 num2
&fsqrt num
Expression evaluation is prefix. Operators may be nested using a pre-fix ordering, there is no concept of brackets (in-fix notation). The expression (2 * 3) + 4 is expressed as:-
&fadd &fmul 2 3 4
conversely 2 * (3 + 4) is expressed as:-
&fmul 2 &fadd 3 4
The number 123.4 can also be expressed as 1.234e2 and 0.001234 as 1.234e-3.
Add multiply a number by pi and print in a readable form:-
ml-write &spr "%.10g" &fmul %num1 3.141592654
To format the results of these functions in a more usable form use commands '%f' and '%g' of the &sprintf(4) function.
(c) Copyright JASSPA 2025
Last Modified: 2022/06/12
Generated On: 2025/09/29