package main
import (
"fmt"
"math"
)
func main() {
/*
==================================================
Title: Safe Floating-Point Comparison
==================================================
Never compare floating-point values directly.
*/
const epsilon float64 = 1e-12
value := 0.1 + 0.2
if math.Abs(value-0.3) < epsilon {
fmt.Println("Values are effectively equal.")
}
}
/*
run:
Values are effectively equal.
*/