Mercurial > emacs
comparison src/floatfns.c @ 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 | 6741f5f8ed54 |
children | e94a593c3952 |
comparison
equal
deleted
inserted
replaced
2204:41258d6c3eee | 2205:c021f53fe7e5 |
---|---|
52 Lisp_Object Qarith_error; | 52 Lisp_Object Qarith_error; |
53 | 53 |
54 #ifdef LISP_FLOAT_TYPE | 54 #ifdef LISP_FLOAT_TYPE |
55 | 55 |
56 #include <math.h> | 56 #include <math.h> |
57 | |
58 /* These declarations are omitted on some systems, like Ultrix. */ | |
59 extern double logb (); | |
57 | 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 |
61 # define HAVE_MATHERR | 64 # define HAVE_MATHERR |
618 "Returns the integer not greater than the base 2 log of the magnitude of ARG.\n\ | 621 "Returns the integer not greater than the base 2 log of the magnitude of ARG.\n\ |
619 This is the same as the exponent of a float.") | 622 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); |
640 #endif | |
641 | |
632 return val; | 642 return val; |
633 #endif | |
634 } | 643 } |
635 | 644 |
636 /* the rounding functions */ | 645 /* the rounding functions */ |
637 | 646 |
638 DEFUN ("ceiling", Fceiling, Sceiling, 1, 1, 0, | 647 DEFUN ("ceiling", Fceiling, Sceiling, 1, 1, 0, |