math.floor
From GMod Wiki
Revision as of 16:59, 9 December 2009 by Olivernoerd (Talk | contribs)
| Function | |
| Syntax |
math.floor( Float value ) Where is this used? |
| Description: | |
| Returns value rounded down to the nearest whole number. | |
| Returns: | Integer |
| Part of Library: | Math |
| Realm: |
|
| BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Math.floor]Math.floor [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
| Description | Floors down the value. |
|---|---|
| Used on | |
| Code | print(math.floor(0.5)) |
| Output | 0 |
Another Example
| Description | Checks a number for a decimal part. |
|---|---|
| Used on | |
| Code | function hasFloatingPoint(value) return value > math.floor(value) end |
| Output | True if the number has a decimal part; false otherwise. |