diff options
Diffstat (limited to 'src/floatfns.c')
| -rw-r--r-- | src/floatfns.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/floatfns.c b/src/floatfns.c index af82df0bf5d..96a89337c75 100644 --- a/src/floatfns.c +++ b/src/floatfns.c | |||
| @@ -70,7 +70,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 70 | 70 | ||
| 71 | /* This declaration is omitted on some systems, like Ultrix. */ | 71 | /* This declaration is omitted on some systems, like Ultrix. */ |
| 72 | #if !defined (HPUX) && defined (HAVE_LOGB) && !defined (logb) | 72 | #if !defined (HPUX) && defined (HAVE_LOGB) && !defined (logb) |
| 73 | extern double logb (); | 73 | extern double logb (double); |
| 74 | #endif /* not HPUX and HAVE_LOGB and no logb macro */ | 74 | #endif /* not HPUX and HAVE_LOGB and no logb macro */ |
| 75 | 75 | ||
| 76 | #if defined(DOMAIN) && defined(SING) && defined(OVERFLOW) | 76 | #if defined(DOMAIN) && defined(SING) && defined(OVERFLOW) |
| @@ -778,11 +778,10 @@ This is the same as the exponent of a float. */) | |||
| 778 | /* the rounding functions */ | 778 | /* the rounding functions */ |
| 779 | 779 | ||
| 780 | static Lisp_Object | 780 | static Lisp_Object |
| 781 | rounding_driver (arg, divisor, double_round, int_round2, name) | 781 | rounding_driver (Lisp_Object arg, Lisp_Object divisor, |
| 782 | register Lisp_Object arg, divisor; | 782 | double (*double_round) (double), |
| 783 | double (*double_round) (); | 783 | EMACS_INT (*int_round2) (EMACS_INT, EMACS_INT), |
| 784 | EMACS_INT (*int_round2) (); | 784 | char *name) |
| 785 | char *name; | ||
| 786 | { | 785 | { |
| 787 | CHECK_NUMBER_OR_FLOAT (arg); | 786 | CHECK_NUMBER_OR_FLOAT (arg); |
| 788 | 787 | ||
| @@ -832,8 +831,7 @@ rounding_driver (arg, divisor, double_round, int_round2, name) | |||
| 832 | integer functions. */ | 831 | integer functions. */ |
| 833 | 832 | ||
| 834 | static EMACS_INT | 833 | static EMACS_INT |
| 835 | ceiling2 (i1, i2) | 834 | ceiling2 (EMACS_INT i1, EMACS_INT i2) |
| 836 | EMACS_INT i1, i2; | ||
| 837 | { | 835 | { |
| 838 | return (i2 < 0 | 836 | return (i2 < 0 |
| 839 | ? (i1 < 0 ? ((-1 - i1) / -i2) + 1 : - (i1 / -i2)) | 837 | ? (i1 < 0 ? ((-1 - i1) / -i2) + 1 : - (i1 / -i2)) |
| @@ -841,8 +839,7 @@ ceiling2 (i1, i2) | |||
| 841 | } | 839 | } |
| 842 | 840 | ||
| 843 | static EMACS_INT | 841 | static EMACS_INT |
| 844 | floor2 (i1, i2) | 842 | floor2 (EMACS_INT i1, EMACS_INT i2) |
| 845 | EMACS_INT i1, i2; | ||
| 846 | { | 843 | { |
| 847 | return (i2 < 0 | 844 | return (i2 < 0 |
| 848 | ? (i1 <= 0 ? -i1 / -i2 : -1 - ((i1 - 1) / -i2)) | 845 | ? (i1 <= 0 ? -i1 / -i2 : -1 - ((i1 - 1) / -i2)) |
| @@ -850,8 +847,7 @@ floor2 (i1, i2) | |||
| 850 | } | 847 | } |
| 851 | 848 | ||
| 852 | static EMACS_INT | 849 | static EMACS_INT |
| 853 | truncate2 (i1, i2) | 850 | truncate2 (EMACS_INT i1, EMACS_INT i2) |
| 854 | EMACS_INT i1, i2; | ||
| 855 | { | 851 | { |
| 856 | return (i2 < 0 | 852 | return (i2 < 0 |
| 857 | ? (i1 < 0 ? -i1 / -i2 : - (i1 / -i2)) | 853 | ? (i1 < 0 ? -i1 / -i2 : - (i1 / -i2)) |
| @@ -859,8 +855,7 @@ truncate2 (i1, i2) | |||
| 859 | } | 855 | } |
| 860 | 856 | ||
| 861 | static EMACS_INT | 857 | static EMACS_INT |
| 862 | round2 (i1, i2) | 858 | round2 (EMACS_INT i1, EMACS_INT i2) |
| 863 | EMACS_INT i1, i2; | ||
| 864 | { | 859 | { |
| 865 | /* The C language's division operator gives us one remainder R, but | 860 | /* The C language's division operator gives us one remainder R, but |
| 866 | we want the remainder R1 on the other side of 0 if R1 is closer | 861 | we want the remainder R1 on the other side of 0 if R1 is closer |
| @@ -880,16 +875,14 @@ round2 (i1, i2) | |||
| 880 | #define emacs_rint rint | 875 | #define emacs_rint rint |
| 881 | #else | 876 | #else |
| 882 | static double | 877 | static double |
| 883 | emacs_rint (d) | 878 | emacs_rint (double d) |
| 884 | double d; | ||
| 885 | { | 879 | { |
| 886 | return floor (d + 0.5); | 880 | return floor (d + 0.5); |
| 887 | } | 881 | } |
| 888 | #endif | 882 | #endif |
| 889 | 883 | ||
| 890 | static double | 884 | static double |
| 891 | double_identity (d) | 885 | double_identity (double d) |
| 892 | double d; | ||
| 893 | { | 886 | { |
| 894 | return d; | 887 | return d; |
| 895 | } | 888 | } |