diff options
| author | Jim Blandy <jimb@redhat.com> | 1993-03-15 20:17:07 +0000 |
|---|---|---|
| committer | Jim Blandy <jimb@redhat.com> | 1993-03-15 20:17:07 +0000 |
| commit | c26406fef27bf84e38a2222f41cd464b33cdeee0 (patch) | |
| tree | 57edd2a2ab95afb5e838baae13b02a1be711e434 /src/floatfns.c | |
| parent | 6758394b091d4576f9a28b4e5e5680b4a0f5aa61 (diff) | |
| download | emacs-c26406fef27bf84e38a2222f41cd464b33cdeee0.tar.gz | |
* floatfns.c (logb): Add extern declaration for this.
* floatfns.c (Flogb): Under SYSV, implement this using frexp.
Diffstat (limited to 'src/floatfns.c')
| -rw-r--r-- | src/floatfns.c | 17 |
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; #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 @@ This is the same as the exponent of a float.") (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); - return val; #endif + + return val; } /* the rounding functions */ |
