math: fix expected results for -5 raised to the -2 power, add a few more cases (#19274)

This commit is contained in:
Kim Shrier 2023-09-04 23:13:29 -06:00 committed by GitHub
parent fb0f12f937
commit c126450201
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
@ -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}'
}
}