Created
November 21, 2012 07:27
-
-
Save ruanchao/4123586 to your computer and use it in GitHub Desktop.
Go-float compels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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