Extended Math Functions in OpenInsight 9.3 and above (Functions/Subroutines/Programs,General)

Extended Math Functions in OpenInsight 9.3 and above

_addx (add)

_subx (subtract)

_mulx (multiply)

_divx (divide)

_eqx (equal, to full precision)

_nex (not equal, to full precision)

_ltx (less than, to full precision)

_gtx (greater than, to full precision)

_lex (less than or equal, to full precision)

_gex (greater than or equal, to full precision)

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>

_EQX

Equal, to full precision

For example:

a = "10.3456"

b = "10.34567"

If a _eqx b Then …

_NEX

Not equal, to full precision

For example:

a = "10.3456"

b = "10.34567"

If a _nex b Then …

_LTX

Less than, to full precision

For example:

a = "10.3456"

b = "10.34567"

If a _ltx b Then …

_GTX

Greater than, to full precision

For example:

a = "10.3456"

b = "10.34567"

If a _gtx b Then …

_LEX

Less than or equal, to full precision

For example:

a = "10.3456"

b = "10.34567"

If a _lex b Then …

_GEX

Greater than or equal, to full precision

For example:

a = "10.3456"

b = "10.34567"

If a _gex b Then …

  • kb/kb_articles/kb1059.txt
  • Last modified: 2024/01/30 13:36
  • by 127.0.0.1