Skip to content

Instantly share code, notes, and snippets.

@ruanchao
Created November 21, 2012 07:27
Show Gist options
  • Save ruanchao/4123586 to your computer and use it in GitHub Desktop.
Save ruanchao/4123586 to your computer and use it in GitHub Desktop.
Go-float compels
import "math"
//p为用户自定义的比较精度,比如0.00001
func IsEqual(f1,f2,p float64) bool{
return math.Fdim(f1,f2) < p
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment