17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include "tclTomMath.h"
#include <float.h>
#include <math.h>
#ifdef _WIN32
#define copysign _copysign
#endif
/*
* 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.
*/
|
>
>
>
>
>
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include "tclTomMath.h"
#include <float.h>
#include <math.h>
#ifdef _WIN32
#define copysign _copysign
#endif
#ifndef PRIx64
# define PRIx64 TCL_LL_MODIFIER "x"
#endif
/*
* 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.
*/
|
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
|
case ZERO_B:
zerob:
if (c == '0') {
numTrailZeros++;
under = 0;
state = BINARY;
break;
} else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
/* Ignore numeric "white space" */
under = 1;
break;
} else if (c != '1') {
goto endgame;
}
if (objPtr != NULL) {
shift = numTrailZeros + 1;
if (!significandOverflow) {
/*
* Shifting by more bits than are in the value being
* shifted is at least de facto nonportable. Check for too
|
|
|
|
|
>
>
|
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
|
case ZERO_B:
zerob:
if (c == '0') {
numTrailZeros++;
under = 0;
state = BINARY;
break;
} else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
/* Ignore numeric "white space" */
under = 1;
break;
} else if (c != '1') {
goto endgame;
} else {
under = 0;
}
if (objPtr != NULL) {
shift = numTrailZeros + 1;
if (!significandOverflow) {
/*
* Shifting by more bits than are in the value being
* shifted is at least de facto nonportable. Check for too
|
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
|
break;
case ZERO_D:
if (c == '0') {
under = 0;
numTrailZeros++;
} else if ( ! isdigit(UCHAR(c))) {
if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
/* Ignore numeric "white space" */
under = 1;
break;
}
goto endgame;
}
under = 0;
state = DECIMAL;
flags |= TCL_PARSE_INTEGER_ONLY;
/* FALLTHROUGH */
|
|
|
|
|
|
|
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
|
break;
case ZERO_D:
if (c == '0') {
under = 0;
numTrailZeros++;
} else if ( ! isdigit(UCHAR(c))) {
if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
/* Ignore numeric "white space" */
under = 1;
break;
}
goto endgame;
}
under = 0;
state = DECIMAL;
flags |= TCL_PARSE_INTEGER_ONLY;
/* FALLTHROUGH */
|