Mercurial > cpython-lru_cache-weakref
diff Objects/floatobject.c @ 496:0ac392b7f76e legacy-trunk
Explicitly check for weird values after calling pow().
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 16 Dec 1991 15:43:14 +0000 |
| parents | a1025cbba30d |
| children | 0c1938f2e0c0 |
line wrap: on
line diff
--- a/Objects/floatobject.c Mon Dec 16 15:42:38 1991 +0000 +++ b/Objects/floatobject.c Mon Dec 16 15:43:14 1991 +0000 @@ -37,6 +37,14 @@ #include <ctype.h> #include <math.h> +#ifdef HUGE_VAL +#define CHECK(x) if (errno != 0) ; \ + else if (-HUGE_VAL <= (x) && (x) <= HUGE_VAL) ; \ + else errno = ERANGE +#else +#define CHECK(x) /* Don't know how to check */ +#endif + #ifndef THINK_C extern double fmod PROTO((double, double)); extern double pow PROTO((double, double)); @@ -262,6 +270,7 @@ } errno = 0; ix = pow(iv, iw); + CHECK(ix); if (errno != 0) { /* XXX could it be another type of error? */ err_errno(OverflowError);
