summaryrefslogtreecommitdiffstats
path: root/tests/binary.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2005-10-08 14:42:44 (GMT)
committerdgp <dgp@users.sourceforge.net>2005-10-08 14:42:44 (GMT)
commit76faac0f28fe9661f23ff9e35f44df1d899420e5 (patch)
tree7e3de1d0523d70328cfd81d9864b897058823d34 /tests/binary.test
parent98a6fcad96289a40b501fbd2095387a245fd804d (diff)
downloadtcl-76faac0f28fe9661f23ff9e35f44df1d899420e5.zip
tcl-76faac0f28fe9661f23ff9e35f44df1d899420e5.tar.gz
tcl-76faac0f28fe9661f23ff9e35f44df1d899420e5.tar.bz2
TIP#237 IMPLEMENTATION
[kennykb-numerics-branch] Resynchronized with the HEAD; at this checkpoint [-rkennykb-numerics-branch-20051008], the HEAD and kennykb-numerics-branch contain identical code.
Diffstat (limited to 'tests/binary.test')
-rw-r--r--tests/binary.test67
1 files changed, 65 insertions, 2 deletions
diff --git a/tests/binary.test b/tests/binary.test
index 2bd3169..e2ad12e 100644
--- a/tests/binary.test
+++ b/tests/binary.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: binary.test,v 1.24 2005/09/27 15:35:50 dkf Exp $
+# RCS: @(#) $Id: binary.test,v 1.25 2005/10/08 14:42:54 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -2141,6 +2141,66 @@ proc testIEEE {} {
testConstraint ieeeFloatingPoint [testIEEE]
+# scan/format infinities
+
+test binary-62.1 {infinity} ieeeFloatingPoint {
+ binary scan [binary format q Infinity] w w
+ format 0x%016lx $w
+} 0x7ff0000000000000
+test binary-62.2 {infinity} ieeeFloatingPoint {
+ binary scan [binary format q -Infinity] w w
+ format 0x%016lx $w
+} 0xfff0000000000000
+test binary-62.3 {infinity} ieeeFloatingPoint {
+ binary scan [binary format q Inf] w w
+ format 0x%016lx $w
+} 0x7ff0000000000000
+test binary-62.4 {infinity} ieeeFloatingPoint {
+ binary scan [binary format q -Infinity] w w
+ format 0x%016lx $w
+} 0xfff0000000000000
+test binary-62.5 {infinity} ieeeFloatingPoint {
+ binary scan [binary format w 0x7ff0000000000000] q d
+ set d
+} Inf
+test binary-62.6 {infinity} ieeeFloatingPoint {
+ binary scan [binary format w 0xfff0000000000000] q d
+ set d
+} -Inf
+
+# scan/format Not-a-Number
+
+test binary-63.1 {NaN} ieeeFloatingPoint {
+ binary scan [binary format q NaN] w w
+ format 0x%016lx [expr {$w & 0xfff3ffffffffffff}]
+} 0x7ff0000000000000
+test binary-63.2 {NaN} ieeeFloatingPoint {
+ binary scan [binary format q -NaN] w w
+ format 0x%016lx [expr {$w & 0xfff3ffffffffffff}]
+} 0xfff0000000000000
+test binary-63.3 {NaN} ieeeFloatingPoint {
+ binary scan [binary format q NaN(3123456789aBc)] w w
+ format 0x%016lx [expr {$w & 0xfff3ffffffffffff}]
+} 0x7ff3123456789abc
+test binary-63.4 {NaN} ieeeFloatingPoint {
+ binary scan [binary format q {NaN( 3123456789aBc)}] w w
+ format 0x%016lx [expr {$w & 0xfff3ffffffffffff}]
+} 0x7ff3123456789abc
+test binary-64.1 {NaN} \
+ -constraints ieeeFloatingPoint \
+ -body {
+ binary scan [binary format w 0x7ff8000000000000] q d
+ set d
+ } \
+ -match glob -result NaN*
+test binary-64.2 {NaN} \
+ -constraints ieeeFloatingPoint \
+ -body {
+ binary scan [binary format w 0x7ff0123456789aBc] q d
+ set d
+ } \
+ -match glob -result NaN(*123456789abc)
+
test binary-65.1 {largest significand} ieeeFloatingPoint {
binary scan [binary format w 0x3fcfffffffffffff] q d
set d
@@ -2178,7 +2238,10 @@ test binary-65.8 {largest significand} ieeeFloatingPoint {
set d
} 18014398509481988.0
-
# cleanup
::tcltest::cleanupTests
return
+
+# Local Variables:
+# mode: tcl
+# End: