Mathematical Functions

Mathematical functions return values that are commonly needed for operations on mathematical data.

Each function also accepts arguments that can be implicitly converted to the specified type. For example, functions that accept approximate numeric types also accept integer types. SAP ASE converts the argument to the desired type.

SAP ASE provides error traps to handle domain or range errors. Use the arithabort and arithignore functions to specify how domain errors are handled.

This table displays examples using the floor, ceiling, and round mathematical functions.

Statement

Result

  • select floor(123)

  • select floor(123.45)

  • select floor(1.2345E2)

  • select floor(-123.45)

  • select floor(-1.2345E2)

  • select floor($123.45)

123 123.000000 123.000000 -124.000000 -124.000000 123.00

  • select ceiling(123.45)

  • select ceiling(-123.45)

  • select ceiling(1.2345E2)

  • select ceiling(-1.2345E2)

  • select ceiling($123.45)

124.000000 -123.000000 124.000000 -123.000000 124.00

  • select round(123.4545, 2)

  • select round(123.45, -2)

  • select round(1.2345E2, 2)

  • select round(1.2345E2, -2)

123.4500 100.00 123.450000 100.000000

Related concepts
Conversion Error Handling