Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | corrected TRACE bugs, overflowed negative #s, and bad test constraints |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | kennykb-numerics-branch |
Files: | files | file ages | folders |
SHA1: |
57f3c9f0650414ad1636cfb8ceb9b60f |
User & Date: | kennykb 2005-08-24 18:56:32.000 |
Context
2005-08-24
| ||
21:49 |
[kennykb-numerics-branch] * generic/tclBasic.c: Revised implementation of the cei...check-in: 9cbb2232b7 user: dgp tags: kennykb-numerics-branch | |
18:56 | corrected TRACE bugs, overflowed negative #s, and bad test constraints check-in: 57f3c9f065 user: kennykb tags: kennykb-numerics-branch | |
18:51 |
[kennykb_numerics_branch] * generic/tclExecute.c: Bug fix: TclBignumToDouble return...check-in: ecd2f01ba8 user: dgp tags: kennykb-numerics-branch | |
Changes
Changes to ChangeLog.
1 2 | 2005-08-24 Don Porter <[email protected]> | > > > > > > > > > > > > > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 2005-08-24 Kevin Kenny <[email protected]> [kennykb-numerics-branch] * generic/tclExecute.c: Corrected some TRACE bugs that prevented compilation with --enable-symbols=all. * generic/tclStrToD.c: Revised commentary to prepare for a renaming of the file, removed some dead code, and fixed a bug where TclBignumToDouble failed on huge negative numbers. * tests/binary.test (binary-65.*): Added missing 'ieeeFloatingPoint' to large/small significand tests. * tests/expr.test (expr-45.*) Added missing braces around expressions. 2005-08-24 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclExecute.c: Bug fix: TclBignumToDouble return -Inf when appropriate. Removed declarations of removed routines. * generic/tclExecute.c: Revised the type promotion rules of the comparison operators so that they form proper equivalence classes over the set of numeric strings. 2005-08-23 Kevin Kenny <[email protected]> [kennykb-numerics-branch] * generic/tclCmdMZ.c (Tcl_StringObjCmd): * generic/tclInt.h: * generic/tclObj.c (Tcl_GetBooleanFromObj, SetDoubleFromAny, Tcl_GetLongFromObj, Tcl_GetWideIntFromObj, Tcl_GetBignumFromObj): * generic/tclParseExpr.c (GetLexeme): * generic/tclScan.c (Tcl_ScanObjCmd): |
︙ | ︙ | |||
33 34 35 36 37 38 39 | in generic/tclStrToD.c. Added test cases for 0b notation (TIP #114). Removed TclStrToD, and the static functions that it calls, which are now dead code (TclParseNumber now does all input floating-point conversions.) 2005-08-23 Don Porter <[email protected]> | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | in generic/tclStrToD.c. Added test cases for 0b notation (TIP #114). Removed TclStrToD, and the static functions that it calls, which are now dead code (TclParseNumber now does all input floating-point conversions.) 2005-08-23 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclStrToD.c: Bug fix: set shift magnitude properly whether we're expanding to mp_int type or not. * generic/tclExecute.c: Bug fix: ACCEPT_NAN under INST_UMINUS. * generic/tclStrToD.c: New macros TIP_114_FORMATS and KILL_OCTAL to |
︙ | ︙ | |||
66 67 68 69 70 71 72 | * generic/tclExecute.c: here and there. * generic/tclObj.c: * generic/tclStrToD.c: * generic/tclUtil.c: 2005-08-22 Don Porter <[email protected]> | | | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | * generic/tclExecute.c: here and there. * generic/tclObj.c: * generic/tclStrToD.c: * generic/tclUtil.c: 2005-08-22 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclInt.h: New ACCEPT_NAN macro to mark code that supports * generic/tclCmdAH.c: or disables accepting of the NaN value at * generic/tclExecute.c: various points. * generic/tclLink.c: * generic/tclStrToD.c: Bug fix. Parsing of +/- Infinity was reversed. |
︙ | ︙ | |||
98 99 100 101 102 103 104 | * tests/expr.test: Corrected the wideIs64bit constraint. * tests/format.test: * tests/scan.test: 2005-08-21 Don Porter <[email protected]> | | | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | * tests/expr.test: Corrected the wideIs64bit constraint. * tests/format.test: * tests/scan.test: 2005-08-21 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclInt.h: Moved TclParseInteger to tclUtil.c * generic/tclParseExpr.c: and made it static. * generic/tclUtil.c: * generic/tclInt.decls: Moved TclExprFloatError to tclBasic.c and * generic/tclBasic.c: made it static. |
︙ | ︙ | |||
124 125 126 127 128 129 130 | * generic/tclStrToD.c: Disabled out of date support "hack" for errno. * generic/tclBasic.c: Eliminated VerifyExprObjType. Initialize errno to zero in OldMathFuncProc. 2005-08-19 Don Porter <[email protected]> | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | * generic/tclStrToD.c: Disabled out of date support "hack" for errno. * generic/tclBasic.c: Eliminated VerifyExprObjType. Initialize errno to zero in OldMathFuncProc. 2005-08-19 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclBasic.c: Updated OldMathFuncProc and ExprAbsFunc to do less invasion into numeric Tcl_Obj internals. Made ExprDoubleFunc, ExprIntFunc, ExprWideFunc, and ExprRoundFunc bignum-aware. Revised ExprSrandFunc error message. * generic/tclProc.c: Wrapped a few tclWideIntType uses in |
︙ | ︙ | |||
149 150 151 152 153 154 155 | * generic/tclStubInit.c: * generic/tclCmdIL.c: Rework Tcl_IncrObjCmd and the INST_*INCR* * generic/tclExecute.c: opcodes to use the new routines. 2005-08-18 Don Porter <[email protected]> | | | | | | | | | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | * generic/tclStubInit.c: * generic/tclCmdIL.c: Rework Tcl_IncrObjCmd and the INST_*INCR* * generic/tclExecute.c: opcodes to use the new routines. 2005-08-18 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclExecute.c: Fixed string rep invalidation bug in * tests/dict.test (dict-11.17): INST_DICT_INCR_IMM rewrite. * generic/tclDictObj.c: DictIncrCmd rewrite to use TclIncrObj. * generic/tclInt.h: TclIncrObj static -> internal * generic/tclExecute.c: 2005-08-17 Kevin Kenny <[email protected]> [kennykb-numerics-branch] * generic/tclBasic.c (Tcl_Expr{Long,Double}{,Obj}): Updated to * generic/tclTest.c: deal with * tests/expr-old.test: bignums (well, * tests/expr.test: mostly). Added a missing "errno=0;" in ExprUnaryFunc so that spurious error returns aren't detected. Added test cases for Tcl_Expr* and Tcl_Expr*Obj because there was very poor test coverage in those areas. * generic/tclParseExpr.c: Reworked parsing of numbers to call TclParseNumber rather than trying to do things locally. * generic/tclStrToD.c: Corrected a comment. Changed so that *endPtrPtr does not include any trailing whitespace. 2005-08-17 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclExecute.c: New routine TclIncrObj to centralize the increment operation needed in many places. Updated INST_DICT_INCR_IMM to make use of it. 2005-08-16 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclExecute.c: Made bit shifting opcodes and INST_MOD bignum-aware. * tests/scan.test: Making << bignum-aware means that repeated * tests/string.test: left shifting cannot turn a positive into a negative. Revised [int_range] and [largest_int] utility commands in the test suite that relied on that happening. Without revision they became infinite loops. * generic/tclExecute.c: Made binary bitwise opcodes bignum-aware. * generic/tclTomMath.h: Added mp_or and mp_xor to routines from * unix/Makefile.in: libtommath used by Tcl. * win/Makefile.in: * win/makefile.vc: 2005-08-15 Don Porter <[email protected]> [kennykb-numerics-branch] Updates from HEAD. * generic/tclExecute.c: More revisions to IllegalExprOperandType. Merged INST_BITNOT with INST_UMINUS and make it bignum-aware according to the rule: ~a = -a - 1. Disabled unused code and noted more TODOs. * generic/tclInt.decls: Disabled TclLooksLikeInt() and all callers. * generic/tclUtil.c: * generic/tclCompCmds.c: * generic/tclBasic.c: Rewrite of VerifyExprObjType(). * generic/tclIntDecls.h: make genstubs * generic/tclStubInit.c: * generic/tclExecute.c: Updated execution of comparison bytecodes to be bignum-aware, routing string compares through INST_STR_CMP. 2005-08-14 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclExecute.c: Updated execution of arithmetic bytecodes to be bignum-aware, and to allow calculations on NaN to produce a NaN result. INST_UMINUS updated to call mp_neg. * generic/tclTomMath.h: Added mp_and, mp_expt_d, and mp_neg to * unix/Makefile.in: routines from libtommath used by Tcl. * win/Makefile.in: * win/makefile.vc: 2005-08-13 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclObj.c: Extended Bignum auto-narrowing to auto-narrow to tclWideIntType when appropriate; this helps keep things working as the bytecode execution code is migrated to supporting bignums. * generic/tclExecute.c: Major overhaul of IllegalExprOperandType. Changed several TclNewFooObj() calls to more logically appropriate ones. Added several TODO comments marking opportunies for future work. Made more use of the eePtr->constants. Made INST_UMINUS bignum aware. 2005-08-12 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclExecute.c: Simplify doCondJump. Use eePtr->constants as result of INST_DICT_NEXT, INST_LAND, and INST_LOR. Separate INST_LNOT from INST_UMINUS and simplify. 2004-08-12 Kevin Kenny <[email protected]> * generic/tclClock.c (MktimeObjCmd): * library/clock.tcl (GetSystemTimeZone, LoadZoneinfoFile, ReadZoneinfoFile): * tests/clock.test (clock-50.1): Added functionality to read /etc/localtime if it exists, so that Tcl's time can track system time on Linux even if TZ is not set. Changed ::tcl::clock::Mktime to check for failure, and added a test case that mimics failure but is really success. 2005-08-11 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclExecute.c: Rewrite of INST_LAND/INST_LOR to take advantage of loss of "pure double" issues. Merged INST_UPLUS with INST_TRY_CVT_TO_NUMERIC and updated to use improved rules for impure "double"s as well. * generic/tclStrToD.c: Restored conditional generation of |
︙ | ︙ | |||
305 306 307 308 309 310 311 | * win/Makefile.in: 'make distclean' on Windows clean * win/rules.vc: just a little bit cleaner.) * win/tcl.m4: * win/tclWinThrd.c: 2005-08-10 Don Porter <[email protected]> | | | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | * win/Makefile.in: 'make distclean' on Windows clean * win/rules.vc: just a little bit cleaner.) * win/tcl.m4: * win/tclWinThrd.c: 2005-08-10 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclTomMath.h: Added mp_shrink, mp_to_unsigned_bin, * unix/Makefile.in: mp_to_unsigned_bin_n, and mp_unsigned_bin_size * win/Makefile.in: to routines from libtommath used by Tcl. * win/makefile.vc: * generic/tommath.h: make gentommath_h |
︙ | ︙ | |||
341 342 343 344 345 346 347 | 2005-08-09 Vince Darley <[email protected]> * generic/tclPathObj.c: fix to [file rootname] bug in optimized code path reported on comp.lang.tcl. 2005-08-08 Don Porter <[email protected]> | | | | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | 2005-08-09 Vince Darley <[email protected]> * generic/tclPathObj.c: fix to [file rootname] bug in optimized code path reported on comp.lang.tcl. 2005-08-08 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclObj.c: Replaced some goto's with loops and started use of BIGNUM_AUTO_NARROW and NO_WIDE_TYPE. 2005-08-06 Donal K. Fellows <[email protected]> * generic/tclThreadStorage.c: Stop exposing the guts of the thread storage system through the internal stubs table. Client code should always use the standard API. 2005-08-05 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclObj.c: Rewrote Tcl_GetDoubleFromObj(). 2005-08-05 Donal K. Fellows <[email protected]> * unix/tclUnixInit.c (localeTable): Solaris uses a non-standard name for the cp1251 charset. Thanks to Victor Wagner for reporting this. [Bug 1252475] |
︙ | ︙ | |||
385 386 387 388 389 390 391 | apparently missing word to complete a sentence. * generic/tclObj.c (Tcl_DbDecrRefCount): Fixed whitespace nit in panic message. 2005-08-04 Don Porter <[email protected]> | | | | 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | apparently missing word to complete a sentence. * generic/tclObj.c (Tcl_DbDecrRefCount): Fixed whitespace nit in panic message. 2005-08-04 Don Porter <[email protected]> [kennykb-numerics-branch] Updated from HEAD * generic/tclObj.c: Rewrote Tcl_GetBooleanFromObj() and supporting routines to make use of TclParseNumber. This reduces the potential number of times a string value must be scanned. * generic/tclObj.c: Simplified routines that manage the typeTable. Deleted the UpdateStringOfBoolean() routine, that can never be called. 2005-08-03 Don Porter <[email protected]> * generic/tclCompExpr.c: Untangled some dependencies in the * generic/tclEvent.c: order of finalization routines. * generic/tclInt.h: [Bug 1251399] * generic/tclObj.c: 2005-08-02 Don Porter <[email protected]> [kennykb-numerics-branch] Updated from HEAD 2005-07-30 Daniel Steffen <[email protected]> * unix/tclLoadDyld.c (TclpDlopen, TclpLoadMemory): workarounds for bugs/changes in behaviour in Mac OS X 10.4 Tiger. 2005-07-29 Donal K. Fellows <[email protected]> |
︙ | ︙ | |||
580 581 582 583 584 585 586 | * win/tclWinSock.c: value returned by Tcl_GetHostName() ([info hostname]). Also re-order initialization of the value on Windows to favor GetComputerName() over gethostname() as a source of the information. 2005-07-12 Kevin Kenny <[email protected]> | | | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | * win/tclWinSock.c: value returned by Tcl_GetHostName() ([info hostname]). Also re-order initialization of the value on Windows to favor GetComputerName() over gethostname() as a source of the information. 2005-07-12 Kevin Kenny <[email protected]> [kennykb-numerics-branch] Updated from HEAD * generic/tclCmdMZ.c (Tcl_StringObjCmd): * generic/tclInt.h: * generic/tclObj.c (Tcl_GetDoubleFromObj, SetDoubleFromAny, Tcl_GetIntFromObj, SetIntOrWideFromAny): * generic/tclStrToD.c (TclParseNumber, etc.): * tclTomMathInterface.c (TclBNInitBignumFromWideUInt): |
︙ | ︙ |
Changes to generic/tclExecute.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * Copyright (c) 2002-2005 by Miguel Sofer. * Copyright (c) 2005 by Donal K. Fellows. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * Copyright (c) 2002-2005 by Miguel Sofer. * Copyright (c) 2005 by Donal K. Fellows. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclExecute.c,v 1.167.2.36 2005/08/24 18:56:32 kennykb Exp $ */ #include "tclInt.h" #include "tclCompile.h" #include "tommath.h" #include <math.h> |
︙ | ︙ | |||
2669 2670 2671 2672 2673 2674 2675 | } } #else /* TODO - consider optimization search for eePtr->constants */ result = Tcl_GetBooleanFromObj(NULL, value2Ptr, &i2); if (result != TCL_OK) { TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(value2Ptr), | | | 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 | } } #else /* TODO - consider optimization search for eePtr->constants */ result = Tcl_GetBooleanFromObj(NULL, value2Ptr, &i2); if (result != TCL_OK) { TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(value2Ptr), (value2Ptr->typePtr? value2Ptr->typePtr->name : "null"))); IllegalExprOperandType(interp, pc, value2Ptr); goto checkForCatch; } #endif /* * Reuse the valuePtr object already on stack if possible. |
︙ | ︙ | |||
5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 | if (result != TCL_OK) { /* Value is NaN */ if (*pc == INST_BITNOT) { /* ~NaN => error; arg must be an integer */ goto error; } /* -NaN => NaN */ NEXT_INST_F(1, 0, 0); } #endif if (valuePtr->typePtr == &tclDoubleType) { if (*pc == INST_BITNOT) { /* ~ arg must be an integer */ result = TCL_ERROR; | > | 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 | if (result != TCL_OK) { /* Value is NaN */ if (*pc == INST_BITNOT) { /* ~NaN => error; arg must be an integer */ goto error; } /* -NaN => NaN */ result = TCL_OK; NEXT_INST_F(1, 0, 0); } #endif if (valuePtr->typePtr == &tclDoubleType) { if (*pc == INST_BITNOT) { /* ~ arg must be an integer */ result = TCL_ERROR; |
︙ | ︙ | |||
5399 5400 5401 5402 5403 5404 5405 | result = TCL_OK; TRACE(("\"%.20s\" => numeric, same Tcl_Obj\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); } /* Non-numeric argument... */ if (*pc == INST_UPLUS) { /* ... +$NonNumeric => raise an error */ | | | 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 | result = TCL_OK; TRACE(("\"%.20s\" => numeric, same Tcl_Obj\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); } /* Non-numeric argument... */ if (*pc == INST_UPLUS) { /* ... +$NonNumeric => raise an error */ TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(valuePtr), (valuePtr->typePtr? valuePtr->typePtr->name : "null"))); IllegalExprOperandType(interp, pc, valuePtr); goto checkForCatch; } else { /* ... TryConvertToNumeric($NonNumeric) is acceptable */ TRACE(("\"%.20s\" => not numeric\n", O2S(valuePtr))); result = TCL_OK; |
︙ | ︙ |
Changes to generic/tclStrToD.c.
1 2 3 | /* *---------------------------------------------------------------------- * | | | | | | < | | > > > > > > > < < < < > > | < < > < < < < < < < < < < | > > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | /* *---------------------------------------------------------------------- * * tclDouble.c -- * * This file contains a collection of procedures for managing * conversions to/from floating-point in Tcl. They include * TclParseNumber, which parses numbers from strings; TclDoubleDigits, * which formats numbers into strings of digits, and procedures for * interconversion among 'double' and 'mp_int' types. * * Copyright (c) 2005 by Kevin B. Kenny. All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclStrToD.c,v 1.1.2.33 2005/08/24 18:56:32 kennykb Exp $ * *---------------------------------------------------------------------- */ #include <tclInt.h> #include <stdio.h> #include <stdlib.h> #include <float.h> #include <limits.h> #include <math.h> #include <ctype.h> #include <tommath.h> /* * Define TIP_114_FORMATS to accept 0b and 0o for binary and octal strings. * Define KILL_OCTAL as well as TIP_114_FORMATS to suppress interpretation * of numbers with leading zero as octal. (Ceterum censeo: numeros octonarios * delendos esse.) */ #define TIP_114_FORMATS #undef KILL_OCTAL /* * This code supports (at least hypothetically), IBM, Cray, VAX and * IEEE-754 floating point; of these, only IEEE-754 can represent NaN. * IEEE-754 can be uniquely determined by radix and by the widths of * significand and exponent. */ #if (FLT_RADIX == 2) && (DBL_MANT_DIG == 53) && (DBL_MAX_EXP == 1024) # define IEEE_FLOATING_POINT #endif /* * gcc on x86 needs access to rounding controls, because of a questionable * feature where it retains intermediate results as IEEE 'long double' values * somewhat unpredictably. It is tempting to include fpu_control.h, but * that file exists only on Linux; it is missing on Cygwin and MinGW. Most * gcc-isms and ix86-isms are factored out here. */ #if defined(__GNUC__) && defined(__i386) typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); #define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw)) #define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw)) # define FPU_IEEE_ROUNDING 0x027f |
︙ | ︙ |
Changes to tests/binary.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # This file tests the tclBinary.c file and the "binary" Tcl command. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1997 by Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # This file tests the tclBinary.c file and the "binary" Tcl command. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1997 by Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # 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.18.2.8 2005/08/24 18:56:32 kennykb Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest namespace import -force ::tcltest::* } ::tcltest::testConstraint bigEndian [expr {$tcl_platform(byteOrder) eq "bigEndian"}] ::tcltest::testConstraint littleEndian [expr {$tcl_platform(byteOrder) eq "littleEndian"}] |
︙ | ︙ | |||
2135 2136 2137 2138 2139 2140 2141 | } } testConstraint ieeeFloatingPoint [testIEEE] # scan/format infinities | | | 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 | } } 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 |
︙ | ︙ | |||
2193 2194 2195 2196 2197 2198 2199 | -constraints ieeeFloatingPoint \ -body { binary scan [binary format w 0x7ff0123456789aBc] q d set d } \ -match glob -result NaN(*123456789abc) | | | | | | | | | | | 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 | -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 } 0.24999999999999997 test binary-65.2 {smallest significand} ieeeFloatingPoint { binary scan [binary format w 0x3fd0000000000000] q d set d } 0.25 test binary-65.3 {largest significand} ieeeFloatingPoint { binary scan [binary format w 0x3fdfffffffffffff] q d set d } 0.49999999999999994 test binary-65.4 {smallest significand} ieeeFloatingPoint { binary scan [binary format w 0x3fe0000000000000] q d set d } 0.5 test binary-65.5 {largest significand} ieeeFloatingPoint { binary scan [binary format w 0x3fffffffffffffff] q d set d } 1.9999999999999998 test binary-65.6 {smallest significand} ieeeFloatingPoint { binary scan [binary format w 0x4000000000000000] q d set d } 2.0 test binary-65.7 {smallest significand} ieeeFloatingPoint { binary scan [binary format w 0x434fffffffffffff] q d set d } 18014398509481982.0 test binary-65.8 {largest significand} ieeeFloatingPoint { binary scan [binary format w 0x4350000000000000] q d set d } 18014398509481984.0 test binary-65.8 {largest significand} ieeeFloatingPoint { binary scan [binary format w 0x4350000000000001] q d set d } 18014398509481988.0 # cleanup ::tcltest::cleanupTests return # Local Variables: # mode: tcl # End: |
Changes to tests/expr.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # Commands covered: expr # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1996-1997 Sun Microsystems, Inc. # Copyright (c) 1998-2000 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Commands covered: expr # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1996-1997 Sun Microsystems, Inc. # Copyright (c) 1998-2000 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: expr.test,v 1.30.2.22 2005/08/24 18:56:32 kennykb Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.1 namespace import -force ::tcltest::* } testConstraint testmathfunctions [expr { |
︙ | ︙ | |||
6692 6693 6694 6695 6696 6697 6698 | test expr-45.6 {entier} { expr entier(1e+22) } 10000000000000000000000 test expr-45.7 {entier} { list [catch {expr entier(Inf)} result] $result } {1 {integer value too large to represent}} test expr-45.8 {entier} ieeeFloatingPoint { | | | | 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 | test expr-45.6 {entier} { expr entier(1e+22) } 10000000000000000000000 test expr-45.7 {entier} { list [catch {expr entier(Inf)} result] $result } {1 {integer value too large to represent}} test expr-45.8 {entier} ieeeFloatingPoint { list [catch {expr {entier($ieeeValues(NaN))}} result] $result } {1 {floating point value is Not a Number}} test expr-45.9 {entier} ieeeFloatingPoint { list [catch {expr {entier($ieeeValues(-NaN))}} result] $result } {1 {floating point value is Not a Number}} # cleanup if {[info exists a]} { unset a } catch {unset min} |
︙ | ︙ |