Skip to content

Commit 4569e6b

Browse files
milsemantbkka
authored andcommitted
Disable testing printing of subnormals on 32b ARM. (#16433) (#16841)
On Darwin (and most other OSes), subnormal support is turned off for armv7, which causes these tests to fail. Longer-term, instead of gating this on architecture we may want to be able to query if subnormals are supported for a BinaryFloatingPoint type, and then we could key off of that instead.
1 parent f048a51 commit 4569e6b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

test/stdlib/PrintFloat.swift.gyb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,9 @@ PrintTests.test("Printable_Float") {
592592
expectDescription("-inf", -Float.infinity)
593593
expectDescription("3.1415925", Float.pi)
594594
expectDescription("3.4028235e+38", Float.greatestFiniteMagnitude)
595+
#if !arch(arm)
595596
expectDescription("1e-45", Float.leastNonzeroMagnitude)
597+
#endif
596598
expectDescription("1.1754944e-38", Float.leastNormalMagnitude)
597599

598600
// Special cases for the underlying algorithms:
@@ -623,7 +625,12 @@ PrintTests.test("Printable_Float") {
623625
expectNaN("snan(0x1fffff)", Float(bitPattern: 0x7fbf_ffff))
624626

625627
// Every power of 10 should print with only a single digit '1'
626-
for power in -45 ... 38 {
628+
#if arch(arm)
629+
let lowerBound = -37
630+
#else
631+
let lowerBound = -45
632+
#endif
633+
for power in lowerBound ... 38 {
627634
let s: String
628635
if power < -4 || power > 7 { // Exponential form
629636
s = exponentialPowerOfTen(power)
@@ -709,7 +716,9 @@ PrintTests.test("Printable_Double") {
709716
// Special values
710717
expectDescription("3.141592653589793", Double.pi)
711718
expectDescription("1.7976931348623157e+308", Double.greatestFiniteMagnitude)
719+
#if !arch(arm)
712720
expectDescription("5e-324", Double.leastNonzeroMagnitude)
721+
#endif
713722
expectDescription("2.2250738585072014e-308", Double.leastNormalMagnitude)
714723
expectDescription("inf", Double.infinity)
715724
expectDescription("-inf", -Double.infinity)
@@ -730,7 +739,12 @@ PrintTests.test("Printable_Double") {
730739
expectNaN("snan(0x3ffffffffffff)", Float64(bitPattern: 0x7ff7_ffff_ffff_ffff))
731740

732741
// We know how every power of 10 should print
733-
for power in -323 ... 308 {
742+
#if arch(arm)
743+
let lowerBound = -307
744+
#else
745+
let lowerBound = -323
746+
#endif
747+
for power in lowerBound ... 308 {
734748
let s: String
735749
if power < -4 || power > 15 { // Exponential form
736750
s = exponentialPowerOfTen(power)

0 commit comments

Comments
 (0)