No Revisions Have Been Made To This Page
Can you suggest an edit for this page? Click Here
This section goes over the structure of the manual as well as an introduction to the GML Language and it's syntax.
This section introduces the types of numbers and basic variables in GML and their related functions.
The section covers the various assets involved in GameMaker: Studio and their related functions as well as Handling Input.
This section contains information about 2D Drawing, 3D Drawing, Shaders, Surfaces, and Views.
This section goes further into detail about the GML Language and more advanced functions like Networking, Data Structures, Physics, and more.
This section is a reference to the Platform Specific functions and methods available to you as well as integrating your game with Third Party Applications.
This section contains Debugging, Miscellaneous, and Obsolete function reference.
View :
Original

Community
Revision

Source
GML Code Example
math_set_epsilon(epsilon);
Argument  Description 

epsilon  The new epsilon value (from 0 to 0.999999999). 
Returns: Real
Epsilon is a value used to determine whether two numbers subject to rounding error are close enough to be considered "equal". It is useful when dealing with floating point maths as it can reduce the "rounding errors" that make certain operations return values that appear incorrect or contrary to what we expect. For example, we may have added a value to the image index of a sprite and expect the result to be a single integer, but due to the nature of floating point maths, the actual final value ends up being something like 5.0000002, so when we have the following check:
GML Code Example
if image_index == 5 {do something}
The code does not behave as expected and returns false.
However, if we set the epsilon value to 0.000001, the image_index
value will be rounded to the nearest real number that is +/
0.000001 of the original value, making the above comparison return
true.
The epsilon value will be used for all the following integer
operators:
Note that setting an epsilon value of 0 will disable all
rounding, and using a value of 1 will give an error.
GML Code Example
math_set_epsilon(0.0001);
This will set the epsilon value for all further floating point operations.
Can you suggest an edit for this page? Click Here
Does this page need better examples? Be the first to Submit
Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.
Do you have a question about this page? Ask it Here
To use this feature sign in with your Reddit account.