# Number functions

Use the number functions to extract the mantissa from a decimal or floating point number. The Number category in the expression editor also contains the type casting functions, which you can use to cast numbers as double, float, or integer data types.

Square brackets indicate an argument is optional. The examples show the function as it appears in a Derivation field in the Transformer stage.

The type casting functions help you when you perform mathematical calculations using numeric fields. For example, if you have a calculation using an output column of type float derived from an input column of type integer in a Parallel Transformer stage the result is derived as an integer regardless of its float type. If you want a non-integral result for a calculation using integral operands, you can use the type casting functions to cast the integer operands into non-integral operands.

AsDouble
Treat the given number as a double.
• Input: number
• Output: number (double)
• Examples. In the following expression, the input column mynumber contains an integer, but the function outputs a double. If mylink.mynumber contains the value 56, then the following two functions are equivalent, and return the value 1.29629629629629619E+01:
``````AsDouble(56/4.32)
``````
AsFloat
Treat the given number as a float.
• Input: number
• Output: number (float)
• Examples. In the following expression, the input column mynumber contains an integer, but the function outputs a float. If mylink.mynumber contains the value 56, then the following two functions are equivalent, and return the value 1.29629629629629619E+01:
``````AsFloat(56/4.32)
``````
AsInteger
Treat the given number as an integer. But there a difference in behavior when a decimal is assigned to an integer versus a float or a double being assigned to an integer. If the conversion is from float or a double to an integer, it is a simple assignment to an integer. In case of decimal AsInteger(), function is invoked and rounds the output towards nearest value.
• Input: number
• Output: number (integer)
• Examples. In the following expression, the input value 12.962963 has a type Double. Though the value is treated as type Double, the function outputs an integer. Hence it is a simple assignment to an integer and function returns the value 12:
``````AsInteger(12.962963)
``````
In the following expression, the calculations like (56/4.32) is treated as a type Decimal and AsInteger() function call invoked will round towards the nearest value and returns the value 13:
``````AsInteger(56/4.32)
``````
IsStrNum

Checks whether a string is a valid number. This function is present for compatibility but use is not encouraged.

• Input: string (string)
• Output: result (int32)
• Examples. If the column mylink.mystring contains the string "1", then the following function returns the value 1:
``isStrNum(mylink.mystring)``
IsVarNum

Checks whether variant is a valid number. This function is present for compatibility but use is not encouraged.

• Input: variant (string)
• Output: result (int32)
MantissaFromDecimal
Returns the mantissa from the given decimal.
• Input: number (decimal)
• Output: result (dfloat)
• Examples. If mylink.number contains the number 243.7675, then the following two functions are equivalent, and return the value 7675:
``````MantissaFromDecimal(243.7675)
``````
MantissaFromDFloat
Returns the mantissa from the given dfloat.
• Input: number (dfloat)
• Output: result (dfloat)
• Examples. If mylink.number contains the number 1.234412000000000010E +4, then the following function returns the value 1:
``````MantissaFromDFloat(mylink.mynumber)
``````
VarCmp

Compares two variants. This function is present for compatibility but use is not encouraged.

• Input: variant (string), variant (string), number (int32)
• Output: result (int32)