# HG changeset patch # User Jim Blandy # Date 732226627 0 # Node ID c021f53fe7e5be3d92d8435f0f4259cddf042b2c # Parent 41258d6c3eeebeb228362d6ff5fe54b552c7f6a9 * floatfns.c (logb): Add extern declaration for this. * floatfns.c (Flogb): Under SYSV, implement this using frexp. diff -r 41258d6c3eee -r c021f53fe7e5 src/floatfns.c --- 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 +/* 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 */