math.fmod
From GMod Wiki
Function | |
Syntax |
math.fmod( Float num, Float divBy ) Where is this used? |
Description: | |
Returns the remainder of the division operation. | |
Returns: | Float |
Part of Library: | Math |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Math.fmod]Math.fmod [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
Description | Finds the remainder. |
---|---|
Used on | |
Code | --42/5=8.4 --8*5=40 --42-40=2 myNumber=math.fmod(42,5) |
Output | myNumber is set to 2. |
Additional Notes
- You should use the '%' operator on positive numbers instead, as it is much faster.
local example = 1 % 6
Is the same as:
local example = math.fmod( 1, 6 )