Skip to content

Commit 033e127

Browse files
committed
Auto merge of rust-lang#27786 - alexcrichton:start-testing-msvc, r=brson
* An apparent bug in VS 2013's implementation of the `exp2` function is worked around in one of flt2dec's tests. Turns out this was the only fix necessary!
2 parents e2bebf3 + 60ac0d8 commit 033e127

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/libcoretest/num/flt2dec/strategy/dragon.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,22 @@ fn shortest_sanity_test() {
3535

3636
#[test]
3737
fn exact_sanity_test() {
38-
f64_exact_sanity_test(format_exact);
38+
// This test ends up running what I can only assume is some corner-ish case
39+
// of the `exp2` library function, defined in whatever C runtime we're
40+
// using. In VS 2013 this function apparently had a bug as this test fails
41+
// when linked, but with VS 2015 the bug appears fixed as the test runs just
42+
// fine.
43+
//
44+
// The bug seems to be a difference in return value of `exp2(-1057)`, where
45+
// in VS 2013 it returns a double with the bit pattern 0x2 and in VS 2015 it
46+
// returns 0x20000.
47+
//
48+
// For now just ignore this test entirely on MSVC as it's tested elsewhere
49+
// anyway and we're not super interested in testing each platform's exp2
50+
// implementation.
51+
if !cfg!(target_env = "msvc") {
52+
f64_exact_sanity_test(format_exact);
53+
}
3954
f32_exact_sanity_test(format_exact);
4055
}
4156

src/libcoretest/num/flt2dec/strategy/grisu.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ fn shortest_f64_hard_random_equivalence_test() {
7777

7878
#[test]
7979
fn exact_sanity_test() {
80-
f64_exact_sanity_test(format_exact);
80+
// See comments in dragon.rs's exact_sanity_test for why this test is
81+
// ignored on MSVC
82+
if !cfg!(target_env = "msvc") {
83+
f64_exact_sanity_test(format_exact);
84+
}
8185
f32_exact_sanity_test(format_exact);
8286
}
8387

0 commit comments

Comments
 (0)