XEmacs 21.4.17 "Jumbo Shrimp".
[chise/xemacs-chise.git.1] / src / floatfns.c
index de0c407..0a1d9ab 100644 (file)
@@ -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;