Round()

From TinyMUX
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Description

FUNCTION: round(number,places)

Rounds number to places positions right of the decimal point. places may be negative in which case the rounding occurs in the ones, tens, hundreds, etc. place.

Related Topics: fdiv(), floor(), mod(), trunc().

Examples

> say round(5.123,1)
You say "5.1"
> say round(9.8765,3)
You say "9.877"
> say round(5.5,0)
You say "6"
> say round(-5.5,0)
You say "-6"
> say round(520,-3)
You say "1000"

(--Soylent 00:59, 3 December 2005 (EST))