aboutsummaryrefslogtreecommitdiffstats
path: root/src/floatfns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/floatfns.c')
-rw-r--r--src/floatfns.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index 7c52a0a9a20..ea9000b90a0 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -210,29 +210,7 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
210 /* Common Lisp spec: don't promote if both are integers, and if the 210 /* Common Lisp spec: don't promote if both are integers, and if the
211 result is not fractional. */ 211 result is not fractional. */
212 if (INTEGERP (arg1) && NATNUMP (arg2)) 212 if (INTEGERP (arg1) && NATNUMP (arg2))
213 { 213 return expt_integer (arg1, arg2);
214 unsigned long exp;
215 if (TYPE_RANGED_FIXNUMP (unsigned long, arg2))
216 exp = XFIXNUM (arg2);
217 else if (MOST_POSITIVE_FIXNUM < ULONG_MAX && BIGNUMP (arg2)
218 && mpz_fits_ulong_p (XBIGNUM (arg2)->value))
219 exp = mpz_get_ui (XBIGNUM (arg2)->value);
220 else
221 xsignal3 (Qrange_error, build_string ("expt"), arg1, arg2);
222
223 mpz_t val;
224 mpz_init (val);
225 if (FIXNUMP (arg1))
226 {
227 mpz_set_intmax (val, XFIXNUM (arg1));
228 mpz_pow_ui (val, val, exp);
229 }
230 else
231 mpz_pow_ui (val, XBIGNUM (arg1)->value, exp);
232 Lisp_Object res = make_number (val);
233 mpz_clear (val);
234 return res;
235 }
236 214
237 return make_float (pow (XFLOATINT (arg1), XFLOATINT (arg2))); 215 return make_float (pow (XFLOATINT (arg1), XFLOATINT (arg2)));
238} 216}