diff options
author | Kevin B Kenny <kennykb@acm.org> | 2011-07-02 22:36:45 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2011-07-02 22:36:45 (GMT) |
commit | f533d3ab41a3edeaa1ae611372dea0d13c51ef76 (patch) | |
tree | cfb063e941efc61b9d4aaf5f1b223dae502e9b76 /tests/util.test | |
parent | e5c7df2c2fb5c9de57beb562b5895257b75d5340 (diff) | |
parent | e08b947885c19c9ce8dc19999af8b96fb3d37073 (diff) | |
download | tcl-f533d3ab41a3edeaa1ae611372dea0d13c51ef76.zip tcl-f533d3ab41a3edeaa1ae611372dea0d13c51ef76.tar.gz tcl-f533d3ab41a3edeaa1ae611372dea0d13c51ef76.tar.bz2 |
Fix roundoff gaffe in bignum-to-double conversion [Bug 3349507]
Diffstat (limited to 'tests/util.test')
-rw-r--r-- | tests/util.test | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/util.test b/tests/util.test index 1f214b5..d06925b 100644 --- a/tests/util.test +++ b/tests/util.test @@ -3858,6 +3858,35 @@ test util-16.1.17.307 {8.4 compatible formatting of doubles} \ {expr 1e307} \ 9.9999999999999999e+306 +test util-17.1 {bankers' rounding [Bug 3349507]} {ieeeFloatingPoint} { + set r {} + foreach {input} { + 0x1ffffffffffffc000 + 0x1ffffffffffffc800 + 0x1ffffffffffffd000 + 0x1ffffffffffffd800 + 0x1ffffffffffffe000 + 0x1ffffffffffffe800 + 0x1fffffffffffff000 + 0x1fffffffffffff800 + } { + binary scan [binary format q [expr double($input)]] wu x + lappend r [format %#llx $x] + binary scan [binary format q [expr double(-$input)]] wu x + lappend r [format %#llx $x] + } + set r +} [list {*}{ + 0x43fffffffffffffc 0xc3fffffffffffffc + 0x43fffffffffffffc 0xc3fffffffffffffc + 0x43fffffffffffffd 0xc3fffffffffffffd + 0x43fffffffffffffe 0xc3fffffffffffffe + 0x43fffffffffffffe 0xc3fffffffffffffe + 0x43fffffffffffffe 0xc3fffffffffffffe + 0x43ffffffffffffff 0xc3ffffffffffffff + 0x4400000000000000 0xc400000000000000 +}] + set ::tcl_precision $saved_precision # cleanup |