comparison src/floatfns.c @ 2039:fd0cbe945410

[xemacs-hg @ 2004-04-22 03:24:00 by james] Change VALBITS to INT_VALBITS in a number of places.
author james
date Thu, 22 Apr 2004 03:24:02 +0000
parents 4e6a63799f08
children 471242c84954
comparison
equal deleted inserted replaced
2038:c6190a5b1ece 2039:fd0cbe945410
126 { 126 {
127 #ifdef HAVE_BIGNUM 127 #ifdef HAVE_BIGNUM
128 bignum_set_double (scratch_bignum, x); 128 bignum_set_double (scratch_bignum, x);
129 return Fcanonicalize_number (make_bignum_bg (scratch_bignum)); 129 return Fcanonicalize_number (make_bignum_bg (scratch_bignum));
130 #else 130 #else
131 if (x >= ((EMACS_INT) 1 << (VALBITS-1)) 131 REGISTER EMACS_INT result = (EMACS_INT) x;
132 || x <= - ((EMACS_INT) 1 << (VALBITS-1)) - (EMACS_INT) 1) 132
133 { 133 if (result > EMACS_INT_MAX || result < EMACS_INT_MIN)
134 if (!UNBOUNDP (num2)) 134 {
135 range_error2 (name, num, num2); 135 if (!UNBOUNDP (num2))
136 else 136 range_error2 (name, num, num2);
137 range_error (name, num); 137 else
138 } 138 range_error (name, num);
139 return (make_int ((EMACS_INT) x)); 139 }
140 return make_int (result);
140 #endif /* HAVE_BIGNUM */ 141 #endif /* HAVE_BIGNUM */
141 } 142 }
142 143
143 144
144 static void 145 static void
796 (number)) 797 (number))
797 { 798 {
798 double f = extract_float (number); 799 double f = extract_float (number);
799 800
800 if (f == 0.0) 801 if (f == 0.0)
801 return make_int (- (EMACS_INT)(((EMACS_UINT) 1) << (VALBITS - 1))); /* most-negative-fixnum */ 802 return make_int (EMACS_INT_MIN);
802 #ifdef HAVE_LOGB 803 #ifdef HAVE_LOGB
803 { 804 {
804 Lisp_Object val; 805 Lisp_Object val;
805 IN_FLOAT (val = make_int ((EMACS_INT) logb (f)), "logb", number); 806 IN_FLOAT (val = make_int ((EMACS_INT) logb (f)), "logb", number);
806 return val; 807 return val;