aboutsummaryrefslogtreecommitdiffstats
path: root/src/floatfns.c
diff options
context:
space:
mode:
authorTom Tromey2018-07-08 00:10:54 -0600
committerTom Tromey2018-07-12 22:12:28 -0600
commitcca0e79ea81712786f92a6668c61001e60d24f32 (patch)
tree484932514b6ec9f21a623363f441bd862064353e /src/floatfns.c
parent3dea8f8f53f81a1d15a55c9e3c87a7eade7ca273 (diff)
downloademacs-cca0e79ea81712786f92a6668c61001e60d24f32.tar.gz
emacs-cca0e79ea81712786f92a6668c61001e60d24f32.zip
Make logb handle bignums
* src/floatfns.c (Flogb): Handle bignums. * test/src/floatfns-tests.el (bignum-logb): New test.
Diffstat (limited to 'src/floatfns.c')
-rw-r--r--src/floatfns.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index 6d7fc1452d3..9a5f0a3ad2f 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -328,7 +328,7 @@ This is the same as the exponent of a float. */)
328 (Lisp_Object arg) 328 (Lisp_Object arg)
329{ 329{
330 EMACS_INT value; 330 EMACS_INT value;
331 CHECK_FIXNUM_OR_FLOAT (arg); 331 CHECK_NUMBER (arg);
332 332
333 if (FLOATP (arg)) 333 if (FLOATP (arg))
334 { 334 {
@@ -345,8 +345,11 @@ This is the same as the exponent of a float. */)
345 else 345 else
346 value = MOST_POSITIVE_FIXNUM; 346 value = MOST_POSITIVE_FIXNUM;
347 } 347 }
348 else if (BIGNUMP (arg))
349 value = mpz_sizeinbase (XBIGNUM (arg)->value, 2) - 1;
348 else 350 else
349 { 351 {
352 eassert (FIXNUMP (arg));
350 EMACS_INT i = eabs (XINT (arg)); 353 EMACS_INT i = eabs (XINT (arg));
351 value = (i == 0 354 value = (i == 0
352 ? MOST_NEGATIVE_FIXNUM 355 ? MOST_NEGATIVE_FIXNUM