Sets the precision used for comparisons.



Argument Description
prec The precision value (default 0.0000001)

Returns: N/A


When comparing values, for example when searching in a map or sorting a list, GameMaker: Studio must decide when two values are equal. For strings and integer values this is clear but for real numbers, due to floating point round-off errors, seemingly equal numbers can easily become unequal. For example, it's possible that (5 / 3) * 3 will not be equal to 5! To help avoid this, a precision value is used on all real number functions, and when the difference between two numbers is smaller than this precision they are considered equal. The default a precision of 0.0000001 is used for all data structure functions unless changed by this function.

NOTE: This precision is used in all data structures but not in other comparisons in GML!



The above code will change the default precision setting for all data structure functions.

Back: Data Structures
Next: ds_exists
© Copyright YoYo Games Ltd. 2018 All Rights Reserved