These functions let you do most types of mathematical calculations.
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Adds the values of two parameters.
Syntax
Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| float | number1 | IN | A variable or literal string representing a number. |
| float | number2 | IN | A variable or literal string representing a number. |
| integer | precision | IN | A variable or literal string representing a positive whole number that specifies the precision of the result. The default is 9. |
| float | result | OUT | A variable that contains the sum of number1 and number2. |
Examples
Example 1:
@DTW_ADD(NUMB1, NUMB2, "2", result)
Example 2:
@DTW_rADD("12", NUMB2, "5")
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Divides the value of the first parameter by the value of the second parameter.
Syntax
Parameters
Table 13. DTW_DIVIDE Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| float | number1 | IN | A variable or literal string representing a number. |
| float | number2 | IN | A variable or literal string representing a number. |
| integer | precision | IN | A variable or literal string representing a positive whole number that specifies the precision of the result. The default is 9. |
| float | result | OUT | A variable that contains the result of number1 divided by number2. |
Examples
Example 1:
@DTW_DIVIDE("8.0", NUMB2, result)
Example 2:
@DTW_rDIVIDE("1", NUMB2, "5")
Example 3:
@DTW_rDIVIDE(NUMB1, "2", "5")
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Divides the first parameter by the second parameter and returns the remainder. The sign of the remainder, if nonzero, is the same as that of the first parameter. If the result cannot be expressed as a whole number, the operation is in error and fails.
Syntax
Parameters
Table 14. DTW_DIVREM Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| float | number1 | IN | A variable or literal string representing a number. |
| float | number2 | IN | A variable or literal string representing a number. |
| integer | precision | IN | A variable or literal string representing a positive whole number that specifies the precision of the result. The default is 9. |
| float | result | OUT | A variable that contains the remainder of number1 divided by number2. |
Examples
Example 1:
@DTW_DIVREM(NUMB1, NUMB2, result)
Example 2:
@DTW_rDIVREM("10", NUMB2)
Example 3:
@DTW_rDIVREM("3.6", "1.3")
Example 4:
@DTW_rDIVREM("-10", "3")
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Customizes the formatting for a number. If only the number parameter is specified, the result is formatted just as if @DTW_rADD(number,"0") was performed. If any other options are specified then the number is formatted according to the following rules:
Syntax
Parameters
Table 15. DTW_FORMAT Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| float | number | IN | A variable or literal string representing a number. |
| integer | before | IN | A variable or literal string representing a positive whole number. This is an optional parameter. You must enter a null string ("") to have additional parameters. |
| integer | after | IN | A variable or literal string representing a positive whole number. This is an optional parameter. You must enter a null string ("") to have additional parameters. |
| integer | expp | IN | A variable or literal string representing a positive whole number. You must enter a null string ("") to have additional parameters. |
| integer | expt | IN | A variable or literal string representing a positive whole number. You must enter a null string ("") to have additional parameters. |
| integer | precision | IN | A variable or literal string representing a positive whole number that specifies the precision of the result. The default is 9. |
| float | result | OUT | A variable that contains the number with the specified rounding and formatting. |
Examples
Example 1:
@DTW_FORMAT(NUMB, BEFORE, result)
Example 2:
@DTW_FORMAT("1.73", "4", "0", result)
Example 3:
@DTW_FORMAT("1.73", "4", "3", result)
Example 4:
@DTW_FORMAT(" - 12.73", "", "4", result)
Example 5:
@DTW_FORMAT("12345.73", "", "", "2", "2", result)
Example 6:
@DTW_FORMAT("1.234573", "", "3", "", "0", result)
Example 7:
@DTW_rFORMAT(" - 12.73")
Example 8:
@DTW_rFORMAT("0.000")
Example 9:
@DTW_rFORMAT("12345.73", "", "", "3", "6")
Example 10:
@DTW_rFORMAT("1234567e5", "", "3", "0")
Example 11:
@DTW_rFORMAT("12345.73", "", "3", "", "0")
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Divides the first parameter by the second parameter and returns the integer part of the result.
Syntax
Parameters
Table 16. DTW_INTDIV Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| float | number1 | IN | A variable or literal string representing a number. |
| float | number2 | IN | A variable or literal string representing a number. |
| integer | precision | IN | A variable or literal string representing a positive whole number that specifies the precision of the result. The default is 9. |
| float | result | OUT | A variable that contains integer part of number1 divided by number2. |
Examples
Example 1:
@DTW_INTDIV(NUMB1, NUMB2, result)
Example 2:
@DTW_rINTDIV("2", NUMB2)
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Multiplies two parameters.
Syntax
Parameters
Table 17. DTW_MULTIPLY Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| float | number1 | IN | A variable or literal string representing a number. |
| float | number2 | IN | A variable or literal string representing a number. |
| integer | precision | IN | A variable or literal string representing a positive whole number that specifies the precision of the result. The default is 9. |
| float | result | OUT | A variable that contains the product of number1 and number2. |
Examples
Example 1:
@DTW_MULTIPLY(NUM1, NUMB2, result)
Example 2:
@DTW_rMULTIPLY("0.9", NUMB2)
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Raises the first parameter to the power of the second parameter.
Syntax
Parameters
Table 18. DTW_POWER Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| float | number1 | IN | A variable or literal string representing a number. |
| float | number2 | IN | A variable or literal string representing a number. |
| integer | precision | IN | A variable or literal string representing a positive whole number that specifies the precision of the result. The default is 9. |
| float | result | OUT | A variable that contains the result of number1 raised to the power of number2. |
Examples
Example 1:
@DTW_POWER(NUMB1, NUMB2, result)
Example 2:
@DTW_rPOWER("1.7", NUMB2, precision)
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Subtracts the value of the second parameter from the value of the first parameter.
Syntax
Parameters
Table 19. DTW_SUBTRACT Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| float | number1 | IN | A variable or literal string representing a number. |
| float | number2 | IN | A variable or literal string representing a number. |
| integer | precision | IN | A variable or literal string representing a positive whole number that specifies the precision of the result. The default is 9. |
| float | result | OUT | A variable that contains the difference of number1 and number2. |
Examples
Example 1: This example shows a way to compare numeric values, which are strings in Net.Data.
@DTW_SUBTRACT(NUM1, NUMB2, comp) %IF(comp > "0") <P>$(NUM1) is larger than $(NUM2). %ENDIF
Example 2:
@DTW_SUBTRACT(NUMB1, NUMB2, result)
Example 3:
@DTW_rSUBTRACT("1.3", NUMB2)