f64: fix .eq()

pull/2148/head
hazohelet 2019-09-28 20:04:03 +09:00 committed by Alexander Medvednikov
parent fbd414fd2f
commit fd2d9c214c
2 changed files with 2 additions and 3 deletions

View File

@ -27,8 +27,7 @@ pub fn ptr_str(ptr voidptr) string {
// compare floats using C epsilon // compare floats using C epsilon
pub fn (a f64) eq(b f64) bool { pub fn (a f64) eq(b f64) bool {
//return C.fabs(a - b) <= C.DBL_EPSILON return C.fabs(a - b) <= C.DBL_EPSILON
return (a - b) <= C.DBL_EPSILON
} }
// fn (nn i32) str() string { // fn (nn i32) str() string {

View File

@ -46,5 +46,5 @@ fn test_erf() {
fn test_gamma() { fn test_gamma() {
assert math.gamma(1) == 1 assert math.gamma(1) == 1
assert math.gamma(5) == 24 assert math.gamma(5) == 24
assert math.log_gamma(4.5) == math.log(math.gamma(4.5)) assert math.log_gamma(4.5).eq(math.log(math.gamma(4.5)))
} }