summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-09 22:28:42 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-09 22:28:42 +0000
commitd5fde88a3b2b1e1c8f27e1cbccd7fdafe82a4d84 (patch)
treec2aa80d7fdd9598fcd612e59d6373f97b893dc21 /util.c
parent4ced21cf18d5d85337a1bfcd4d7626b82ac0ae08 (diff)
downloadruby-d5fde88a3b2b1e1c8f27e1cbccd7fdafe82a4d84.tar.gz
ruby-d5fde88a3b2b1e1c8f27e1cbccd7fdafe82a4d84.tar.xz
ruby-d5fde88a3b2b1e1c8f27e1cbccd7fdafe82a4d84.zip
* eval.c (rb_load): put rb_load_file() in a thread critical
section. [ruby-dev:20490] * eval.c (compile): put rb_compile_string() in a thread critical section. * variable.c (rb_const_get_0): should not warn if constant is not defined. (ruby-bugs-ja PR#509) * bignum.c (rb_big2dbl): give a warning on overflow. (ruby-bugs-ja PR#510) * util.c (ruby_strtod): change MDMAXEXPT from 511 to 308. * pack.c (utf8_to_uv): long is sufficient. LONG_LONG is not required. * bignum.c (rb_big2str): support 32 bit (without `long long' type) machines. (ruby-bugs-ja PR#512) git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
-rw-r--r--util.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/util.c b/util.c
index 9a3ce69c2..ae2bc8de9 100644
--- a/util.c
+++ b/util.c
@@ -665,11 +665,8 @@ ruby_getcwd()
#define TRUE 1
#define FALSE 0
-static int maxExponent = 511; /* Largest possible base 10 exponent. Any
- * exponent larger than this will already
- * produce underflow or overflow, so there's
- * no need to worry about additional digits.
- */
+static int MDMINEXPT = -323;
+static int MDMAXEXPT = 309;
static double powersOf10[] = { /* Table giving binary powers of 10. Entry */
10.0, /* is 10^2^i. Used to convert decimal */
100.0, /* exponents into floating-point numbers. */
@@ -862,12 +859,12 @@ ruby_strtod(string, endPtr)
* fraction.
*/
- if (exp > maxExponent) {
- exp = maxExponent;
+ if (exp > MDMAXEXPT - 18) {
+ exp = MDMAXEXPT;
errno = ERANGE;
}
- else if (exp < -maxExponent) {
- exp = -maxExponent;
+ else if (exp < MDMINEXPT + 18) {
+ exp = MDMINEXPT;
errno = ERANGE;
}
fracExp = exp;