X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Ffloatfns.c;h=0a1d9abea87558418ed3c78a6205e1340c865acb;hb=3f46c5336cd2a7c388b4ebba6b3e575e2b71cc86;hp=de0c407c034b64c76f278f62511448a5cce149cc;hpb=98a6e4055a1fa624c592ac06f79287d55196ca37;p=chise%2Fxemacs-chise.git.1 diff --git a/src/floatfns.c b/src/floatfns.c index de0c407..0a1d9ab 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -128,15 +128,16 @@ static const char *float_error_fn_name; static Lisp_Object float_to_int (double x, const char *name, Lisp_Object num, Lisp_Object num2) { - if (x >= ((EMACS_INT) 1 << (VALBITS-1)) - || x <= - ((EMACS_INT) 1 << (VALBITS-1)) - (EMACS_INT) 1) - { - if (!UNBOUNDP (num2)) - range_error2 (name, num, num2); - else - range_error (name, num); - } - return (make_int ((EMACS_INT) x)); + REGISTER EMACS_INT result = (EMACS_INT) x; + + if (result > EMACS_INT_MAX || result < EMACS_INT_MIN) + { + if (!UNBOUNDP (num2)) + range_error2 (name, num, num2); + else + range_error (name, num); + } + return make_int (result); } @@ -708,7 +709,7 @@ This is the same as the exponent of a float. double f = extract_float (number); if (f == 0.0) - return make_int (- (EMACS_INT)(((EMACS_UINT) 1) << (VALBITS - 1))); /* most-negative-fixnum */ + return make_int (EMACS_INT_MIN); #ifdef HAVE_LOGB { Lisp_Object val;