Skip to content

Commit b4bb011

Browse files
committed
add missing float non-determinism tests and skip some on i686-pc-windows-msvc that are internally implemented via f64
1 parent 61a25fd commit b4bb011

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

src/tools/miri/tests/pass/float.rs

+24-10
Original file line numberDiff line numberDiff line change
@@ -1327,15 +1327,24 @@ fn test_non_determinism() {
13271327
ensure_nondet(|| 3.0f32.hypot(4.0f32));
13281328
ensure_nondet(|| 1f32.sin());
13291329
ensure_nondet(|| 0f32.cos());
1330-
ensure_nondet(|| 1.0f32.sinh());
1330+
// On i686-pc-windows-msvc , these functions are implemented by calling the `f64` version,
1331+
// which means the little rounding errors Miri introduces are discard by the cast down to `f32`.
1332+
// Just skip the test for them.
1333+
if !cfg!(all(target_os = "windows", target_env = "msvc", target_arch = "x86")) {
1334+
ensure_nondet(|| 1.0f32.tan());
1335+
ensure_nondet(|| 1.0f32.asin());
1336+
ensure_nondet(|| 5.0f32.acos());
1337+
ensure_nondet(|| 1.0f32.atan());
1338+
ensure_nondet(|| 1.0f32.atan2(2.0f32));
1339+
ensure_nondet(|| 1.0f32.sinh());
1340+
ensure_nondet(|| 1.0f32.cosh());
1341+
ensure_nondet(|| 1.0f32.tanh());
1342+
}
13311343
ensure_nondet(|| 1.0f32.asinh());
1332-
ensure_nondet(|| 1.0f32.cosh());
13331344
ensure_nondet(|| 2.0f32.acosh());
1334-
ensure_nondet(|| 1.0f32.tan());
1335-
ensure_nondet(|| 1.0f32.tanh());
1336-
ensure_nondet(|| 1.0f32.atan2(2.0f32));
13371345
ensure_nondet(|| 0.5f32.atanh());
13381346
ensure_nondet(|| 5.0f32.gamma());
1347+
ensure_nondet(|| 5.0f32.ln_gamma());
13391348
ensure_nondet(|| 5.0f32.erf());
13401349
ensure_nondet(|| 5.0f32.erfc());
13411350
}
@@ -1348,18 +1357,23 @@ fn test_non_determinism() {
13481357
ensure_nondet(|| 1f64.ln_1p());
13491358
ensure_nondet(|| f64::consts::E.log10());
13501359
ensure_nondet(|| f64::consts::E.log2());
1351-
ensure_nondet(|| 1f64.sin());
1352-
ensure_nondet(|| 0f64.cos());
13531360
ensure_nondet(|| 27.0f64.cbrt());
13541361
ensure_nondet(|| 3.0f64.hypot(4.0f64));
1362+
ensure_nondet(|| 1f64.sin());
1363+
ensure_nondet(|| 0f64.cos());
1364+
ensure_nondet(|| 1.0f64.tan());
1365+
ensure_nondet(|| 1.0f64.asin());
1366+
ensure_nondet(|| 5.0f64.acos());
1367+
ensure_nondet(|| 1.0f64.atan());
1368+
ensure_nondet(|| 1.0f64.atan2(2.0f64));
13551369
ensure_nondet(|| 1.0f64.sinh());
1356-
ensure_nondet(|| 1.0f64.asinh());
13571370
ensure_nondet(|| 1.0f64.cosh());
1358-
ensure_nondet(|| 3.0f64.acosh());
1359-
ensure_nondet(|| 1.0f64.tan());
13601371
ensure_nondet(|| 1.0f64.tanh());
1372+
ensure_nondet(|| 1.0f64.asinh());
1373+
ensure_nondet(|| 3.0f64.acosh());
13611374
ensure_nondet(|| 0.5f64.atanh());
13621375
ensure_nondet(|| 5.0f64.gamma());
1376+
ensure_nondet(|| 5.0f64.ln_gamma());
13631377
ensure_nondet(|| 5.0f64.erf());
13641378
ensure_nondet(|| 5.0f64.erfc());
13651379
}

0 commit comments

Comments
 (0)