Garry's Mod Wiki

math.IsNearlyZero

  boolean math.IsNearlyZero( number a, number tolerance = 1e-8 )

Recently Added

This was recently added in version (2025.01.22). It might only be available on the Dev Branch right now.

Description

Checks if a floating point number is nearly zero. See math.IsNearlyEqual for more information.

Arguments

1 number a
The number to compare.
2 number tolerance = 1e-8
The maximum difference between the number and zero to consider them equal.

Returns

1 boolean
True if the difference between the number and zero is less than or equal to the tolerance.