aboutsummaryrefslogtreecommitdiffstats
path: root/src/floatfns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/floatfns.c')
-rw-r--r--src/floatfns.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index 1235dad2f86..8dd3fdc7bd4 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -55,6 +55,9 @@ Lisp_Object Qarith_error;
55 55
56#include <math.h> 56#include <math.h>
57 57
58/* These declarations are omitted on some systems, like Ultrix. */
59extern double logb ();
60
58#if defined(DOMAIN) && defined(SING) && defined(OVERFLOW) 61#if defined(DOMAIN) && defined(SING) && defined(OVERFLOW)
59 /* If those are defined, then this is probably a `matherr' machine. */ 62 /* If those are defined, then this is probably a `matherr' machine. */
60# ifndef HAVE_MATHERR 63# ifndef HAVE_MATHERR
@@ -620,17 +623,23 @@ This is the same as the exponent of a float.")
620 (arg) 623 (arg)
621 Lisp_Object arg; 624 Lisp_Object arg;
622{ 625{
623#ifdef USG
624 error ("SYSV apparently doesn't have a logb function; what to do?");
625#else
626 Lisp_Object val; 626 Lisp_Object val;
627 int value; 627 int value;
628 double f = extract_float (arg); 628 double f = extract_float (arg);
629 629
630#ifdef USG
631 {
632 int exp;
633
634 IN_FLOAT (frexp (f, &exp), "logb", arg);
635 XSET (val, Lisp_Int, exp-1);
636 }
637#else
630 IN_FLOAT (value = logb (f), "logb", arg); 638 IN_FLOAT (value = logb (f), "logb", arg);
631 XSET (val, Lisp_Int, value); 639 XSET (val, Lisp_Int, value);
632 return val;
633#endif 640#endif
641
642 return val;
634} 643}
635 644
636/* the rounding functions */ 645/* the rounding functions */