diff options
| author | Jim Blandy | 1993-03-15 20:17:07 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-03-15 20:17:07 +0000 |
| commit | c26406fef27bf84e38a2222f41cd464b33cdeee0 (patch) | |
| tree | 57edd2a2ab95afb5e838baae13b02a1be711e434 /src | |
| parent | 6758394b091d4576f9a28b4e5e5680b4a0f5aa61 (diff) | |
| download | emacs-c26406fef27bf84e38a2222f41cd464b33cdeee0.tar.gz emacs-c26406fef27bf84e38a2222f41cd464b33cdeee0.zip | |
* floatfns.c (logb): Add extern declaration for this.
* floatfns.c (Flogb): Under SYSV, implement this using frexp.
Diffstat (limited to 'src')
| -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; | |||
| 55 | 55 | ||
| 56 | #include <math.h> | 56 | #include <math.h> |
| 57 | 57 | ||
| 58 | /* These declarations are omitted on some systems, like Ultrix. */ | ||
| 59 | extern 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 */ |