Tcl Source Code

Check-in [ecd2f01ba8]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:
[kennykb_numerics_branch]
* generic/tclExecute.c: Bug fix: TclBignumToDouble return -Inf when appropriate. Removed declarations of removed routines.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | kennykb-numerics-branch
Files: files | file ages | folders
SHA1: ecd2f01ba8143b2b228fc50bb19a12ad18d0c922
User & Date: dgp 2005-08-24 18:51:36
Context
2005-08-24
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
18:03
Corrections in comparisons with +/-Inf. check-in: b303293aa3 user: dgp tags: kennykb-numerics-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.

1
2
3



4
5
6
7
8
9
10
2005-08-24  Don Porter  <[email protected]>

	[kennykb_numerics_branch]




	* 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]>



>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
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]>

Changes to generic/tclStrToD.c.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
....
2222
2223
2224
2225
2226
2227
2228

2229



2230
2231
2232
2233
2234
2235
2236
 *	'double' and the integer 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.31 2005/08/24 02:35:47 dgp Exp $
 *
 *----------------------------------------------------------------------
 */

#include <tclInt.h>
#include <stdio.h>
#include <stdlib.h>
................................................................................
						   mp_int* significand,
						   int nSigDigs,
						   int exponent));
static double MakeNaN _ANSI_ARGS_(( int signum, Tcl_WideUInt tag ));
static double RefineApproximation _ANSI_ARGS_((double approx,
					       mp_int* exactSignificand,
					       int exponent));
static double RefineResult _ANSI_ARGS_((double approx, CONST char* start,
					int nDigits, long exponent));
static double ParseNaN _ANSI_ARGS_(( int signum, CONST char** end ));
static double BignumToBiasedFrExp _ANSI_ARGS_(( mp_int* big, int* machexp ));
static double Pow10TimesFrExp _ANSI_ARGS_(( int exponent,
					    double fraction,
					    int* machexp ));
static double SafeLdExp _ANSI_ARGS_(( double fraction, int exponent ));

 
................................................................................
     * Determine how many bits we need, and extract that many from the input.
     * Round to nearest unit in the last place.
     */

    bits = mp_count_bits(a);
    if (bits > DBL_MAX_EXP*log2FLT_RADIX) {
	errno = ERANGE;

	return HUGE_VAL;



    }
    shift = mantBits + 1 - bits;
    mp_init(&b);
    if (shift > 0) {
	mp_mul_2d(a, shift, &b);
    } else if (shift < 0) {
	mp_div_2d(a, -shift, &b, NULL);






|







 







<
<
<







 







>
|
>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
156
157
158
159
160
161
162



163
164
165
166
167
168
169
....
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
 *	'double' and the integer 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.32 2005/08/24 18:51:36 dgp Exp $
 *
 *----------------------------------------------------------------------
 */

#include <tclInt.h>
#include <stdio.h>
#include <stdlib.h>
................................................................................
						   mp_int* significand,
						   int nSigDigs,
						   int exponent));
static double MakeNaN _ANSI_ARGS_(( int signum, Tcl_WideUInt tag ));
static double RefineApproximation _ANSI_ARGS_((double approx,
					       mp_int* exactSignificand,
					       int exponent));



static double BignumToBiasedFrExp _ANSI_ARGS_(( mp_int* big, int* machexp ));
static double Pow10TimesFrExp _ANSI_ARGS_(( int exponent,
					    double fraction,
					    int* machexp ));
static double SafeLdExp _ANSI_ARGS_(( double fraction, int exponent ));

 
................................................................................
     * Determine how many bits we need, and extract that many from the input.
     * Round to nearest unit in the last place.
     */

    bits = mp_count_bits(a);
    if (bits > DBL_MAX_EXP*log2FLT_RADIX) {
	errno = ERANGE;
	if (a->sign == MP_ZPOS) {
	    return HUGE_VAL;
	} else {
	    return -HUGE_VAL;
	}
    }
    shift = mantBits + 1 - bits;
    mp_init(&b);
    if (shift > 0) {
	mp_mul_2d(a, shift, &b);
    } else if (shift < 0) {
	mp_div_2d(a, -shift, &b, NULL);