Skip to content

Commit

Permalink
math: fix expected results for -5 raised to the -2 power, add a few m…
Browse files Browse the repository at this point in the history
…ore cases (#19274)
  • Loading branch information
kimshrier committed Sep 5, 2023
1 parent fb0f12f commit c126450
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions vlib/math/math_test.v
Expand Up @@ -777,7 +777,8 @@ fn test_pow() {
[inf(1), 1], [inf(1), pi], [inf(1), nan()], [nan(), -pi],
[nan(), -0.0], [nan(), 0], [nan(), 1], [nan(), pi], [nan(),
nan()],
[5.0, 2.0], [5.0, 3.0], [5.0, 10.0], [5.0, -2.0], [-5.0, -2.0]]
[5.0, 2.0], [5.0, 3.0], [5.0, 10.0], [5.0, -2.0], [-5.0, -1.0],
[-5.0, -2.0], [-5.0, -3.0]]
pow_sc_ := [f64(0), // pow(-inf, -pi)
-0.0, // pow(-inf, -3)
1, // pow(-inf, -0)
Expand Down Expand Up @@ -844,11 +845,13 @@ fn test_pow() {
125, // pow(5, 3) => 5 * 5 * 5
9765625, // pow(5, 10)
0.04, // pow(5, -2)
-0.04, // pow(-5, -2)
-0.2, // pow(-5, -1)
0.04, // pow(-5, -2)
-0.008, // pow(-5, -3)
]
for i := 0; i < vfpow_sc_.len; i++ {
f := pow(vfpow_sc_[i][0], vfpow_sc_[i][1])
assert alike(pow_sc_[i], f)
assert alike(pow_sc_[i], f), 'pow_sc_[${i}] = ${pow_sc_[i]}, f = ${f}'
}
}

Expand Down

0 comments on commit c126450

Please sign in to comment.