Round

From Kolmafia
Revision as of 23:26, 21 January 2015 by imported>Eliteofdelete
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

int round(float number )

  • number is the number to round

Rounds number to the nearest whole number, and returns the result.

Code Samples

Rounds numbers to the place desired.

float rounder (float number, int place) {
   float value = round(number*10.0**-place)*10.0**place;
   print(value);
return value;
}
rounder(35.5555, -2);
rounder(25.5, 0);
rounder(5256, 2);
35.56
26.0
5300.0