std-floor, std-ceiling


Synopsis

(std-floor <num>)

(std-ceiling <num>)

Description

std-floor returns the lower integer, truncated towards positive infinity.

std-ceiling the upper integer of a integer or real number, truncated towards negative infinity.

On positive numbers STD-FLOOR returns the same as FIX, but on negative numbers FIX returns the same number as STD-CEILING. To be consistent with ANSI CL definitions we introduce these functions. FIX is the same as TRUNCATE which truncates towards zero.

Examples

(std-floor  1.1)  =>  1
(std-floor -1.1)  => -2

(std-ceiling  1.1)  =>  2
(std-ceiling -1.1)  => -1

(fix  1.1)  =>  1
(fix -1.1)  => -1

Arguments

num: Any number, if integer or real.

Return Value

Always a integer number.

Side Effects

None.

Module

(std-require 'STDMATH)

Defined in STDMATH