# Numeric Functions

## Integer Functions

The following standard functions (defined in the `ArithmeticPackage` but excluded if using a raw `Engine`) operate on `i8`, `i16`, `i32`, `i64`, `f32`, `f64` and `Decimal` (requires `decimal`) only:

FunctionDescription
`abs`absolute value
`sign`returns (`INT`) −1 if negative, +1 if positive, 0 if zero

The following standard functions (defined in the `BasicMathPackage` but excluded if using a raw `Engine`) operate on integers only:

FunctionNot available underDescription
`to_float``no_float`convert the value into `f64` (`f32` under `f32_float`)
`to_decimal`non-`decimal`convert the value into `Decimal`

## Floating-Point Functions

The following standard functions (defined in the `BasicMathPackage` but excluded if using a raw `Engine`) operate on `f64` only (`f32` under `f32_float`):

CategorySupports DecimalFunctions
Trigonometryno`sin`, `cos`, `tan`, `sinh`, `cosh`, `tanh` in radians, `hypot(`x`,`y`)`
Arc-trigonometryno`asin`, `acos`, `atan(`v`)`, `atan(`x`,`y`)`, `asinh`, `acosh`, `atanh` in radians
Square rootyes`sqrt`
Exponentialyes`exp` (base e)
Logarithmicyes`ln` (base e)
Logarithmicno`log(`x`)` in base 10, `log(`x`,`base`)`
Roundingyes`floor`, `ceiling`, `round`, `int`, `fraction` methods and properties
Conversionyes`to_int`, `to_decimal` (requires `decimal`)
Conversionno`to_degrees`, `to_radians`
Testingno`is_nan`, `is_finite`, `is_infinite` methods and properties

## Decimal Rounding

The following rounding methods (defined in the `BasicMathPackage` but excluded if using a raw `Engine`) operate on `Decimal` only, which requires the `decimal` feature:

Rounding typeBehaviorMethods
None`floor`, `ceiling`, `int`, `fraction` methods and properties
Banker’s roundinground to integer`round` method and property
Banker’s roundinground to specified number of decimal points`round(`decimal points`)`
Round upaway from zero`round_up(`decimal points`)`
Round downtowards zero`round_down(`decimal points`)`
Round half-upmid-point away from zero`round_half_up(`decimal points`)`
Round half-downmid-point towards zero`round_half_down(`decimal points`)`

## Parsing Functions

The following standard functions (defined in the `BasicMathPackage` but excluded if using a raw `Engine`) parse numbers:

FunctionNo available underDescription
`parse_int`converts a string to `INT` with an optional radix
`parse_float``no_float`converts a string to `FLOAT`
`parse_decimal`non-`decimal`converts a string to `Decimal`

## Constants

The following functions return standard mathematical constants:

FunctionDescription
`PI`returns the value of π
`E`returns the value of e