Miscellaneous Floating-point Operations

Miscellaneous Floating-point Operations#

abs(x)#

Absolute value function.

Parameters:

x (Real) – The value of which the absolute value is taken.

Definition:

\(\mathrm{abs}(x) = \lvert x \rvert\)

Domain:

\((-\infty, \infty)\)

Range:

\([0, \infty)\)

Returns:

The absolute value of \(x\).

Return type:

Real

ceil(x)#

Ceiling function.

Parameters:

x (Real) – The value of which the ceiling is taken.

Definition:

\(\mathrm{ceil}(x) = \lceil x \rceil\)

Domain:

\((-\infty, \infty)\)

Range:

Integers

Returns:

The smallest integer not less than \(x\).

Return type:

Real

floor(x)#

Floor function.

Parameters:

x (Real) – The value of which the floor is taken.

Definition:

\(\mathrm{floor}(x) = \lfloor x \rfloor\)

Domain:

\((-\infty, \infty)\)

Range:

Integers

Returns:

The largest integer not greater than \(x\).

Return type:

Real

trunc(x)#

Truncation function.

Parameters:

x (Real) – The value to truncate.

Definition:

\(\mathrm{trunc}(x) = \mathrm{sign}(x) \lfloor |x| \rfloor\)

Domain:

\((-\infty, \infty)\)

Range:

Integers

Returns:

The integer part of \(x\), discarding the fractional part.

Return type:

Real

round(x)#

Rounding function.

Parameters:

x (Real) – The value to round.

Definition:

\(\mathrm{round}(x)\) is the nearest integer to \(x\), rounding halfway cases away from zero.

Domain:

\((-\infty, \infty)\)

Range:

Integers

Returns:

The value of \(x\) rounded to the nearest integer.

Return type:

Real