$round

From Scriptwiki
Revision as of 14:42, 10 November 2005 by Microbe (talk | contribs) (fixed commenting syntax)

Jump to: navigation, search

Returns the floating number you specify rounded to the specified number of decimals.

$round(N,D)
  • N is the number you want to round.
  • D is the number of decimals you want.

Examples

The following will echo pi with 3 decimals:

 $round($pi,3)  ;will return 3.142
 $round(1.5001,0)  ;will return 2

See also

$int, $floor and $ceil.