Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-16
21:04 • Ticket [218533ffff] expr and format Test suite failures (Windows only) statu... artifact: e3babe0d4c user: dgp
2000-10-26
08:24 • Closed ticket [218533ffff]. artifact: d8c3ef1b65 user: welch
01:01 • New ticket [218533ffff]. artifact: 2addd2e990 user: nobody

expr and format Test suite failures (Windows only)

Closed / Fixed218533ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:01:50
OriginalBugID: 916 Bug
Version: 8.0.3
SubmitDate: '1998-12-04'
LastModified: '1999-08-13'
Severity: LOW
Status: Released
Submitter: welch
ChangedBy: hobbs
OS: Windows NT
OSVersion: 4.0 SP3
Machine: X86
FixedDate: '1999-08-13'
ClosedDate: '2000-10-25'


Name:
Jan Nijtmans

ReproducibleScript:
Run the Tcl8.0.3 test suite on Windows NT after building it with MSVC++ 5.0.

ObservedBehavior:
A printout of the results for expr-old.test and format.test :

==== expr-old-25.19 type conversions
==== Contents of test case:
expr 2.0e15
==== Result was:
2e+015
---- Result should have been:
2e+15
---- expr-old-25.19 FAILED
format.test
==== format-3.1 e and f formats
==== Contents of test case:
    format "%e %e %e %e" 34.2e12 68.514 -.125 -16000. .000053
==== Result was:
3.420000e+013 6.851400e+001 -1.250000e-001 -1.600000e+004
---- Result should have been:
3.420000e+13 6.851400e+01 -1.250000e-01 -1.600000e+04
---- format-3.1 FAILED
==== format-3.2 e and f formats
==== Contents of test case:
    format "%20e %20e %20e %20e" 34.2e12 68.514 -.125 -16000. .000053
==== Result was:
       3.420000e+013        6.851400e+001       -1.250000e-001       -1.600000e+004
---- Result should have been:
        3.420000e+13         6.851400e+01        -1.250000e-01        -1.600000e+04
---- format-3.2 FAILED
==== format-3.3 e and f formats
==== Contents of test case:
 format "%.1e %.1e %.1e %.1e" 34.2e12 68.514 -.126 -16000. .000053

==== Result was:
3.4e+013 6.9e+001 -1.3e-001 -1.6e+004
---- Result should have been:
3.4e+13 6.9e+01 -1.3e-01 -1.6e+04
---- format-3.3 FAILED
==== format-3.4 e and f formats
==== Contents of test case:
 format "%020e %020e %020e %020e" 34.2e12 68.514 -.126 -16000. .000053

==== Result was:
00000003.420000e+013 00000006.851400e+001 -0000001.260000e-001 -0000001.600000e+004
---- Result should have been:
000000003.420000e+13 000000006.851400e+01 -00000001.260000e-01 -00000001.600000e+04
---- format-3.4 FAILED
==== format-3.5 e and f formats
==== Contents of test case:
 format "%7.1e %7.1e %7.1e %7.1e" 34.2e12 68.514 -.126 -16000. .000053

==== Result was:
3.4e+013 6.9e+001 -1.3e-001 -1.6e+004
---- Result should have been:
3.4e+13 6.9e+01 -1.3e-01 -1.6e+04
---- format-3.5 FAILED
==== format-3.8 e and f formats
==== Contents of test case:
    format "%.4e %.5e %.6e" -9.99996 -9.99996 9.99996
==== Result was:
-1.0000e+001 -9.99996e+000 9.999960e+000
---- Result should have been:
-1.0000e+01 -9.99996e+00 9.999960e+00
---- format-3.8 FAILED
==== format-3.12 e and f formats
==== Contents of test case:
    format "%.0e %#.0e" -9.99996 -9.99996 9.99996
==== Result was:
-1e+001 -1.e+001
---- Result should have been:
-1e+01 -1.e+01
---- format-3.12 FAILED
==== format-4.1 g-format
==== Contents of test case:
    format "%.3g" 12341.0
==== Result was:
1.23e+004
---- Result should have been:
1.23e+04
---- format-4.1 FAILED
==== format-4.2 g-format
==== Contents of test case:
    format "%.3G" 1234.12345
==== Result was:
1.23E+003
---- Result should have been:
1.23E+03
---- format-4.2 FAILED
==== format-4.11 g-format
==== Contents of test case:
    format "%.3g" .00001234
==== Result was:
1.23e-005
---- Result should have been:
1.23e-05
---- format-4.11 FAILED
==== format-4.12 g-format
==== Contents of test case:
    format "%.4g" 9999.6
