1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: use operator overloading on strings (p. 2) (#10183)

This commit is contained in:
Enzo
2021-05-24 10:38:31 +02:00
committed by GitHub
parent 40f11b265e
commit 886f69bfcf
12 changed files with 195 additions and 224 deletions

View File

@ -44,8 +44,8 @@ fn test_geometric_mean() {
data = [f64(-3.0), f64(67.31), f64(4.4), f64(1.89)]
o = stats.geometric_mean(data)
// Some issue with precision comparison in f64 using == operator hence serializing to string
assert o.str().eq('nan') || o.str().eq('-nan') || o.str().eq('-1.#IND00') || o == f64(0)
|| o.str().eq('-nan(ind)') // Because in math it yields a complex number
assert o.str() == 'nan' || o.str() == '-nan' || o.str() == '-1.#IND00' || o == f64(0)
|| o.str() == '-nan(ind)' // Because in math it yields a complex number
data = [f64(12.0), f64(7.88), f64(76.122), f64(54.83)]
o = stats.geometric_mean(data)
// Some issue with precision comparison in f64 using == operator hence serializing to string