changeset 2205:c021f53fe7e5

* floatfns.c (logb): Add extern declaration for this. * floatfns.c (Flogb): Under SYSV, implement this using frexp.
author Jim Blandy <jimb@redhat.com>
date Mon, 15 Mar 1993 20:17:07 +0000
parents 41258d6c3eee
children c3bec907580c
files src/floatfns.c
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/floatfns.c	Mon Mar 15 19:36:54 1993 +0000
+++ b/src/floatfns.c	Mon Mar 15 20:17:07 1993 +0000
@@ -55,6 +55,9 @@
 
 #include <math.h>
 
+/* These declarations are omitted on some systems, like Ultrix.  */
+extern double logb ();
+
 #if defined(DOMAIN) && defined(SING) && defined(OVERFLOW)
     /* If those are defined, then this is probably a `matherr' machine. */
 # ifndef HAVE_MATHERR
@@ -620,17 +623,23 @@
      (arg)
      Lisp_Object arg;
 {
-#ifdef USG
-  error ("SYSV apparently doesn't have a logb function; what to do?");
-#else
   Lisp_Object val;
   int value;
   double f = extract_float (arg);
 
+#ifdef USG
+  {
+    int exp;  
+
+    IN_FLOAT (frexp (f, &exp), "logb", arg);
+    XSET (val, Lisp_Int, exp-1);
+  }
+#else
   IN_FLOAT (value = logb (f), "logb", arg);
   XSET (val, Lisp_Int, value);
+#endif
+
   return val;
-#endif
 }
 
 /* the rounding functions  */