==== Result was:
1e+004
---- Result should have been:
1e+04
---- format-4.12 FAILED
==== format-4.18 g-format
==== Contents of test case:
    format "%.3g" .00001
==== Result was:
1e-005
---- Result should have been:
1e-05
---- format-4.18 FAILED
==== format-4.19 g-format
==== Contents of test case:
    format "%#.3g" 1234.0
==== Result was:
1.23e+003
---- Result should have been:
1.23e+03
---- format-4.19 FAILED
==== format-4.20 g-format
==== Contents of test case:
    format "%#.3G" 9999.5
==== Result was:
1.00E+004
---- Result should have been:
1.00E+04
---- format-4.20 FAILED
==== format-5.1 floating-point zeroes
==== Contents of test case:
    format "%e %f %g" 0.0 0.0 0.0 0.0
==== Result was:
0.000000e+000 0.000000 0
---- Result should have been:
0.000000e+00 0.000000 0
---- format-5.1 FAILED
==== format-5.2 floating-point zeroes
==== Contents of test case:
    format "%.4e %.4f %.4g" 0.0 0.0 0.0 0.0
==== Result was:
0.0000e+000 0.0000 0
---- Result should have been:
0.0000e+00 0.0000 0
---- format-5.2 FAILED
==== format-5.3 floating-point zeroes
==== Contents of test case:
    format "%#.4e %#.4f %#.4g" 0.0 0.0 0.0 0.0
==== Result was:
0.0000e+000 0.0000 0.0000
---- Result should have been:
0.0000e+00 0.0000 0.000
---- format-5.3 FAILED
==== format-5.4 floating-point zeroes
==== Contents of test case:
    format "%.0e %.0f %.0g" 0.0 0.0 0.0 0.0
==== Result was:
0e+000 0 0
---- Result should have been:
0e+00 0 0
---- format-5.4 FAILED
==== format-5.5 floating-point zeroes
==== Contents of test case:
    format "%#.0e %#.0f %#.0g" 0.0 0.0 0.0 0.0
==== Result was:
0.e+000 0. 0.0
---- Result should have been:
0.e+00 0. 0.
---- format-5.5 FAILED

Patch:
***generic/tclUtil.c.origMonNov0220:24:191998
---generic/tclUtil.cThuNov1215:16:521998
***************
***2470,2475****
---2470,2483----

sprintf(dst,precisionFormat,value)\;

+#ifdef_MSC_VER
+p=strchr(dst,'e')\;
+if(p&&p\[2\]=='0'&&strlen(p)==5)\{
+p\[2\]=p\[3\]\;
+p\[3\]=p\[4\]\;
+p\[4\]=0\;
+\}
+#endif
/*
*IftheASCIIresultlookslikeaninteger,add\".0\"sothatit
*doesn'tlooklikeanintegeranymore.Thispreventsfloating-point
***generic/tclCmdAH.c.origMonNov0220:24:111998
---generic/tclCmdAH.cThuNov1215:16:541998
***************
***1935,1941****
---1935,1952----
\}

if\!
 (whichValue==DOUBLE_VALUE)\{
+#ifdef_MSC_VER
+char*p\;
+#endif
sprintf(dst,newFormat,doubleValue)\;
+#ifdef_MSC_VER
+p=strchr(dst,'e')\;
+if(p&&p\[2\]=='0'&&strlen(p)==5)\{
+p\[2\]=p\[3\]\;
+p\[3\]=p\[4\]\;
+p\[4\]=0\;
+\}
+#endif
\}elseif(whichValue==INT_VALUE)\{
if(useShort)\{
sprintf(dst,newFormat,(short)intValue)\;

PatchFiles:
tclUtil.c tclCmdAH.c



The main reason why I wrote this patch is because all those failures
mask the other failures that I'm really interested in. Still 5 format
tests fail: (3.2, 3.4, 4.2, 4.20, 5.3 and 5.5) but that's a lot better than
the 20 tests that failed before.

The patch works as follows. If after formatting the end of the
string looks like "e?0??" (the first '?' should be '+' or '-'), the
'0' doesn't contribute at all to the interpretation, so this
character can be removed. Of course, this correction only
needs to be done when compiling with MSVC++ (or, better,
when linking with MSVCRT.DLL) ....... :-(
--
These results are still found in 8.2b2, but the tests have been fixed
to account for the broken sprintf implementation.  See constraints
check for "eformat" in library/tcltest1.0/tcltest.tcl 
-- 08/13/1999 hobbs
welch Closed ticket [218533ffff]. [History diff]2000-10-26 08:24:12
dgp Ticket [218533ffff]: 3 changes [History diff]2001-04-16 21:04:17
Log in (anonymous is fine) to add a comment.