# Math Functions

**Note: **Not all functions may be supported, depending on transformer.

The Arithmetic Editor supports the following mathematical functions in expressions. All functions below treat arguments as double precision, and return double precision values, unless they are value type conversion functions, such as @int(), @double(), and @real32().

For all functions that take in a variable number of arguments, arguments that have null, missing, or empty string values are skipped. However, if the variable argument list contains nothing but null, missing, and empty string values, the function returns null.

Functions that receive non-numeric, null, missing, or empty string arguments should return null, with the fme_expression_warnings list attribute appended to. For all functions with fixed arguments that return double precision values, expect a result of NaN if NaN is supplied as an argument. In many cases, expect a result of infinity if infinity is supplied as an argument. So, below we provide descriptions for cases where function arguments are numeric, non-null, non-infinity, and non-NaN.

Function | Description |
---|---|

abs(arg) | Returns the absolute value of arg. |

acos(arg) | Returns the arc cosine of arg, in the range [0,pi] radians. Arg should be in the range [-1,1]. |

add(arg1,[arg2]...) | Returns the sum of the arguments. |

asin(arg) | Returns the arc sine of arg, in the range [-pi/2,pi/2] radians. Arg should be in the range [-1,1]. |

atan(arg) | Returns the arc tangent of arg, in the range [-pi/2,pi/2] radians. |

atan2(y,x) | Returns the arc tangent of y/x, in the range [-pi,pi] radians. x and y cannot both be 0. |

average(arg1,[arg2]...) | Accepts a list of numbers and finds the average. Empty, missing, and null input values are ignored but other non-numeric data results in a failure. If no inputs are provided, an empty string is returned. |

ceil(arg,[decimal_places]) | Returns the smallest value not less than arg, to the specified decimal_places. If decimal_places is 0 or unspecified, a 64-bit integer is returned. If decimal_places is >0, a 64-bit floating point value is returned. If arg is out of range, null is returned. |

col() | Returns the column of the raster cell being evaluated. |

cos(arg) | Returns the cosine of arg, measured in radians. |

cosh(arg) | Returns the hyperbolic cosine of arg. If an overflow occurs, infinity is returned. |

degToRad(arg) | Converts degrees to radians. |

div(x,y) | Computes x/y. If division by zero occurs, infinity is returned. |

double(arg) | Returns arg in double precision. |

exp(arg) | Returns the exponential of arg, defined as e to the power of arg. If an overflow occurs, infinity is returned. |

floor(arg,[decimal_places]) | Returns the largest value not greater than arg, to the specified decimal_places. If decimal_places is 0 or unspecified, a 64-bit integer is returned. If decimal_places is >0, a 64-bit floating point value is returned. If arg is out of range, null is returned. |

fmod(x,y) | Returns the floating point remainder of the division of x by y. The sign of the remainder follows the sign of x. If y is 0, NaN is returned. |

hypot(x,y) | Computes the length of the hypotenuse of a right-angled triangle, that is, sqrt(x*x+y*y). |

if(arg1,arg2,arg3) | Evaluates the validity of a condition expressed in arg1. If true (evaluates to a non-zero value), returns the value expressed in arg2. If false, returns the value expressed in arg3. |

int(arg) | If arg is in the range of a 64 bit integer, convert by truncation. If arg is out of range, null is returned. |

int8(arg) | If arg is in the range of a 8 bit integer, convert by rounding. If arg is out of range, null is returned. |

int16(arg) | If arg is in the range of a 16 bit integer, convert by rounding. If arg is out of range, null is returned. |

int32(arg) | If arg is in the range of a 32 bit integer, convert by rounding. If arg is out of range, null is returned. |

int64(arg) | If arg is in the range of a 64 bit integer, convert by rounding. If arg is out of range, null is returned. |

isnodata(arg) | Returns a value of 1 if arg is equal to the nodata value, and 0 otherwise. |

log(arg) | Returns the natural logarithm of arg. |

log10(arg) | Returns the base 10 logarithm of arg. |

max(arg1,[arg2]...) | Returns the largest argument. |

min(arg1,[arg2]...) | Returns the smallest argument. |

mult(arg1,[arg2]...) | Returns the multiplication of all the arguments. |

pi() | Returns the value of pi. |

pow(x,y) | Computes the value of x to the power y. If x is negative, y is expected to be an integer value. If x is negative, and y is a floating point value, NaN is returned. |

radToDeg(arg) | Converts radians to degrees. |

rand() | Returns a random value between 0 and 1. |

real32(arg) | If arg is in the range of a single precision float, return as a single precision float. If arg is NaN or infinity, or the negation thereof, cast as a single precision NaN or infinity. Otherwise, arg is beyond the range of a single precision float, so we return positive or negative infinity. |

real64(arg) | If arg is in the range of a double precision float, return as a double precision float. If arg is NaN or infinity, or the negation thereof, cast as a double precision NaN or infinity. Otherwise, arg is beyond the range of a double precision float, so we return positive or negative infinity. |

round(arg,[decimal_places]) | Returns the value nearest arg, to the specified decimal_places. If decimal_places is 0 or unspecified, a 64-bit integer is returned. If decimal_places is >0, a 64-bit floating point value is returned. If arg is out of range, null is returned. |

row() | Returns the row of the raster cell being evaluated. |

sin(arg) | Returns the sine of arg, measured in radians. |

sinh(arg) | Returns the hyperbolic sine of arg. If an overflow occurs, infinity is returned. |

sqrt(arg) | Returns the square root of arg. If arg is negative, NaN is returned. |

sub(x,y) | Computes x-y. |

sum(arg1,[arg2]...) | Returns the sum of the arguments. |

tan(arg) | Returns the tangent of arg, measured in radians. |

tanh(arg) | Returns the hyperbolic tangent of arg. |

uint8(arg) | If arg is in the range of a 8 bit unsigned integer, convert by rounding. If arg is out of range, null is returned. |

uint16(arg) | If arg is in the range of a 16 bit unsigned integer, convert by rounding. If arg is out of range, null is returned. |

uint32(arg) | If arg is in the range of a 32 bit unsigned integer, convert by rounding. If arg is out of range, null is returned. |

uint64(arg) | If arg is in the range of a 64 bit unsigned integer, convert by rounding. If arg is out of range, null is returned. |