Decimal Math Functions

In this section:

In addition to supporting functions that use integer math and floating point math, iWay Functional Language (iFL) also supports decimal math functions. Floating point math is performed using the Base 16 (Hexadecimal) numbering system, which does not accurately represent decimal vales below the radix (decimal point). This results in an inability to rely on exact values with decimal places, which is important when calculating monetary units, such as dollars and cents. If values are developed during computations that are not in the represented domain of decimal numbers, an iFL error is generated.


Top of page

x
_dadd(): Add a Number

The _dadd() function returns the decimal sum of the decimal terms. This function uses the following format:

_dadd(term1, term2)

term1

number

The first number to be added.

term2

number

The second number to be added.

There is nothing implied by the order of the terms. Any term can also be an XPATH() function. If an XPATH() function returns multiple results, then all of the results are added to the sum.


Top of page

x
_dsub(): Subtract a Number

The _dsub() function returns the decimal difference. This function uses the following format:

_dsub(minuend, subtrahend)

minuend

number

The number to be subtracted.

subtrahend

number

The number to be subtracted from the minuend.

Both terms that are used in this function must be decimal numbers.


Top of page

x
_dmul(): Multiply a Number

The _dmul() functions returns the decimal product of the first factor multiplied by the second factor. This function uses the following format:

_dmul(multiplicand, multiplier)

multiplicand

number

The number to be multiplied.

multiplier

number

The multiplier for the function.

Since multiplication is a commutative operation, there is nothing implied by the order of the factors. Both terms must be decimal numbers.


Top of page

x
_ddiv(): Divide a Number

The _ddiv function returns the decimal quotient of the dividend divided by the divisor. Attempting to divide by zero results in an error. This function uses the following format:

_ddiv(dividend, divisor)

dividend

number

The number to be divided. The default scale of the result will be that of the dividend.

divisor

number

The divisor for the function, which must not be equal to 0.

Both terms must be decimal numbers.


iWay Software