Documentation
¶
Index ¶
- Constants
- Variables
- func Float32Equals(a, b, epsilon float32) bool
- func Float64Equals(a, b, epsilon float64) bool
- func IsInfinite[T Float](f T) bool
- func IsNaN[T Float](f T) bool
- func IsSpecified[T Float](f T) bool
- func IsUnspecified[T Float](f T) bool
- func PackFloats(val1, val2 float32) int64
- func TakeOrElse[T Float](v T, defaultValue T) T
- func UnpackFloat1(packed int64) float32
- func UnpackFloat2(packed int64) float32
- type Float
Constants ¶
View Source
const ( Float64EqualityThreshold float64 = 1e-9 Float32EqualityThreshold float32 = 1e-6 )
Variables ¶
View Source
var Float32Infinite = float32(math.Inf(1))
View Source
var Float32Unspecified = float32(math.NaN())
View Source
var Float64Unspecified = math.NaN()
View Source
var FloatInfinite = math.Inf(1)
Functions ¶
func Float32Equals ¶
floatEquals compares two float32 values with absolute epsilon tolerance.
func Float64Equals ¶
floatEquals compares two float32 values with absolute epsilon tolerance.
func IsInfinite ¶
func IsSpecified ¶
func IsUnspecified ¶
func PackFloats ¶
PackFloats packs two float32 values into a single int64. val1 occupies the higher 32 bits, and val2 occupies the lower 32 bits.
func TakeOrElse ¶
func TakeOrElse[T Float](v T, defaultValue T) T
func UnpackFloat1 ¶
UnpackFloat1 extracts the float32 value from the higher 32 bits of the packed int64.
func UnpackFloat2 ¶
UnpackFloat2 extracts the float32 value from the lower 32 bits of the packed int64.
Types ¶
Click to show internal directories.
Click to hide internal directories.