Next: , Previous: , Up: Built-in functions   [Contents][Index]

Floating-point functions

Floating-point functions

As stated in Arithmetic expressions, there are certain constructs in which expressions are evaluated in floating-point context instead of integer context. In such constructs, all of coNCePTuaL’s built-in functions accept and return floating-point values. Furthermore, the CBRT, LOG10, ROOT, and SQRT functions (see Integer functions) compute floating-point results, not integer results that are coerced into floating-point format.

The following functions are not meaningful in integer context but are in floating-point context:

CEILING returns the smallest integer not less than its argument. For example, ‘CEILING(-7777/10)’ is ‘-777’. (-778 is less than -777.7 while -777 is not less than -777.7.)

FLOOR returns the largest integer not greater than its argument. For example, ‘FLOOR(-7777/10)’ is ‘-778’. (-778 is not greater than -777.7 while -777 is greater than -777.7.)

ROUND rounds its argument to the nearest integer. For example, ‘ROUND(-7777/10)’ is ‘-778’.

It is not an error to use CEILING, FLOOR, and ROUND in an integer context; each function merely return its argument unmodified.

Scott Pakin,