f64: fix .eq()
parent
fbd414fd2f
commit
fd2d9c214c
|
@ -27,8 +27,7 @@ pub fn ptr_str(ptr voidptr) string {
|
|||
|
||||
// compare floats using C epsilon
|
||||
pub fn (a f64) eq(b f64) bool {
|
||||
//return C.fabs(a - b) <= C.DBL_EPSILON
|
||||
return (a - b) <= C.DBL_EPSILON
|
||||
return C.fabs(a - b) <= C.DBL_EPSILON
|
||||
}
|
||||
|
||||
// fn (nn i32) str() string {
|
||||
|
|
|
@ -46,5 +46,5 @@ fn test_erf() {
|
|||
fn test_gamma() {
|
||||
assert math.gamma(1) == 1
|
||||
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)))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue