Mercurial > emacs
comparison src/floatfns.c @ 27727:9400865ec7cf
Remove `LISP_FLOAT_TYPE' and `standalone'.
| author | Gerd Moellmann <gerd@gnu.org> |
|---|---|
| date | Thu, 17 Feb 2000 09:45:46 +0000 |
| parents | b7aa6ac26872 |
| children | e19d38e14720 |
comparison
equal
deleted
inserted
replaced
| 27726:9627810a3fed | 27727:9400865ec7cf |
|---|---|
| 46 | 46 |
| 47 #include <config.h> | 47 #include <config.h> |
| 48 #include <signal.h> | 48 #include <signal.h> |
| 49 #include "lisp.h" | 49 #include "lisp.h" |
| 50 #include "syssignal.h" | 50 #include "syssignal.h" |
| 51 | |
| 52 #ifdef LISP_FLOAT_TYPE | |
| 53 | 51 |
| 54 #if STDC_HEADERS | 52 #if STDC_HEADERS |
| 55 #include <float.h> | 53 #include <float.h> |
| 56 #endif | 54 #endif |
| 57 | 55 |
| 715 } | 713 } |
| 716 XSETINT (val, value); | 714 XSETINT (val, value); |
| 717 return val; | 715 return val; |
| 718 } | 716 } |
| 719 | 717 |
| 720 #endif /* LISP_FLOAT_TYPE */ | |
| 721 | |
| 722 | 718 |
| 723 /* the rounding functions */ | 719 /* the rounding functions */ |
| 724 | 720 |
| 725 static Lisp_Object | 721 static Lisp_Object |
| 726 rounding_driver (arg, divisor, double_round, int_round2, name) | 722 rounding_driver (arg, divisor, double_round, int_round2, name) |
| 735 { | 731 { |
| 736 EMACS_INT i1, i2; | 732 EMACS_INT i1, i2; |
| 737 | 733 |
| 738 CHECK_NUMBER_OR_FLOAT (divisor, 1); | 734 CHECK_NUMBER_OR_FLOAT (divisor, 1); |
| 739 | 735 |
| 740 #ifdef LISP_FLOAT_TYPE | |
| 741 if (FLOATP (arg) || FLOATP (divisor)) | 736 if (FLOATP (arg) || FLOATP (divisor)) |
| 742 { | 737 { |
| 743 double f1, f2; | 738 double f1, f2; |
| 744 | 739 |
| 745 f1 = FLOATP (arg) ? XFLOAT_DATA (arg) : XINT (arg); | 740 f1 = FLOATP (arg) ? XFLOAT_DATA (arg) : XINT (arg); |
| 749 | 744 |
| 750 IN_FLOAT2 (f1 = (*double_round) (f1 / f2), name, arg, divisor); | 745 IN_FLOAT2 (f1 = (*double_round) (f1 / f2), name, arg, divisor); |
| 751 FLOAT_TO_INT2 (f1, arg, name, arg, divisor); | 746 FLOAT_TO_INT2 (f1, arg, name, arg, divisor); |
| 752 return arg; | 747 return arg; |
| 753 } | 748 } |
| 754 #endif | |
| 755 | 749 |
| 756 i1 = XINT (arg); | 750 i1 = XINT (arg); |
| 757 i2 = XINT (divisor); | 751 i2 = XINT (divisor); |
| 758 | 752 |
| 759 if (i2 == 0) | 753 if (i2 == 0) |
| 761 | 755 |
| 762 XSETINT (arg, (*int_round2) (i1, i2)); | 756 XSETINT (arg, (*int_round2) (i1, i2)); |
| 763 return arg; | 757 return arg; |
| 764 } | 758 } |
| 765 | 759 |
| 766 #ifdef LISP_FLOAT_TYPE | |
| 767 if (FLOATP (arg)) | 760 if (FLOATP (arg)) |
| 768 { | 761 { |
| 769 double d; | 762 double d; |
| 770 | 763 |
| 771 IN_FLOAT (d = (*double_round) (XFLOAT_DATA (arg)), name, arg); | 764 IN_FLOAT (d = (*double_round) (XFLOAT_DATA (arg)), name, arg); |
| 772 FLOAT_TO_INT (d, arg, name, arg); | 765 FLOAT_TO_INT (d, arg, name, arg); |
| 773 } | 766 } |
| 774 #endif | |
| 775 | 767 |
| 776 return arg; | 768 return arg; |
| 777 } | 769 } |
| 778 | 770 |
| 779 /* With C's /, the result is implementation-defined if either operand | 771 /* With C's /, the result is implementation-defined if either operand |
| 879 { | 871 { |
| 880 return rounding_driver (arg, divisor, double_identity, truncate2, | 872 return rounding_driver (arg, divisor, double_identity, truncate2, |
| 881 "truncate"); | 873 "truncate"); |
| 882 } | 874 } |
| 883 | 875 |
| 884 #ifdef LISP_FLOAT_TYPE | |
| 885 | 876 |
| 886 Lisp_Object | 877 Lisp_Object |
| 887 fmod_float (x, y) | 878 fmod_float (x, y) |
| 888 register Lisp_Object x, y; | 879 register Lisp_Object x, y; |
| 889 { | 880 { |
| 1016 signal (SIGILL, float_error); | 1007 signal (SIGILL, float_error); |
| 1017 #endif | 1008 #endif |
| 1018 in_float = 0; | 1009 in_float = 0; |
| 1019 } | 1010 } |
| 1020 | 1011 |
| 1021 #else /* not LISP_FLOAT_TYPE */ | |
| 1022 | |
| 1023 init_floatfns () | |
| 1024 {} | |
| 1025 | |
| 1026 #endif /* not LISP_FLOAT_TYPE */ | |
| 1027 | |
| 1028 void | 1012 void |
| 1029 syms_of_floatfns () | 1013 syms_of_floatfns () |
| 1030 { | 1014 { |
| 1031 #ifdef LISP_FLOAT_TYPE | |
| 1032 defsubr (&Sacos); | 1015 defsubr (&Sacos); |
| 1033 defsubr (&Sasin); | 1016 defsubr (&Sasin); |
| 1034 defsubr (&Satan); | 1017 defsubr (&Satan); |
| 1035 defsubr (&Scos); | 1018 defsubr (&Scos); |
| 1036 defsubr (&Ssin); | 1019 defsubr (&Ssin); |
| 1064 defsubr (&Ssqrt); | 1047 defsubr (&Ssqrt); |
| 1065 | 1048 |
| 1066 defsubr (&Sabs); | 1049 defsubr (&Sabs); |
| 1067 defsubr (&Sfloat); | 1050 defsubr (&Sfloat); |
| 1068 defsubr (&Slogb); | 1051 defsubr (&Slogb); |
| 1069 #endif /* LISP_FLOAT_TYPE */ | |
| 1070 defsubr (&Sceiling); | 1052 defsubr (&Sceiling); |
| 1071 defsubr (&Sfloor); | 1053 defsubr (&Sfloor); |
| 1072 defsubr (&Sround); | 1054 defsubr (&Sround); |
| 1073 defsubr (&Struncate); | 1055 defsubr (&Struncate); |
| 1074 } | 1056 } |
