Round()

From TinyMUX
Jump to: navigation, search

Description

FUNCTION: 20px-Function.png 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))