jan tolenaar / kiezellisp / index-of-everything

Name

math:round

Usage

builtin-function

Syntax

(math:round number)
(math:round number decimals)

Description

The first form returns the nearest integer and the nearest even integer when the nearest integers are exactly half an integer away. The second form rounds the number to the specified number of decimal digits in a similar way as the first form.

make-html > (math:round 6.88)
it: 7
make-html > (math:round 6.88 1)
it: 6.9
make-html > (math:round 14/3)
it: 5
make-html > (math:round -14.3 2)
it: -14.3

See also

math:ceiling math:floor math:mod math:rem math:truncate