mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
f64: fix .eq()
This commit is contained in:
parent
fbd414fd2f
commit
fd2d9c214c
@ -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 {
|
||||||
|
@ -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)))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user