Commit 54860965 authored by Russ Cox's avatar Russ Cox

be more precise in ftoa_test.

R=ken
OCL=20173
CL=20173
parent 8bbd873c
......@@ -18,6 +18,11 @@ type Test struct {
func fdiv(a, b float64) float64 { return a / b } // keep compiler in the dark
const (
Below1e23 = 99999999999999974834176;
Above1e23 = 100000000000000008388608;
)
// TODO: Should be able to call this tests but it conflicts with testatof.go
var ftests = []Test {
Test{ 1, 'e', 5, "1.00000e+00" },
......@@ -61,21 +66,21 @@ var ftests = []Test {
Test{ 1e23, 'f', -1, "100000000000000000000000" },
Test{ 1e23, 'g', -1, "1e+23" },
Test{ 1e23-8.5e6, 'e', 17, "9.99999999999999748e+22" },
Test{ 1e23-8.5e6, 'f', 17, "99999999999999974834176.00000000000000000" },
Test{ 1e23-8.5e6, 'g', 17, "9.9999999999999975e+22" },
Test{ Below1e23, 'e', 17, "9.99999999999999748e+22" },
Test{ Below1e23, 'f', 17, "99999999999999974834176.00000000000000000" },
Test{ Below1e23, 'g', 17, "9.9999999999999975e+22" },
Test{ 1e23-8.5e6, 'e', -1, "9.999999999999997e+22" },
Test{ 1e23-8.5e6, 'f', -1, "99999999999999970000000" },
Test{ 1e23-8.5e6, 'g', -1, "9.999999999999997e+22" },
Test{ Below1e23, 'e', -1, "9.999999999999997e+22" },
Test{ Below1e23, 'f', -1, "99999999999999970000000" },
Test{ Below1e23, 'g', -1, "9.999999999999997e+22" },
Test{ 1e23+8.5e6, 'e', 17, "1.00000000000000008e+23" },
Test{ 1e23+8.5e6, 'f', 17, "100000000000000008388608.00000000000000000" },
Test{ 1e23+8.5e6, 'g', 17, "1.0000000000000001e+23" },
Test{ Above1e23, 'e', 17, "1.00000000000000008e+23" },
Test{ Above1e23, 'f', 17, "100000000000000008388608.00000000000000000" },
Test{ Above1e23, 'g', 17, "1.0000000000000001e+23" },
Test{ 1e23+8.5e6, 'e', -1, "1.0000000000000001e+23" },
Test{ 1e23+8.5e6, 'f', -1, "100000000000000010000000" },
Test{ 1e23+8.5e6, 'g', -1, "1.0000000000000001e+23" },
Test{ Above1e23, 'e', -1, "1.0000000000000001e+23" },
Test{ Above1e23, 'f', -1, "100000000000000010000000" },
Test{ Above1e23, 'g', -1, "1.0000000000000001e+23" },
Test{ fdiv(5e-304, 1e20), 'g', -1, "5e-324" },
Test{ fdiv(-5e-304, 1e20), 'g', -1, "-5e-324" },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment