Math Folder
You use the elements in the math folder to perform mathematical operations on string-based numeric values.
Summary of Elements in this Folder
The following elements are available in this folder:
Element | Package and Description |
---|---|
pub.math:absoluteValue | WmPublic. Returns the absolute value of the input number. |
pub.math:addFloatList | WmPublic. Adds a list of floating point numbers (represented in a string list) and returns the sum. |
pub.math:addFloats | WmPublic. Adds one floating point number (represented as a String) to another and returns the sum. |
pub.math:addIntList | WmPublic. Adds a list of integers (represented in a String list) and returns the sum. |
pub.math:addInts | WmPublic. Adds one integer (represented as a String) to another and returns the sum. |
pub.math:addObjects | WmPublic. Adds one java.lang.Number object to another and returns the sum. |
pub.math:divideFloats | WmPublic. Divides one floating point number (represented as a String) by another (num1/num2) and returns the quotient. |
pub.math:divideInts | WmPublic. Divides one integer (represented as a String) by another (num1/num2) and returns the quotient. |
pub.math:divideObjects | WmPublic. Divides one java.lang.Number object by another (num1/num2) and returns the quotient. |
pub.math:max | WmPublic. Returns the largest number from a list of numbers. |
pub.math:min | WmPublic. Returns smallest number from a list of numbers. |
pub.math:multiplyFloatList | WmPublic. Multiplies a list of floating point numbers (represented in a String list) and returns the product. |
pub.math:multiplyFloats | WmPublic. Multiples one floating point number (represented as String) by another and returns the product. |
pub.math:multiplyIntList | WmPublic. Multiplies a list of integers (represented in a String list) and returns the product. |
pub.math:multiplyInts | WmPublic. Multiplies one integer (represented as a String) by another and returns the product. |
pub.math:multiplyObjects | WmPublic. Multiplies one java.lang.Number object by another and returns the product. |
pub.math:randomDouble | WmPublic. Returns the next pseudorandom, uniformly distributed double between 0.0 and 1.0. |
pub.math:roundNumber | WmPublic. Returns a rounded number. |
pub.math:subtractFloats | WmPublic. Subtracts one floating point number (represented as a String) from another and returns the difference. |
pub.math:subtractInts | WmPublic. Subtracts one integer (represented as a String) from another and returns the difference. |
pub.math:subtractObjects | WmPublic. Subtracts one java.lang.Number object from another and returns the difference. |
pub.math:toNumber | WmPublic. Converts a string to numeric data type. |
pub.math:absoluteValue
WmPublic. Returns the absolute value of the input number.
Input Parameters
num | String Number whose absolute value is to be returned. |
Output Parameters
positiveNumber | String Absolute value of the input number. |
pub.math:addFloatList
WmPublic. Adds a list of floating point numbers (represented in a string list) and returns the sum.
Input Parameters
numList | String List Numbers (floating point numbers represented in a string list) to add. |
Output Parameters
value | String Sum of the numbers in numList. If a sum cannot be produced, value contains one of the following: | |
Value | Description | |
Infinity
|
The computation produces a positive value that overflows the representable range of a float type. | |
-Infinity
|
The computation produces a negative value that overflows the representable range of a float type. | |
0.0
|
The computation produces a value that underflows the representable range of a float type (for example, adding a number to infinity). | |
NaN
|
The computation produces a value that cannot be represented as a number (for example, any operation that uses NaN as input, such as 10.0 + NaN = NaN). |
Usage Notes
Make sure the strings that are passed to the
service in
numList
are in a locale-neutral format (that is, using the pattern -####.##
). Passing locally formatted
strings may result in unexpected results. For example, calling
pub.math:addFloats in a
German locale with the arguments
1,23
and
2,34
will result
in the value
357
, not
3.57
or
3,57
.
pub.math:addFloats
WmPublic. Adds one floating point number (represented as a String) to another and returns the sum.
Input Parameters
num1 | String Number to add. |
num2 | String Number to add. |
precision |
String Optional. Number of decimal places to which the
sum will be rounded. The default value is null.
The precision parameter, if specified, will override the behavior set by the watt.server.math.floatOperation.mode property. For information about the watt.server.math.floatOperation.mode property, see the webMethods Integration Server Administrator’s Guide. |
Output Parameters
value | String Sum of the numbers in num1 and num2. If a sum cannot be produced, value contains one of the following: | |
Value | Description | |
Infinity
|
The computation produces a positive value that overflows the representable range of a float type. | |
-Infinity
|
The computation produces a negative value that overflows the representable range of a float type. | |
0.0
|
The computation produces a value that underflows the representable range of a float type (for example, adding a number to infinity). | |
NaN
|
The computation produces a value that cannot be represented as a number (for example, any operation that uses NaN as input, such as 10.0 + NaN = NaN). |
Usage Notes
Make sure the strings that are passed to the
service in
num1andnum2 are in a locale-neutral
format (that is, using the pattern -####.##
). Passing locally formatted
strings may result in unexpected results. For example, calling
pub.math:addFloats in a
German locale with the arguments
1,23
and
2,34
will result
in the value
357
, not
3.57
or
3,57
.
Use the watt.server.math.floatOperation.mode property to specify whether the pub.math:addFloats service return the exact result of an operation involving two floating point numbers, the result as calculated by the JVM, or the result based on a fixed number of decimal places. For information about the watt.server.math.floatOperation.mode property, see the webMethods Integration Server Administrator’s Guide.
pub.math:addIntList
WmPublic. Adds a list of integers (represented in a String list) and returns the sum.
Input Parameters
numList | String List Numbers (integers represented as Strings) to add. |
Output Parameters
value | String Sum of the numbers in numList. |
Usage Notes
Make sure the strings that are passed to the
service in
numList
are in a locale-neutral format (that is, using the pattern -####.##
). Passing locally formatted
strings may result in unexpected results. For example, calling
pub.math:addFloats in a
German locale with the arguments
1,23
and
2,34
will result
in the value
357
, not
3.57
or
3,57
.
pub.math:addInts
WmPublic. Adds one integer (represented as a String) to another and returns the sum.
Input Parameters
num1 | String Number (integer represented as a String) to add. |
num2 | String Number (integer represented as a String) to add. |
Output Parameters
value | String Sum of num1 and num2. |
Usage Notes
Make sure the result of your calculation is less than 64 bits in width (the maximum width for the long data type). If the result exceeds this limit, it will generate a data overflow.
Make sure the strings that are passed to the
service in
num1andnum2 are in a locale-neutral
format (that is, using the pattern -####.##
). Passing locally formatted
strings may result in unexpected results. For example, calling
pub.math:addFloats in a
German locale with the arguments
1,23
and
2,34
will result
in the value
357
, not
3.57
or
3,57
.
pub.math:addObjects
WmPublic. Adds one java.lang.Number object to another and returns the sum.
Input Parameters
num1 | java.lang.Number Number to add. See the Usage Notes for supported sub-classes. |
num2 | java.lang.Number Number to add. See the Usage Notes for supported sub-classes. |
Output Parameters
value | java.lang.Number Sum of the numeric values of num1 and num2. |
Usage Notes
This service accepts the following sub-classes of java.lang.Number: java.lang.Byte, java.lang.Double, java.lang.Float, java.lang.Integer, java.lang.Long, java.lang.Short.
This service applies the following rules for binary numeric promotion to the operands in order:
- If either operand is of type Double, the other is converted to Double.
- Otherwise, if either operand is of type Float, the other is converted to Float.
- Otherwise, if either operand is of type Long, the other is converted to Long.
- Otherwise, both operands are converted to type Integer.
These promotion rules mirror the Java rules for numeric promotion of numeric types.
pub.math:divideFloats
WmPublic. Divides one floating point number (represented as a String) by another (num1/num2) and returns the quotient.
Input Parameters
num1 | String Number (floating point number represented as a String) that is the dividend. |
num2 | String Number (floating point number represented as a String) that is the divisor. |
precision |
String Optional. Number of decimal places to which the
quotient will be rounded. The default value is null.
The precision parameter, if specified, will override the behavior set by the watt.server.math.floatOperation.mode property. For information about the watt.server.math.floatOperation.mode property, see the webMethods Integration Server Administrator’s Guide. |
Output Parameters
value | String The quotient of num1 / num2. If a quotient cannot be produced, value contains one of the following: | |
Value | Description | |
Infinity
|
The computation produces a positive value that overflows the representable range of a float type. | |
-Infinity
|
The computation produces a negative value that overflows the representable range of a float type. | |
0.0
|
The computation produces a value that underflows the representable range of a float type (for example, dividing a number by infinity). | |
NaN
|
The computation produces a value that cannot be represented as a number (for example, the result of an illegal operation such as dividing zero by zero or any operation that uses NaN as input, such as 10.0 + NaN = NaN). |
Usage Notes
Make sure the strings that are passed to the
service in
num1andnum2 are in a locale-neutral
format (that is, using the pattern -####.##
). Passing locally formatted
strings may result in unexpected results. For example, calling
pub.math:addFloats in a
German locale with the arguments
1,23
and
2,34
will result
in the value
357
, not
3.57
or
3,57
.
Use the watt.server.math.floatOperation.mode property to specify whether the pub.math:divideFloats service return the exact result of an operation involving two floating point numbers, the result as calculated by the JVM, or the result based on a fixed number of decimal places. For information about the watt.server.math.floatOperation.mode property, see the webMethods Integration Server Administrator’s Guide.
pub.math:divideInts
WmPublic. Divides one integer (represented as a String) by another (num1/num2) and returns the quotient.
Input Parameters
num1 | String Number (integer represented as a String) that is the dividend. |
num2 | String Number (integer represented as a String) that is the divisor. |
Output Parameters
value | String The quotient of num1 / num2. |
Usage Notes
Make sure the strings that are passed to the
service in
num1andnum2 are in a locale-neutral
format (that is, using the pattern -####.##
). Passing locally formatted
strings may result in unexpected results. For example, calling
pub.math:addFloats in a
German locale with the arguments
1,23
and
2,34
will result
in the value
357
, not
3.57
or
3,57
.
pub.math:divideObjects
WmPublic. Divides one java.lang.Number object by another (num1/num2) and returns the quotient.
Input Parameters
num1 | java.lang.Number Number that is the dividend. See the Usage Notes for supported sub-classes. |
num2 | java.lang.Number Number that is the divisor. See the Usage Notes for supported sub-classes. |
Output Parameters
value | java.lang.Number Quotient of num1 / num2. |
Usage Notes
This service accepts the following sub-classes of java.lang.Number: java.lang.Byte, java.lang.Double, java.lang.Float, java.lang.Integer, java.lang.Long, java.lang.Short.
This service applies the following rules for binary numeric promotion to the operands in order:
- If either operand is of type Double, the other is converted to Double.
- Otherwise, if either operand is of type Float, the other is converted to Float.
- Otherwise, if either operand is of type Long, the other is converted to Long.
- Otherwise, both operands are converted to type Integer.
These promotion rules mirror the Java rules for numeric promotion of numeric types.
pub.math:max
WmPublic. Returns the largest number from a list of numbers.
Input Parameters
numList | String List List of numbers from which the largest number is to be returned. |
Output Parameters
maxValue | String Largest number from the list of numbers. |
pub.math:min
WmPublic. Returns smallest number from a list of numbers.
Input Parameters
numList | String List List of numbers from which the smallest number is to be returned. |
Output Parameters
minValue | String Smallest number from the list of numbers. |
pub.math:multiplyFloatList
WmPublic. Multiplies a list of floating point numbers (represented in a String list) and returns the product.
Input Parameters
numList | String List Numbers (floating point numbers represented as Strings) to multiply. |
Output Parameters
value | String Product of the numbers in numlist. If a product cannot be produced, value contains one of the following: | |
Value | Description | |
Infinity
|
The computation produces a positive value that overflows the representable range of a float type. | |
-Infinity
|
The computation produces a negative value that overflows the representable range of a float type. | |
0.0
|
The computation produces a value that underflows the representable range of a float type (for example, multiplying a number by infinity). | |
NaN
|
The computation produces a value that cannot be represented as a number (for example, the result of an illegal operation such as multiplying zero by zero or any operation that uses NaN as input, such as 10.0 + NaN = NaN). |
Usage Notes
Make sure the strings that are passed to the
service in
numList
are in a locale-neutral format (that is, using the pattern -####.##
). Passing locally formatted
strings may result in unexpected results. For example, calling
pub.math:addFloats in a
German locale with the arguments
1,23
and
2,34
will result
in the value
357
, not
3.57
or
3,57
.
pub.math:multiplyFloats
WmPublic. Multiples one floating point number (represented as String) by another and returns the product.
Input Parameters
num1 | String Number (floating point number represented as a String) to multiply. |
num2 | String Number (floating point number represented as a String) to multiply. |
precision |
String Optional. Number of decimal places to which the
product will be rounded. The default value is null.
The precision parameter, if specified, will override the behavior set by the watt.server.math.floatOperation.mode property. For information about the watt.server.math.floatOperation.mode property, see the webMethods Integration Server Administrator’s Guide. |
Output Parameters
value | String Product of the numeric values of num1 and num2. If a product cannot be produced, value contains one of the following: | |
Value | Description | |
Infinity
|
The computation produces a positive value that overflows the representable range of a float type. | |
-Infinity
|
The computation produces a negative value that overflows the representable range of a float type. | |
0.0
|
The computation produces a value that underflows the representable range of a float type (for example, multiplying a number by infinity). | |
NaN
|
The computation produces a value that cannot be represented as a number (for example, the result of an illegal operation such as multiplying zero by zero or any operation that uses NaN as input, such as 10.0 + NaN = NaN). |
Usage Notes
Make sure the strings that are passed to the
service in
num1andnum2 are in a locale-neutral
format (that is, using the pattern -####.##
). Passing locally formatted
strings may result in unexpected results. For example, calling
pub.math:addFloats in a
German locale with the arguments
1,23
and
2,34
will result
in the value
357
, not
3.57
or
3,57
.
Use the watt.server.math.floatOperation.mode property to specify whether the pub.math:multiplyFloats service return the exact result of an operation involving two floating point numbers, the result as calculated by the JVM, or the result based on a fixed number of decimal places. See webMethods Integration Server Administrator’s Guide for more information about the watt.server.math.floatOperation.mode property.
pub.math:multiplyIntList
WmPublic. Multiplies a list of integers (represented in a String list) and returns the product.
Input Parameters
numList | String List Numbers (floating point numbers represented as Strings) to multiply. |
Output Parameters
value | String Product of the numbers in numList. |
Usage Notes
Make sure the result of your calculation is less than 64 bits in width (the maximum width for the long data type). If the result exceeds this limit, it will generate a data overflow.
Make sure the strings that are passed to the
service in
numList
are in a locale-neutral format (that is, using the pattern -####.##
). Passing locally formatted
strings may result in unexpected results. For example, calling
pub.math:addFloats in a
German locale with the arguments
1,23
and
2,34
will result
in the value
357
, not
3.57
or
3,57
.
pub.math:multiplyInts
WmPublic. Multiplies one integer (represented as a String) by another and returns the product.
Input Parameters
num1 | String Number (integer represented as a String) to multiply. |
num2 | String Number (integer represented as a String) to multiply. |
Output Parameters
value | String Product of num1 and num2. |
Usage Notes
Make sure the result of your calculation is less than 64 bits in width (the maximum width for the long data type). If the result exceeds this limit, it will generate a data overflow.
Make sure the strings that are passed to the
service in
num1andnum2 are in a locale-neutral
format (that is, using the pattern -####.##
). Passing locally formatted
strings may result in unexpected results. For example, calling
pub.math:addFloats in a
German locale with the arguments
1,23
and
2,34
will result
in the value
357
, not
3.57
or
3,57
.
pub.math:multiplyObjects
WmPublic. Multiplies one java.lang.Number object by another and returns the product.
Input Parameters
num1 | java.lang.Number Number to multiply. See the Usage Notes for supported sub-classes. |
num2 | java.lang.Number Number to multiply. See the Usage Notes for supported sub-classes. |
Output Parameters
value | java.lang.Number Product of num1 and num2. |
Usage Notes
This service accepts the following sub-classes of java.lang.Number: java.lang.Byte, java.lang.Double, java.lang.Float, java.lang.Integer, java.lang.Long, java.lang.Short.
This service applies the following rules for binary numeric promotion to the operands in order:
- If either operand is of type Double, the other is converted to Double.
- Otherwise, if either operand is of type Float, the other is converted to Float.
- Otherwise, if either operand is of type Long, the other is converted to Long.
- Otherwise, both operands are converted to type Integer.
These promotion rules mirror the Java rules for numeric promotion of numeric types.
pub.math:randomDouble
WmPublic. Returns the next pseudorandom, uniformly distributed double between 0.0 and 1.0.
Random number generators are often referred to as pseudorandom number generators because the numbers produced tend to repeat themselves over time.
Input Parameters
None.
Output Parameters
number | String Generated random number. |
pub.math:roundNumber
WmPublic. Returns a rounded number.
Input Parameters
num | String Number to be rounded. |
numberOfDigits | String Specifies the number of digits to which you want to round the number. |
roundingMode |
String Optional. Specifies the rounding method.
Valid values for the
roundingMode parameter are
|
Output Parameters
roundedNumber | String The rounded number. |
pub.math:subtractFloats
WmPublic. Subtracts one floating point number (represented as a String) from another and returns the difference.
Input Parameters
num1 | String Number (floating point number represented as a String). |
num2 | String Number (floating point number represented as a String) to subtract from num1. |
precision |
String Optional. Number of decimal places to which the
difference will be rounded. The default value is null.
The precision parameter, if specified, will override the behavior set by the watt.server.math.floatOperation.mode property. For information about the watt.server.math.floatOperation.mode property, see the webMethods Integration Server Administrator’s Guide. |
Output Parameters
value | String Difference of num1 - num2. If a difference cannot be produced, value contains one of the following: | |
Value | Description | |
Infinity
|
The computation produces a positive value that overflows the representable range of a float type. | |
-Infinity
|
The computation produces a negative value that overflows the representable range of a float type. | |
0.0
|
The computation produces a value that underflows the representable range of a float type (for example, subtracting a number from infinity). | |
NaN
|
The computation produces a value that cannot be represented as a number (for example, the result of an illegal operation such as multiplying zero by zero or any operation that uses NaN as input, such as 10.0 - NaN = NaN). |
Usage Notes
Make sure the strings that are passed to the
service in
num1andnum2 are in a locale-neutral
format (that is, using the pattern -####.##
). Passing locally formatted
strings may result in unexpected results. For example, calling
pub.math:addFloats in a
German locale with the arguments
1,23
and
2,34
will result
in the value
357
, not
3.57
or
3,57
.
Use the watt.server.math.floatOperation.mode property to specify whether the pub.math:subtractFloats service return the exact result of an operation involving two floating point numbers, the result as calculated by the JVM, or the result based on a fixed number of decimal places. For more information about the watt.server.math.floatOperation.mode property, see webMethods Integration Server Administrator’s Guide
pub.math:subtractInts
WmPublic. Subtracts one integer (represented as a String) from another and returns the difference.
Input Parameters
num1 | String Number (integer represented as a String). |
num2 | String Number (integer represented as a String) to subtract from num1. |
Output Parameters
value | String Difference of num1 - num2. |
Usage Notes
Make sure the result of your calculation is less than 64 bits in width (the maximum width for the long data type). If the result exceeds this limit, it will generate a data overflow.
Make sure the strings that are passed to the
service in
num1
andnum2 are in a
locale-neutral format (that is, using the pattern -####.##
). Passing locally formatted
strings may result in unexpected results. For example, calling
pub.math:addFloats in a
German locale with the arguments
1,23
and
2,34
will result
in the value
357
, not
3.57
or
3,57
.
pub.math:subtractObjects
WmPublic. Subtracts one java.lang.Number object from another and returns the difference.
Input Parameters
num1 | java.lang.Number Number. See the Usage Notes for supported sub-classes. |
num2 | java.lang.Number Number to subtract from num1. See Usage Notes for supported sub-classes. |
Output Parameters
value | java.lang.Number Difference of num1 - num2. |
Usage Notes
This service accepts the following sub-classes of java.lang.Number: java.lang.Byte, java.lang.Double, java.lang.Float, java.lang.Integer, java.lang.Long, java.lang.Short.
This service applies the following rules for binary numeric promotion to the operands. The following rules are applied in order:
- If either operand is of type Double, the other is converted to Double.
- Otherwise, if either operand is of type Float, the other is converted to Float.
- Otherwise, if either operand is of type Long, the other is converted to Long.
- Otherwise, both operands are converted to type Integer.
These promotion rules mirror the Java rules for numeric promotion of numeric types.
pub.math:toNumber
WmPublic. Converts a string to numeric data type.
Input Parameters
num | String Number (represented as a string) to be converted to numeric format. |
convertAs |
String Optional. Specifies the Java numeric data type
to which the
num parameter is to be
converted.
Valid values for the
convertAs parameter are
|
Output Parameters
num | java.lang.Number Converted numeric object. |