Documentation
¶
Index ¶
Constants ¶
const Epsilon float64 = 1e-10
Epsilon is some tiny value that determines how precisely equal we want our floats to be. We've choosen 0.0000000001 (1e-10) as the threshold value.
Variables ¶
This section is empty.
Functions ¶
func AlmostEqual ¶
AlmostEqual determines if a and b are “close enough” using a combination of absolute and relative checks. This version also guards against NaN/Inf edge cases more explicitly, which can avoid subtle pitfalls. It's inspired by code from http://floating-point-gui.de/errors/comparison/
func AlmostEqualPairs ¶
AlmostEqualPairs is a utility function to compare pairs of floats.
func Equal ¶
Equal is a safe utility function to compare floats. It uses AlmostEqual under the hood with an epsilon of 1e-10
func EqualPairs ¶
EqualPairs is a utility function to compare pairs of floats.
Types ¶
This section is empty.