Round()

From TinyMUX
Revision as of 05:53, 17 January 2006 by Ian (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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))