OpenInsight Development Suite 9.3 will include the following new extended math functions:
_addx (add) _subx (subtract) _mulx (multiply) _divx (divide)
These functions allow you to perform math operations using full precision or a specified precision.
The _addx function adds two numbers. The required precision (number of decimal places) is an optional parameter. The syntax is as follows:
ans = _addx( num1, num2 [, decimalPlaces] ) For example:
a = "10.3456" b = "4.567" decimalPlaces = 2
x1 = _addx( a, b, decimalPlaces ) x2 = _addx( a, b ); * // For full precision.
// x1 will return 14.91 // x2 will return 14.9126
The _subx function subtracts two numbers. The required precision (number of decimal places) is an optional parameter. The syntax is as follows:
ans = _subx( num1, num2 [, decimalPlaces] ) For example:
a = "10.3456" b = "4.567" decimalPlaces = 2
x1 = _subx( a, b, decimalPlaces ) x2 = _subx( a, b ); * // For full precision.
// x1 will return 5.78 // x2 will return 5.7786
The _mulx function multiplies two numbers. The required precision (number of decimal places) is an optional parameter. The syntax is as follows:
ans = _mulx( num1, num2 [, decimalPlaces] ) For example:
a = "10.3456" b = "4.567" decimalPlaces = 2
x1 = _mulx( a, b, decimalPlaces ) x2 = _mulx( a, b ); * // For full precision.
// x1 will return 47.25 // x2 will return 47.2483552
The _divx function divides two numbers. The required precision (number of decimal places) is an optional parameter. The syntax is as follows:
ans = _divx( num1, num2 [, decimalPlaces] ) For example:
a = "10.3456" b = "4" decimalPlaces = 4
x1 = _divx( a, b, decimalPlaces ) x2 = _divx( a, b ); * // For full precision.
// x1 will return 2.6140 // x2 will return 2.6140000000000 ... <padded to 128 decimal places>
|