Difference between revisions of "Floor"

From WikiPrizm
Jump to navigationJump to search
(Created page with "== Synopsis == Round a number downwards to the nearest integer. === Definition === <nowiki>float floor(x) { return ((int)x) - (x < 0); }</nowiki> === Inputs === '''x''...")
 
 
Line 16: Line 16:
 
== Credits ==
 
== Credits ==
 
Tari
 
Tari
 +
 +
[[Category: Useful Routines]]

Latest revision as of 21:44, 18 March 2013

Synopsis

Round a number downwards to the nearest integer.

Definition

float floor(x) {
    return ((int)x) - (x < 0);
}


Inputs

x - number to be rounded down.

Outputs

Returns rounded number.

Credits

Tari