FloatExtensions
Static Class in Zigurous.Math
Declaration
public static class FloatExtensions
Description
Extension methods for floats.
Properties
SAFE_FLOAT | Sometimes Unity throws precision errors for really small numbers such as when setting transform values. Using float.Epsilon can still cause issues so this value is intended to be a safer alternative. |
Extension Methods
IsNaN | Checks if the value is NaN . |
IsInfinite | Checks if the value is infinite. |
IsPositiveInfinity | Checks if the value is equal to positive infinity. |
IsNegativeInfinity | Checks if the value is equal to negative infinity. |
IsRealNumber | Checks if the value is a real number (not infinite and not NaN ). |
IsImaginaryNumber | Checks if the value is an imaginary number (infinite or NaN ). |
IsDividable | Checks if the value can be divided (not zero, not infinite, and not NaN ). |
IsPositive | Checks if the value is positive. |
IsNegative | Checks if the value is negative. |
IsZero | Checks if the value is zero given a margin of error specified by an epsilon. |
IsEqualTo | Checks for equality with another value given a margin of error specified by an epsilon. |
ToAbbreviatedString | Converts the number to an abbreviated string, e.g. "1k" for 1000. |
UnsetImaginary | Sets the value to a new value if the value is an imaginary number (infinite or NaN ). |
UnsetInfinite | Sets the value to a new value if the value is an infinite number. |
UnsetNaN | Sets the value to a new value if the value is NaN . |
UnsetZero | Sets the value to a new value if the value is zero given a margin of error specified by an epsilon. |