GM: frac

From GMpedia.org Wiki

Jump to: navigation, search
The correct title of this article is frac(). It appears incorrectly here because of technical restrictions.
The correct title of this article is frac(). It appears incorrectly here because of technical restrictions.


Arguments

x (real)

Limitations

none

Note: Please remove limitations and port them in the "Remarks" section at the end of the article. The frac() function returns the fractional part of x, that is the part behind the dot. If there is nothing behind the dot it returns 0. It the number is negative, the result of this function is also negative.

[edit] Example

num = -45.23;
show_message(string(frac(num))); //shows -0.23

num = 98.62;
show_message(string(frac(num))); //shows 0.62.

num = 46;
show_message(string(frac(+num))); //shows 0


This article was originally found at the Game Maker Knowledge Base, contributed by tsg1zzn.
See the talk page for details
Personal tools