Skip to content

Commit 575300e

Browse files
committed
Added tests for debug printing of floating point numbers
1 parent 3a9eec6 commit 575300e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/1_stdlib/Print.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,23 @@ func test_FloatingPointPrinting() {
409409
printedIs(asFloat80(0.0000000000000000125), "1.25e-17")
410410
#endif
411411

412+
debugPrintedIs(asFloat32(1.1), "1.10000002")
413+
debugPrintedIs(asFloat32(125000000000000000.0), "1.24999998e+17")
414+
debugPrintedIs(asFloat32(1.25), "1.25")
415+
debugPrintedIs(asFloat32(0.0000125), "1.24999997e-05")
416+
417+
debugPrintedIs(asFloat64(1.1), "1.1000000000000001")
418+
debugPrintedIs(asFloat64(125000000000000000.0), "1.25e+17")
419+
debugPrintedIs(asFloat64(1.25), "1.25")
420+
debugPrintedIs(asFloat64(0.0000125), "1.2500000000000001e-05")
421+
422+
#if arch(i386) || arch(x86_64)
423+
debugPrintedIs(asFloat80(1.1), "1.10000000000000000002")
424+
debugPrintedIs(asFloat80(125000000000000000.0), "125000000000000000.0")
425+
debugPrintedIs(asFloat80(1.25), "1.25")
426+
debugPrintedIs(asFloat80(0.0000125), "1.25000000000000000001e-05")
427+
#endif
428+
412429
print("test_FloatingPointPrinting done")
413430
}
414431
test_FloatingPointPrinting()

0 commit comments

Comments
 (0)