comparison src/data.c @ 1983:9c872f33ecbe

[xemacs-hg @ 2004-04-05 22:49:31 by james] Add bignum, ratio, and bigfloat support.
author james
date Mon, 05 Apr 2004 22:50:11 +0000
parents ac1be85b4a5f
children 4529ff71e646
comparison
equal deleted inserted replaced
1982:a748951fd4fb 1983:9c872f33ecbe
51 Lisp_Object Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only; 51 Lisp_Object Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only;
52 Lisp_Object Qio_error, Qfile_error, Qconversion_error, Qend_of_file; 52 Lisp_Object Qio_error, Qfile_error, Qconversion_error, Qend_of_file;
53 Lisp_Object Qtext_conversion_error; 53 Lisp_Object Qtext_conversion_error;
54 Lisp_Object Qarith_error, Qrange_error, Qdomain_error; 54 Lisp_Object Qarith_error, Qrange_error, Qdomain_error;
55 Lisp_Object Qsingularity_error, Qoverflow_error, Qunderflow_error; 55 Lisp_Object Qsingularity_error, Qoverflow_error, Qunderflow_error;
56 Lisp_Object Qintegerp, Qnatnump, Qsymbolp; 56 Lisp_Object Qintegerp, Qnatnump, Qnonnegativep, Qsymbolp;
57 Lisp_Object Qlistp, Qtrue_list_p, Qweak_listp; 57 Lisp_Object Qlistp, Qtrue_list_p, Qweak_listp;
58 Lisp_Object Qconsp, Qsubrp; 58 Lisp_Object Qconsp, Qsubrp;
59 Lisp_Object Qcharacterp, Qstringp, Qarrayp, Qsequencep, Qvectorp; 59 Lisp_Object Qcharacterp, Qstringp, Qarrayp, Qsequencep, Qvectorp;
60 Lisp_Object Qchar_or_string_p, Qmarkerp, Qinteger_or_marker_p, Qbufferp; 60 Lisp_Object Qchar_or_string_p, Qmarkerp, Qinteger_or_marker_p, Qbufferp;
61 Lisp_Object Qinteger_or_char_p, Qinteger_char_or_marker_p; 61 Lisp_Object Qinteger_or_char_p, Qinteger_char_or_marker_p;
458 (object)) 458 (object))
459 { 459 {
460 return CHAR_OR_CHAR_INTP (object) || STRINGP (object) ? Qt : Qnil; 460 return CHAR_OR_CHAR_INTP (object) || STRINGP (object) ? Qt : Qnil;
461 } 461 }
462 462
463 #ifdef HAVE_BIGNUM
464 /* In this case, integerp is defined in number.c. */
465 DEFUN ("fixnump", Ffixnump, 1, 1, 0, /*
466 Return t if OBJECT is a fixnum.
467 */
468 (object))
469 {
470 return INTP (object) ? Qt : Qnil;
471 }
472 #else
463 DEFUN ("integerp", Fintegerp, 1, 1, 0, /* 473 DEFUN ("integerp", Fintegerp, 1, 1, 0, /*
464 Return t if OBJECT is an integer. 474 Return t if OBJECT is an integer.
465 */ 475 */
466 (object)) 476 (object))
467 { 477 {
468 return INTP (object) ? Qt : Qnil; 478 return INTP (object) ? Qt : Qnil;
469 } 479 }
480 #endif
470 481
471 DEFUN ("integer-or-marker-p", Finteger_or_marker_p, 1, 1, 0, /* 482 DEFUN ("integer-or-marker-p", Finteger_or_marker_p, 1, 1, 0, /*
472 Return t if OBJECT is an integer or a marker (editor pointer). 483 Return t if OBJECT is an integer or a marker (editor pointer).
473 */ 484 */
474 (object)) 485 (object))
495 DEFUN ("natnump", Fnatnump, 1, 1, 0, /* 506 DEFUN ("natnump", Fnatnump, 1, 1, 0, /*
496 Return t if OBJECT is a nonnegative integer. 507 Return t if OBJECT is a nonnegative integer.
497 */ 508 */
498 (object)) 509 (object))
499 { 510 {
500 return NATNUMP (object) ? Qt : Qnil; 511 return NATNUMP (object)
512 #ifdef HAVE_BIGNUM
513 || (BIGNUMP (object) && bignum_sign (XBIGNUM_DATA (object)) >= 0)
514 #endif
515 ? Qt : Qnil;
516 }
517
518 DEFUN ("nonnegativep", Fnonnegativep, 1, 1, 0, /*
519 Return t if OBJECT is a nonnegative number.
520 */
521 (object))
522 {
523 return NATNUMP (object)
524 #ifdef HAVE_BIGNUM
525 || (BIGNUMP (object) && bignum_sign (XBIGNUM_DATA (object)) >= 0)
526 #endif
527 #ifdef HAVE_RATIO
528 || (RATIOP (object) && ratio_sign (XRATIO_DATA (object)) >= 0)
529 #endif
530 #ifdef HAVE_BIGFLOAT
531 || (BIGFLOATP (object) && bigfloat_sign (XBIGFLOAT_DATA (object)) >= 0)
532 #endif
533 ? Qt : Qnil;
501 } 534 }
502 535
503 DEFUN ("bitp", Fbitp, 1, 1, 0, /* 536 DEFUN ("bitp", Fbitp, 1, 1, 0, /*
504 Return t if OBJECT is a bit (0 or 1). 537 Return t if OBJECT is a bit (0 or 1).
505 */ 538 */
511 DEFUN ("numberp", Fnumberp, 1, 1, 0, /* 544 DEFUN ("numberp", Fnumberp, 1, 1, 0, /*
512 Return t if OBJECT is a number (floating point or integer). 545 Return t if OBJECT is a number (floating point or integer).
513 */ 546 */
514 (object)) 547 (object))
515 { 548 {
549 #ifdef WITH_NUMBER_TYPES
550 return NUMBERP (object) ? Qt : Qnil;
551 #else
516 return INT_OR_FLOATP (object) ? Qt : Qnil; 552 return INT_OR_FLOATP (object) ? Qt : Qnil;
553 #endif
517 } 554 }
518 555
519 DEFUN ("number-or-marker-p", Fnumber_or_marker_p, 1, 1, 0, /* 556 DEFUN ("number-or-marker-p", Fnumber_or_marker_p, 1, 1, 0, /*
520 Return t if OBJECT is a number or a marker. 557 Return t if OBJECT is a number or a marker.
521 */ 558 */
852 obj = wrong_type_argument (Qinteger_char_or_marker_p, obj); 889 obj = wrong_type_argument (Qinteger_char_or_marker_p, obj);
853 goto retry; 890 goto retry;
854 } 891 }
855 } 892 }
856 893
857 #define ARITHCOMPARE_MANY(op) \ 894 #ifdef WITH_NUMBER_TYPES
895
896 #ifdef HAVE_BIGNUM
897 #define BIGNUM_CASE(op) \
898 case BIGNUM_T: \
899 if (!bignum_##op (XBIGNUM_DATA (obj1), XBIGNUM_DATA (obj2))) \
900 return Qnil; \
901 break;
902 #else
903 #define BIGNUM_CASE(op)
904 #endif /* HAVE_BIGNUM */
905
906 #ifdef HAVE_RATIO
907 #define RATIO_CASE(op) \
908 case RATIO_T: \
909 if (!ratio_##op (XRATIO_DATA (obj1), XRATIO_DATA (obj2))) \
910 return Qnil; \
911 break;
912 #else
913 #define RATIO_CASE(op)
914 #endif /* HAVE_RATIO */
915
916 #ifdef HAVE_BIGFLOAT
917 #define BIGFLOAT_CASE(op) \
918 case BIGFLOAT_T: \
919 if (!bigfloat_##op (XBIGFLOAT_DATA (obj1), XBIGFLOAT_DATA (obj2))) \
920 return Qnil; \
921 break;
922 #else
923 #define BIGFLOAT_CASE(op)
924 #endif /* HAVE_BIGFLOAT */
925
926 #define ARITHCOMPARE_MANY(c_op,op) \
927 { \
928 REGISTER int i; \
929 Lisp_Object obj1, obj2; \
930 \
931 for (i = 1; i < nargs; i++) \
932 { \
933 obj1 = args[i - 1]; \
934 obj2 = args[i]; \
935 switch (promote_args (&obj1, &obj2)) \
936 { \
937 case FIXNUM_T: \
938 if (!(XREALINT (obj1) c_op XREALINT (obj2))) \
939 return Qnil; \
940 break; \
941 BIGNUM_CASE (op) \
942 RATIO_CASE (op) \
943 case FLOAT_T: \
944 if (!(XFLOAT_DATA (obj1) c_op XFLOAT_DATA (obj2))) \
945 return Qnil; \
946 break; \
947 BIGFLOAT_CASE (op) \
948 } \
949 } \
950 return Qt; \
951 }
952 #else /* !WITH_NUMBER_TYPES */
953 #define ARITHCOMPARE_MANY(c_op,op) \
858 { \ 954 { \
859 int_or_double iod1, iod2, *p = &iod1, *q = &iod2; \ 955 int_or_double iod1, iod2, *p = &iod1, *q = &iod2; \
860 Lisp_Object *args_end = args + nargs; \ 956 Lisp_Object *args_end = args + nargs; \
861 \ 957 \
862 number_char_or_marker_to_int_or_double (*args++, p); \ 958 number_char_or_marker_to_int_or_double (*args++, p); \
864 while (args < args_end) \ 960 while (args < args_end) \
865 { \ 961 { \
866 number_char_or_marker_to_int_or_double (*args++, q); \ 962 number_char_or_marker_to_int_or_double (*args++, q); \
867 \ 963 \
868 if (!((p->int_p && q->int_p) ? \ 964 if (!((p->int_p && q->int_p) ? \
869 (p->c.ival op q->c.ival) : \ 965 (p->c.ival c_op q->c.ival) : \
870 ((p->int_p ? (double) p->c.ival : p->c.dval) op \ 966 ((p->int_p ? (double) p->c.ival : p->c.dval) c_op \
871 (q->int_p ? (double) q->c.ival : q->c.dval)))) \ 967 (q->int_p ? (double) q->c.ival : q->c.dval)))) \
872 return Qnil; \ 968 return Qnil; \
873 \ 969 \
874 { /* swap */ int_or_double *r = p; p = q; q = r; } \ 970 { /* swap */ int_or_double *r = p; p = q; q = r; } \
875 } \ 971 } \
876 return Qt; \ 972 return Qt; \
877 } 973 }
974 #endif /* WITH_NUMBER_TYPES */
878 975
879 DEFUN ("=", Feqlsign, 1, MANY, 0, /* 976 DEFUN ("=", Feqlsign, 1, MANY, 0, /*
880 Return t if all the arguments are numerically equal. 977 Return t if all the arguments are numerically equal.
881 The arguments may be numbers, characters or markers. 978 The arguments may be numbers, characters or markers.
882 */ 979 */
883 (int nargs, Lisp_Object *args)) 980 (int nargs, Lisp_Object *args))
884 { 981 {
885 ARITHCOMPARE_MANY (==) 982 ARITHCOMPARE_MANY (==, eql)
886 } 983 }
887 984
888 DEFUN ("<", Flss, 1, MANY, 0, /* 985 DEFUN ("<", Flss, 1, MANY, 0, /*
889 Return t if the sequence of arguments is monotonically increasing. 986 Return t if the sequence of arguments is monotonically increasing.
890 The arguments may be numbers, characters or markers. 987 The arguments may be numbers, characters or markers.
891 */ 988 */
892 (int nargs, Lisp_Object *args)) 989 (int nargs, Lisp_Object *args))
893 { 990 {
894 ARITHCOMPARE_MANY (<) 991 ARITHCOMPARE_MANY (<, lt)
895 } 992 }
896 993
897 DEFUN (">", Fgtr, 1, MANY, 0, /* 994 DEFUN (">", Fgtr, 1, MANY, 0, /*
898 Return t if the sequence of arguments is monotonically decreasing. 995 Return t if the sequence of arguments is monotonically decreasing.
899 The arguments may be numbers, characters or markers. 996 The arguments may be numbers, characters or markers.
900 */ 997 */
901 (int nargs, Lisp_Object *args)) 998 (int nargs, Lisp_Object *args))
902 { 999 {
903 ARITHCOMPARE_MANY (>) 1000 ARITHCOMPARE_MANY (>, gt)
904 } 1001 }
905 1002
906 DEFUN ("<=", Fleq, 1, MANY, 0, /* 1003 DEFUN ("<=", Fleq, 1, MANY, 0, /*
907 Return t if the sequence of arguments is monotonically nondecreasing. 1004 Return t if the sequence of arguments is monotonically nondecreasing.
908 The arguments may be numbers, characters or markers. 1005 The arguments may be numbers, characters or markers.
909 */ 1006 */
910 (int nargs, Lisp_Object *args)) 1007 (int nargs, Lisp_Object *args))
911 { 1008 {
912 ARITHCOMPARE_MANY (<=) 1009 ARITHCOMPARE_MANY (<=, le)
913 } 1010 }
914 1011
915 DEFUN (">=", Fgeq, 1, MANY, 0, /* 1012 DEFUN (">=", Fgeq, 1, MANY, 0, /*
916 Return t if the sequence of arguments is monotonically nonincreasing. 1013 Return t if the sequence of arguments is monotonically nonincreasing.
917 The arguments may be numbers, characters or markers. 1014 The arguments may be numbers, characters or markers.
918 */ 1015 */
919 (int nargs, Lisp_Object *args)) 1016 (int nargs, Lisp_Object *args))
920 { 1017 {
921 ARITHCOMPARE_MANY (>=) 1018 ARITHCOMPARE_MANY (>=, ge)
922 } 1019 }
923 1020
1021 /* Unlike all the other comparisons, this is an O(N*N) algorithm. But who
1022 cares? Inspection of all elisp code distributed by xemacs.org shows that
1023 it is almost always called with 2 arguments, rarely with 3, and never with
1024 more than 3. The constant factors of algorithms with better asymptotic
1025 complexity are higher, which means that those algorithms will run SLOWER
1026 than this one in the common case. Optimize the common case! */
924 DEFUN ("/=", Fneq, 1, MANY, 0, /* 1027 DEFUN ("/=", Fneq, 1, MANY, 0, /*
925 Return t if no two arguments are numerically equal. 1028 Return t if no two arguments are numerically equal.
926 The arguments may be numbers, characters or markers. 1029 The arguments may be numbers, characters or markers.
927 */ 1030 */
928 (int nargs, Lisp_Object *args)) 1031 (int nargs, Lisp_Object *args))
929 { 1032 {
1033 #ifdef WITH_NUMBER_TYPES
1034 REGISTER int i, j;
1035 Lisp_Object obj1, obj2;
1036
1037 for (i = 0; i < nargs - 1; i++)
1038 {
1039 obj1 = args[i];
1040 for (j = i + 1; j < nargs; j++)
1041 {
1042 obj2 = args[j];
1043 switch (promote_args (&obj1, &obj2))
1044 {
1045 case FIXNUM_T:
1046 if (XREALINT (obj1) == XREALINT (obj2))
1047 return Qnil;
1048 break;
1049 #ifdef HAVE_BIGNUM
1050 case BIGNUM_T:
1051 if (bignum_eql (XBIGNUM_DATA (obj1), XBIGNUM_DATA (obj2)))
1052 return Qnil;
1053 break;
1054 #endif
1055 #ifdef HAVE_RATIO
1056 case RATIO_T:
1057 if (ratio_eql (XRATIO_DATA (obj1), XRATIO_DATA (obj2)))
1058 return Qnil;
1059 break;
1060 #endif
1061 case FLOAT_T:
1062 if (XFLOAT_DATA (obj1) == XFLOAT_DATA (obj2))
1063 return Qnil;
1064 break;
1065 #ifdef HAVE_BIGFLOAT
1066 case BIGFLOAT_T:
1067 if (bigfloat_eql (XBIGFLOAT_DATA (obj1), XBIGFLOAT_DATA (obj2)))
1068 return Qnil;
1069 break;
1070 #endif
1071 }
1072 }
1073 }
1074 return Qt;
1075 #else /* !WITH_NUMBER_TYPES */
930 Lisp_Object *args_end = args + nargs; 1076 Lisp_Object *args_end = args + nargs;
931 Lisp_Object *p, *q; 1077 Lisp_Object *p, *q;
932 1078
933 /* Unlike all the other comparisons, this is an N*N algorithm. 1079 /* Unlike all the other comparisons, this is an N*N algorithm.
934 We could use a hash table for nargs > 50 to make this linear. */ 1080 We could use a hash table for nargs > 50 to make this linear. */
947 (iod2.int_p ? (double) iod2.c.ival : iod2.c.dval)))) 1093 (iod2.int_p ? (double) iod2.c.ival : iod2.c.dval))))
948 return Qnil; 1094 return Qnil;
949 } 1095 }
950 } 1096 }
951 return Qt; 1097 return Qt;
1098 #endif /* WITH_NUMBER_TYPES */
952 } 1099 }
953 1100
954 DEFUN ("zerop", Fzerop, 1, 1, 0, /* 1101 DEFUN ("zerop", Fzerop, 1, 1, 0, /*
955 Return t if NUMBER is zero. 1102 Return t if NUMBER is zero.
956 */ 1103 */
957 (number)) 1104 (number))
958 { 1105 {
959 retry: 1106 retry:
960 if (INTP (number)) 1107 if (INTP (number))
961 return EQ (number, Qzero) ? Qt : Qnil; 1108 return EQ (number, Qzero) ? Qt : Qnil;
1109 #ifdef HAVE_BIGNUM
1110 else if (BIGNUMP (number))
1111 return bignum_sign (XBIGNUM_DATA (number)) == 0 ? Qt : Qnil;
1112 #endif
1113 #ifdef HAVE_RATIO
1114 else if (RATIOP (number))
1115 return ratio_sign (XRATIO_DATA (number)) == 0 ? Qt : Qnil;
1116 #endif
962 else if (FLOATP (number)) 1117 else if (FLOATP (number))
963 return XFLOAT_DATA (number) == 0.0 ? Qt : Qnil; 1118 return XFLOAT_DATA (number) == 0.0 ? Qt : Qnil;
1119 #ifdef HAVE_BIGFLOAT
1120 else if (BIGFLOATP (number))
1121 return bigfloat_sign (XBIGFLOAT_DATA (number)) == 0 ? Qt : Qnil;
1122 #endif
964 else 1123 else
965 { 1124 {
966 number = wrong_type_argument (Qnumberp, number); 1125 number = wrong_type_argument (Qnumberp, number);
967 goto retry; 1126 goto retry;
968 } 1127 }
999 1158
1000 DEFUN ("number-to-string", Fnumber_to_string, 1, 1, 0, /* 1159 DEFUN ("number-to-string", Fnumber_to_string, 1, 1, 0, /*
1001 Convert NUMBER to a string by printing it in decimal. 1160 Convert NUMBER to a string by printing it in decimal.
1002 Uses a minus sign if negative. 1161 Uses a minus sign if negative.
1003 NUMBER may be an integer or a floating point number. 1162 NUMBER may be an integer or a floating point number.
1163 If supported, it may also be a ratio.
1004 */ 1164 */
1005 (number)) 1165 (number))
1006 { 1166 {
1167 #ifdef WITH_NUMBER_TYPES
1168 CHECK_NUMBER (number);
1169 #else
1007 CHECK_INT_OR_FLOAT (number); 1170 CHECK_INT_OR_FLOAT (number);
1171 #endif
1008 1172
1009 if (FLOATP (number)) 1173 if (FLOATP (number))
1010 { 1174 {
1011 char pigbuf[350]; /* see comments in float_to_string */ 1175 char pigbuf[350]; /* see comments in float_to_string */
1012 1176
1013 float_to_string (pigbuf, XFLOAT_DATA (number)); 1177 float_to_string (pigbuf, XFLOAT_DATA (number));
1014 return build_string (pigbuf); 1178 return build_string (pigbuf);
1015 } 1179 }
1180 #ifdef HAVE_BIGNUM
1181 if (BIGNUMP (number))
1182 {
1183 char *str = bignum_to_string (XBIGNUM_DATA (number), 10);
1184 Lisp_Object retval = build_string (str);
1185 xfree (str, char *);
1186 return retval;
1187 }
1188 #endif
1189 #ifdef HAVE_RATIO
1190 if (RATIOP (number))
1191 {
1192 char *str = ratio_to_string (XRATIO_DATA (number), 10);
1193 Lisp_Object retval = build_string (str);
1194 xfree (str, char *);
1195 return retval;
1196 }
1197 #endif
1198 #ifdef HAVE_BIGFLOAT
1199 if (BIGFLOATP (number))
1200 {
1201 char *str = bigfloat_to_string (XBIGFLOAT_DATA (number), 10);
1202 Lisp_Object retval = build_string (str);
1203 xfree (str, char *);
1204 return retval;
1205 }
1206 #endif
1016 1207
1017 { 1208 {
1018 char buffer[DECIMAL_PRINT_SIZE (long)]; 1209 char buffer[DECIMAL_PRINT_SIZE (long)];
1019 1210
1020 long_to_string (buffer, XINT (number)); 1211 long_to_string (buffer, XINT (number));
1035 } 1226 }
1036 1227
1037 DEFUN ("string-to-number", Fstring_to_number, 1, 2, 0, /* 1228 DEFUN ("string-to-number", Fstring_to_number, 1, 2, 0, /*
1038 Convert STRING to a number by parsing it as a number in base BASE. 1229 Convert STRING to a number by parsing it as a number in base BASE.
1039 This parses both integers and floating point numbers. 1230 This parses both integers and floating point numbers.
1231 If they are supported, it also reads ratios.
1040 It ignores leading spaces and tabs. 1232 It ignores leading spaces and tabs.
1041 1233
1042 If BASE is nil or omitted, base 10 is used. 1234 If BASE is nil or omitted, base 10 is used.
1043 BASE must be an integer between 2 and 16 (inclusive). 1235 BASE must be an integer between 2 and 16 (inclusive).
1044 Floating point numbers always use base 10. 1236 Floating point numbers always use base 10.
1065 atoi do this anyway, so we might as well make Emacs lisp consistent. */ 1257 atoi do this anyway, so we might as well make Emacs lisp consistent. */
1066 while (*p == ' ' || *p == '\t') 1258 while (*p == ' ' || *p == '\t')
1067 p++; 1259 p++;
1068 1260
1069 if (isfloat_string (p) && b == 10) 1261 if (isfloat_string (p) && b == 10)
1070 return make_float (atof (p)); 1262 {
1071 1263 #ifdef HAVE_BIGFLOAT
1264 if (ZEROP (Vdefault_float_precision))
1265 #endif
1266 return make_float (atof (p));
1267 #ifdef HAVE_BIGFLOAT
1268 else
1269 {
1270 bigfloat_set_prec (scratch_bigfloat, bigfloat_get_default_prec ());
1271 bigfloat_set_string (scratch_bigfloat, p, b);
1272 return make_bigfloat_bf (scratch_bigfloat);
1273 }
1274 #endif
1275 }
1276
1277 #ifdef HAVE_RATIO
1278 if (qxestrchr (p, '/') != NULL)
1279 {
1280 ratio_set_string (scratch_ratio, p, b);
1281 return make_ratio_rt (scratch_ratio);
1282 }
1283 #endif /* HAVE_RATIO */
1284
1285 #ifdef HAVE_BIGNUM
1286 /* GMP bignum_set_string returns random values when fed an empty string */
1287 if (*p == '\0')
1288 return make_int (0);
1289 bignum_set_string (scratch_bignum, p, b);
1290 return Fcanonicalize_number (make_bignum_bg (scratch_bignum));
1291 #else
1072 if (b == 10) 1292 if (b == 10)
1073 { 1293 {
1074 /* Use the system-provided functions for base 10. */ 1294 /* Use the system-provided functions for base 10. */
1075 #if SIZEOF_EMACS_INT == SIZEOF_INT 1295 #if SIZEOF_EMACS_INT == SIZEOF_INT
1076 return make_int (atoi (p)); 1296 return make_int (atoi (p));
1099 break; 1319 break;
1100 v = v * b + digit; 1320 v = v * b + digit;
1101 } 1321 }
1102 return make_int (negative * v); 1322 return make_int (negative * v);
1103 } 1323 }
1324 #endif /* HAVE_BIGNUM */
1104 } 1325 }
1105 1326
1106 1327
1107 DEFUN ("+", Fplus, 0, MANY, 0, /* 1328 DEFUN ("+", Fplus, 0, MANY, 0, /*
1108 Return sum of any number of arguments. 1329 Return sum of any number of arguments.
1109 The arguments should all be numbers, characters or markers. 1330 The arguments should all be numbers, characters or markers.
1110 */ 1331 */
1111 (int nargs, Lisp_Object *args)) 1332 (int nargs, Lisp_Object *args))
1112 { 1333 {
1334 #ifdef WITH_NUMBER_TYPES
1335 REGISTER int i;
1336 Lisp_Object accum = make_int (0), addend;
1337
1338 for (i = 0; i < nargs; i++)
1339 {
1340 addend = args[i];
1341 switch (promote_args (&accum, &addend))
1342 {
1343 case FIXNUM_T:
1344 accum = make_integer (XREALINT (accum) + XREALINT (addend));
1345 break;
1346 #ifdef HAVE_BIGNUM
1347 case BIGNUM_T:
1348 bignum_add (scratch_bignum, XBIGNUM_DATA (accum),
1349 XBIGNUM_DATA (addend));
1350 accum = make_bignum_bg (scratch_bignum);
1351 break;
1352 #endif
1353 #ifdef HAVE_RATIO
1354 case RATIO_T:
1355 ratio_add (scratch_ratio, XRATIO_DATA (accum),
1356 XRATIO_DATA (addend));
1357 accum = make_ratio_rt (scratch_ratio);
1358 break;
1359 #endif
1360 case FLOAT_T:
1361 accum = make_float (XFLOAT_DATA (accum) + XFLOAT_DATA (addend));
1362 break;
1363 #ifdef HAVE_BIGFLOAT
1364 case BIGFLOAT_T:
1365 bigfloat_set_prec (scratch_bigfloat,
1366 max (XBIGFLOAT_GET_PREC (addend),
1367 XBIGFLOAT_GET_PREC (accum)));
1368 bigfloat_add (scratch_bigfloat, XBIGFLOAT_DATA (accum),
1369 XBIGFLOAT_DATA (addend));
1370 accum = make_bigfloat_bf (scratch_bigfloat);
1371 break;
1372 #endif
1373 }
1374 }
1375 return Fcanonicalize_number (accum);
1376 #else /* !WITH_NUMBER_TYPES */
1113 EMACS_INT iaccum = 0; 1377 EMACS_INT iaccum = 0;
1114 Lisp_Object *args_end = args + nargs; 1378 Lisp_Object *args_end = args + nargs;
1115 1379
1116 while (args < args_end) 1380 while (args < args_end)
1117 { 1381 {
1127 return make_float (daccum); 1391 return make_float (daccum);
1128 } 1392 }
1129 } 1393 }
1130 1394
1131 return make_int (iaccum); 1395 return make_int (iaccum);
1396 #endif /* WITH_NUMBER_TYPES */
1132 } 1397 }
1133 1398
1134 DEFUN ("-", Fminus, 1, MANY, 0, /* 1399 DEFUN ("-", Fminus, 1, MANY, 0, /*
1135 Negate number or subtract numbers, characters or markers. 1400 Negate number or subtract numbers, characters or markers.
1136 With one arg, negates it. With more than one arg, 1401 With one arg, negates it. With more than one arg,
1137 subtracts all but the first from the first. 1402 subtracts all but the first from the first.
1138 */ 1403 */
1139 (int nargs, Lisp_Object *args)) 1404 (int nargs, Lisp_Object *args))
1140 { 1405 {
1406 #ifdef WITH_NUMBER_TYPES
1407 REGISTER int i;
1408 Lisp_Object accum = args[0], subtrahend;
1409
1410 if (nargs == 1)
1411 {
1412 if (CHARP (accum))
1413 accum = make_int (XCHAR (accum));
1414 else if (MARKERP (accum))
1415 accum = make_int (marker_position (accum));
1416
1417 /* Invert the sign of accum */
1418 CHECK_NUMBER (accum);
1419 switch (get_number_type (accum))
1420 {
1421 case FIXNUM_T:
1422 return make_integer (-XREALINT (accum));
1423 #ifdef HAVE_BIGNUM
1424 case BIGNUM_T:
1425 bignum_neg (scratch_bignum, XBIGNUM_DATA (accum));
1426 return Fcanonicalize_number (make_bignum_bg (scratch_bignum));
1427 #endif
1428 #ifdef HAVE_RATIO
1429 case RATIO_T:
1430 ratio_neg (scratch_ratio, XRATIO_DATA (accum));
1431 return make_ratio_rt (scratch_ratio);
1432 #endif
1433 case FLOAT_T:
1434 return make_float (-XFLOAT_DATA (accum));
1435 #ifdef HAVE_BIGFLOAT
1436 case BIGFLOAT_T:
1437 bigfloat_set_prec (scratch_bigfloat, XBIGFLOAT_GET_PREC (accum));
1438 bigfloat_neg (scratch_bigfloat, XBIGFLOAT_DATA (accum));
1439 return make_bigfloat_bf (scratch_bigfloat);
1440 #endif
1441 }
1442 }
1443 else
1444 {
1445 /* Subtrace the remaining arguments from accum */
1446 for (i = 1; i < nargs; i++)
1447 {
1448 subtrahend = args[i];
1449 switch (promote_args (&accum, &subtrahend))
1450 {
1451 case FIXNUM_T:
1452 accum = make_integer (XREALINT (accum) - XREALINT (subtrahend));
1453 break;
1454 #ifdef HAVE_BIGNUM
1455 case BIGNUM_T:
1456 bignum_sub (scratch_bignum, XBIGNUM_DATA (accum),
1457 XBIGNUM_DATA (subtrahend));
1458 accum = make_bignum_bg (scratch_bignum);
1459 break;
1460 #endif
1461 #ifdef HAVE_RATIO
1462 case RATIO_T:
1463 ratio_sub (scratch_ratio, XRATIO_DATA (accum),
1464 XRATIO_DATA (subtrahend));
1465 accum = make_ratio_rt (scratch_ratio);
1466 break;
1467 #endif
1468 case FLOAT_T:
1469 accum =
1470 make_float (XFLOAT_DATA (accum) - XFLOAT_DATA (subtrahend));
1471 break;
1472 #ifdef HAVE_BIGFLOAT
1473 case BIGFLOAT_T:
1474 bigfloat_set_prec (scratch_bigfloat,
1475 max (XBIGFLOAT_GET_PREC (subtrahend),
1476 XBIGFLOAT_GET_PREC (accum)));
1477 bigfloat_sub (scratch_bigfloat, XBIGFLOAT_DATA (accum),
1478 XBIGFLOAT_DATA (subtrahend));
1479 accum = make_bigfloat_bf (scratch_bigfloat);
1480 break;
1481 #endif
1482 }
1483 }
1484 }
1485 return Fcanonicalize_number (accum);
1486 #else /* !WITH_NUMBER_TYPES */
1141 EMACS_INT iaccum; 1487 EMACS_INT iaccum;
1142 double daccum; 1488 double daccum;
1143 Lisp_Object *args_end = args + nargs; 1489 Lisp_Object *args_end = args + nargs;
1144 int_or_double iod; 1490 int_or_double iod;
1145 1491
1168 1514
1169 do_float: 1515 do_float:
1170 for (; args < args_end; args++) 1516 for (; args < args_end; args++)
1171 daccum -= number_char_or_marker_to_double (*args); 1517 daccum -= number_char_or_marker_to_double (*args);
1172 return make_float (daccum); 1518 return make_float (daccum);
1519 #endif /* WITH_NUMBER_TYPES */
1173 } 1520 }
1174 1521
1175 DEFUN ("*", Ftimes, 0, MANY, 0, /* 1522 DEFUN ("*", Ftimes, 0, MANY, 0, /*
1176 Return product of any number of arguments. 1523 Return product of any number of arguments.
1177 The arguments should all be numbers, characters or markers. 1524 The arguments should all be numbers, characters or markers.
1178 */ 1525 */
1179 (int nargs, Lisp_Object *args)) 1526 (int nargs, Lisp_Object *args))
1180 { 1527 {
1528 #ifdef WITH_NUMBER_TYPES
1529 REGISTER int i;
1530 /* Start with a bignum to avoid overflow */
1531 Lisp_Object accum = make_bignum (1L), multiplier;
1532
1533 for (i = 0; i < nargs; i++)
1534 {
1535 multiplier = args[i];
1536 switch (promote_args (&accum, &multiplier))
1537 {
1538 #ifdef HAVE_BIGNUM
1539 case BIGNUM_T:
1540 bignum_mul (scratch_bignum, XBIGNUM_DATA (accum),
1541 XBIGNUM_DATA (multiplier));
1542 accum = make_bignum_bg (scratch_bignum);
1543 break;
1544 #endif
1545 #ifdef HAVE_RATIO
1546 case RATIO_T:
1547 ratio_mul (scratch_ratio, XRATIO_DATA (accum),
1548 XRATIO_DATA (multiplier));
1549 accum = make_ratio_rt (scratch_ratio);
1550 break;
1551 #endif
1552 case FLOAT_T:
1553 accum = make_float (XFLOAT_DATA (accum) * XFLOAT_DATA (multiplier));
1554 break;
1555 #ifdef HAVE_BIGFLOAT
1556 case BIGFLOAT_T:
1557 bigfloat_set_prec (scratch_bigfloat,
1558 max (XBIGFLOAT_GET_PREC (multiplier),
1559 XBIGFLOAT_GET_PREC (accum)));
1560 bigfloat_mul (scratch_bigfloat, XBIGFLOAT_DATA (accum),
1561 XBIGFLOAT_DATA (multiplier));
1562 accum = make_bigfloat_bf (scratch_bigfloat);
1563 break;
1564 #endif
1565 }
1566 }
1567 return Fcanonicalize_number (accum);
1568 #else /* !WITH_NUMBER_TYPES */
1181 EMACS_INT iaccum = 1; 1569 EMACS_INT iaccum = 1;
1182 Lisp_Object *args_end = args + nargs; 1570 Lisp_Object *args_end = args + nargs;
1183 1571
1184 while (args < args_end) 1572 while (args < args_end)
1185 { 1573 {
1195 return make_float (daccum); 1583 return make_float (daccum);
1196 } 1584 }
1197 } 1585 }
1198 1586
1199 return make_int (iaccum); 1587 return make_int (iaccum);
1200 } 1588 #endif /* WITH_NUMBER_TYPES */
1589 }
1590
1591 #ifdef HAVE_RATIO
1592 DEFUN ("div", Fdiv, 1, MANY, 0, /*
1593 Same as `/', but dividing integers creates a ratio instead of truncating.
1594 Note that this is a departure from Common Lisp, where / creates ratios when
1595 dividing integers. Having a separate function lets us avoid breaking existing
1596 Emacs Lisp code that expects / to do integer division.
1597 */
1598 (int nargs, Lisp_Object *args))
1599 {
1600 REGISTER int i;
1601 Lisp_Object accum, divisor;
1602
1603 if (nargs == 1)
1604 {
1605 i = 0;
1606 accum = make_int (1);
1607 }
1608 else
1609 {
1610 i = 1;
1611 accum = args[0];
1612 }
1613 for (; i < nargs; i++)
1614 {
1615 divisor = args[i];
1616 switch (promote_args (&accum, &divisor))
1617 {
1618 case FIXNUM_T:
1619 if (XREALINT (divisor) == 0) goto divide_by_zero;
1620 bignum_set_long (scratch_bignum, XREALINT (accum));
1621 bignum_set_long (scratch_bignum2, XREALINT (divisor));
1622 accum = make_ratio_bg (scratch_bignum, scratch_bignum2);
1623 break;
1624 case BIGNUM_T:
1625 if (bignum_sign (XBIGNUM_DATA (divisor)) == 0) goto divide_by_zero;
1626 accum = make_ratio_bg (XBIGNUM_DATA (accum), XBIGNUM_DATA (divisor));
1627 break;
1628 case RATIO_T:
1629 if (ratio_sign (XRATIO_DATA (divisor)) == 0) goto divide_by_zero;
1630 ratio_div (scratch_ratio, XRATIO_DATA (accum),
1631 XRATIO_DATA (divisor));
1632 accum = make_ratio_rt (scratch_ratio);
1633 break;
1634 case FLOAT_T:
1635 if (XFLOAT_DATA (divisor) == 0.0) goto divide_by_zero;
1636 accum = make_float (XFLOAT_DATA (accum) / XFLOAT_DATA (divisor));
1637 break;
1638 #ifdef HAVE_BIGFLOAT
1639 case BIGFLOAT_T:
1640 if (bigfloat_sign (XBIGFLOAT_DATA (divisor)) == 0)
1641 goto divide_by_zero;
1642 bigfloat_set_prec (scratch_bigfloat,
1643 max (XBIGFLOAT_GET_PREC (divisor),
1644 XBIGFLOAT_GET_PREC (accum)));
1645 bigfloat_div (scratch_bigfloat, XBIGFLOAT_DATA (accum),
1646 XBIGFLOAT_DATA (divisor));
1647 accum = make_bigfloat_bf (scratch_bigfloat);
1648 break;
1649 #endif
1650 }
1651 }
1652 return Fcanonicalize_number (accum);
1653
1654 divide_by_zero:
1655 Fsignal (Qarith_error, Qnil);
1656 return Qnil; /* not (usually) reached */
1657 }
1658 #endif /* HAVE_RATIO */
1201 1659
1202 DEFUN ("/", Fquo, 1, MANY, 0, /* 1660 DEFUN ("/", Fquo, 1, MANY, 0, /*
1203 Return first argument divided by all the remaining arguments. 1661 Return first argument divided by all the remaining arguments.
1204 The arguments must be numbers, characters or markers. 1662 The arguments must be numbers, characters or markers.
1205 With one argument, reciprocates the argument. 1663 With one argument, reciprocates the argument.
1206 */ 1664 */
1207 (int nargs, Lisp_Object *args)) 1665 (int nargs, Lisp_Object *args))
1208 { 1666 {
1667 #ifdef WITH_NUMBER_TYPES
1668 REGISTER int i;
1669 Lisp_Object accum, divisor;
1670
1671 if (nargs == 1)
1672 {
1673 i = 0;
1674 accum = make_int (1);
1675 }
1676 else
1677 {
1678 i = 1;
1679 accum = args[0];
1680 }
1681 for (; i < nargs; i++)
1682 {
1683 divisor = args[i];
1684 switch (promote_args (&accum, &divisor))
1685 {
1686 case FIXNUM_T:
1687 if (XREALINT (divisor) == 0) goto divide_by_zero;
1688 accum = make_integer (XREALINT (accum) / XREALINT (divisor));
1689 break;
1690 #ifdef HAVE_BIGNUM
1691 case BIGNUM_T:
1692 if (bignum_sign (XBIGNUM_DATA (divisor)) == 0) goto divide_by_zero;
1693 bignum_div (scratch_bignum, XBIGNUM_DATA (accum),
1694 XBIGNUM_DATA (divisor));
1695 accum = make_bignum_bg (scratch_bignum);
1696 break;
1697 #endif
1698 #ifdef HAVE_RATIO
1699 case RATIO_T:
1700 if (ratio_sign (XRATIO_DATA (divisor)) == 0) goto divide_by_zero;
1701 ratio_div (scratch_ratio, XRATIO_DATA (accum),
1702 XRATIO_DATA (divisor));
1703 accum = make_ratio_rt (scratch_ratio);
1704 break;
1705 #endif
1706 case FLOAT_T:
1707 if (XFLOAT_DATA (divisor) == 0.0) goto divide_by_zero;
1708 accum = make_float (XFLOAT_DATA (accum) / XFLOAT_DATA (divisor));
1709 break;
1710 #ifdef HAVE_BIGFLOAT
1711 case BIGFLOAT_T:
1712 if (bigfloat_sign (XBIGFLOAT_DATA (divisor)) == 0)
1713 goto divide_by_zero;
1714 bigfloat_set_prec (scratch_bigfloat,
1715 max (XBIGFLOAT_GET_PREC (divisor),
1716 XBIGFLOAT_GET_PREC (accum)));
1717 bigfloat_div (scratch_bigfloat, XBIGFLOAT_DATA (accum),
1718 XBIGFLOAT_DATA (divisor));
1719 accum = make_bigfloat_bf (scratch_bigfloat);
1720 break;
1721 #endif
1722 }
1723 }
1724 return Fcanonicalize_number (accum);
1725 #else /* !WITH_NUMBER_TYPES */
1209 EMACS_INT iaccum; 1726 EMACS_INT iaccum;
1210 double daccum; 1727 double daccum;
1211 Lisp_Object *args_end = args + nargs; 1728 Lisp_Object *args_end = args + nargs;
1212 int_or_double iod; 1729 int_or_double iod;
1213 1730
1249 double dval = number_char_or_marker_to_double (*args); 1766 double dval = number_char_or_marker_to_double (*args);
1250 if (dval == 0) goto divide_by_zero; 1767 if (dval == 0) goto divide_by_zero;
1251 daccum /= dval; 1768 daccum /= dval;
1252 } 1769 }
1253 return make_float (daccum); 1770 return make_float (daccum);
1771 #endif /* WITH_NUMBER_TYPES */
1254 1772
1255 divide_by_zero: 1773 divide_by_zero:
1256 Fsignal (Qarith_error, Qnil); 1774 Fsignal (Qarith_error, Qnil);
1257 return Qnil; /* not (usually) reached */ 1775 return Qnil; /* not (usually) reached */
1258 } 1776 }
1259 1777
1260 DEFUN ("max", Fmax, 1, MANY, 0, /* 1778 DEFUN ("max", Fmax, 1, MANY, 0, /*
1261 Return largest of all the arguments. 1779 Return largest of all the arguments.
1262 All arguments must be numbers, characters or markers. 1780 All arguments must be real numbers, characters or markers.
1263 The value is always a number; markers and characters are converted 1781 The value is always a number; markers and characters are converted
1264 to numbers. 1782 to numbers.
1265 */ 1783 */
1266 (int nargs, Lisp_Object *args)) 1784 (int nargs, Lisp_Object *args))
1267 { 1785 {
1786 #ifdef WITH_NUMBER_TYPES
1787 REGISTER int i, maxindex = 0;
1788 Lisp_Object comp1, comp2;
1789
1790 while (!(CHARP (args[0]) || MARKERP (args[0]) || REALP (args[0])))
1791 args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]);
1792 if (CHARP (args[0]))
1793 args[0] = make_int (XCHAR (args[0]));
1794 else if (MARKERP (args[0]))
1795 args[0] = make_int (marker_position (args[0]));
1796 for (i = 1; i < nargs; i++)
1797 {
1798 retry:
1799 comp1 = args[maxindex];
1800 comp2 = args[i];
1801 switch (promote_args (&comp1, &comp2))
1802 {
1803 case FIXNUM_T:
1804 if (XREALINT (comp1) < XREALINT (comp2))
1805 maxindex = i;
1806 break;
1807 #ifdef HAVE_BIGNUM
1808 case BIGNUM_T:
1809 if (bignum_lt (XBIGNUM_DATA (comp1), XBIGNUM_DATA (comp2)))
1810 maxindex = i;
1811 break;
1812 #endif
1813 #ifdef HAVE_RATIO
1814 case RATIO_T:
1815 if (ratio_lt (XRATIO_DATA (comp1), XRATIO_DATA (comp2)))
1816 maxindex = i;
1817 break;
1818 #endif
1819 case FLOAT_T:
1820 if (XFLOAT_DATA (comp1) < XFLOAT_DATA (comp2))
1821 maxindex = i;
1822 break;
1823 #ifdef HAVE_BIGFLOAT
1824 case BIGFLOAT_T:
1825 if (bigfloat_lt (XBIGFLOAT_DATA (comp1), XBIGFLOAT_DATA (comp2)))
1826 maxindex = i;
1827 break;
1828 #endif
1829 }
1830 }
1831 return args[maxindex];
1832 #else /* !WITH_NUMBER_TYPES */
1268 EMACS_INT imax; 1833 EMACS_INT imax;
1269 double dmax; 1834 double dmax;
1270 Lisp_Object *args_end = args + nargs; 1835 Lisp_Object *args_end = args + nargs;
1271 int_or_double iod; 1836 int_or_double iod;
1272 1837
1301 { 1866 {
1302 double dval = number_char_or_marker_to_double (*args++); 1867 double dval = number_char_or_marker_to_double (*args++);
1303 if (dmax < dval) dmax = dval; 1868 if (dmax < dval) dmax = dval;
1304 } 1869 }
1305 return make_float (dmax); 1870 return make_float (dmax);
1871 #endif /* WITH_NUMBER_TYPES */
1306 } 1872 }
1307 1873
1308 DEFUN ("min", Fmin, 1, MANY, 0, /* 1874 DEFUN ("min", Fmin, 1, MANY, 0, /*
1309 Return smallest of all the arguments. 1875 Return smallest of all the arguments.
1310 All arguments must be numbers, characters or markers. 1876 All arguments must be numbers, characters or markers.
1311 The value is always a number; markers and characters are converted 1877 The value is always a number; markers and characters are converted
1312 to numbers. 1878 to numbers.
1313 */ 1879 */
1314 (int nargs, Lisp_Object *args)) 1880 (int nargs, Lisp_Object *args))
1315 { 1881 {
1882 #ifdef WITH_NUMBER_TYPES
1883 REGISTER int i, minindex = 0;
1884 Lisp_Object comp1, comp2;
1885
1886 while (!(CHARP (args[0]) || MARKERP (args[0]) || REALP (args[0])))
1887 args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]);
1888 if (CHARP (args[0]))
1889 args[0] = make_int (XCHAR (args[0]));
1890 else if (MARKERP (args[0]))
1891 args[0] = make_int (marker_position (args[0]));
1892 for (i = 1; i < nargs; i++)
1893 {
1894 comp1 = args[minindex];
1895 comp2 = args[i];
1896 switch (promote_args (&comp1, &comp2))
1897 {
1898 case FIXNUM_T:
1899 if (XREALINT (comp1) > XREALINT (comp2))
1900 minindex = i;
1901 break;
1902 #ifdef HAVE_BIGNUM
1903 case BIGNUM_T:
1904 if (bignum_gt (XBIGNUM_DATA (comp1), XBIGNUM_DATA (comp2)))
1905 minindex = i;
1906 break;
1907 #endif
1908 #ifdef HAVE_RATIO
1909 case RATIO_T:
1910 if (ratio_gt (XRATIO_DATA (comp1), XRATIO_DATA (comp2)))
1911 minindex = i;
1912 break;
1913 #endif
1914 case FLOAT_T:
1915 if (XFLOAT_DATA (comp1) > XFLOAT_DATA (comp2))
1916 minindex = i;
1917 break;
1918 #ifdef HAVE_BIGFLOAT
1919 case BIGFLOAT_T:
1920 if (bigfloat_gt (XBIGFLOAT_DATA (comp1), XBIGFLOAT_DATA (comp2)))
1921 minindex = i;
1922 break;
1923 #endif
1924 }
1925 }
1926 return args[minindex];
1927 #else /* !WITH_NUMBER_TYPES */
1316 EMACS_INT imin; 1928 EMACS_INT imin;
1317 double dmin; 1929 double dmin;
1318 Lisp_Object *args_end = args + nargs; 1930 Lisp_Object *args_end = args + nargs;
1319 int_or_double iod; 1931 int_or_double iod;
1320 1932
1349 { 1961 {
1350 double dval = number_char_or_marker_to_double (*args++); 1962 double dval = number_char_or_marker_to_double (*args++);
1351 if (dmin > dval) dmin = dval; 1963 if (dmin > dval) dmin = dval;
1352 } 1964 }
1353 return make_float (dmin); 1965 return make_float (dmin);
1966 #endif /* WITH_NUMBER_TYPES */
1354 } 1967 }
1355 1968
1356 DEFUN ("logand", Flogand, 0, MANY, 0, /* 1969 DEFUN ("logand", Flogand, 0, MANY, 0, /*
1357 Return bitwise-and of all the arguments. 1970 Return bitwise-and of all the arguments.
1358 Arguments may be integers, or markers or characters converted to integers. 1971 Arguments may be integers, or markers or characters converted to integers.
1359 */ 1972 */
1360 (int nargs, Lisp_Object *args)) 1973 (int nargs, Lisp_Object *args))
1361 { 1974 {
1975 #ifdef HAVE_BIGNUM
1976 REGISTER int i;
1977 Lisp_Object result, other;
1978
1979 if (nargs == 0)
1980 return make_int (~0);
1981
1982 while (!(CHARP (args[0]) || MARKERP (args[0]) || INTEGERP (args[0])))
1983 args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]);
1984
1985 result = args[0];
1986 if (CHARP (result))
1987 result = make_int (XCHAR (result));
1988 else if (MARKERP (result))
1989 result = make_int (marker_position (result));
1990 for (i = 1; i < nargs; i++)
1991 {
1992 while (!(CHARP (args[i]) || MARKERP (args[i]) || INTEGERP (args[i])))
1993 args[i] = wrong_type_argument (Qnumber_char_or_marker_p, args[i]);
1994 other = args[i];
1995 switch (promote_args (&result, &other))
1996 {
1997 case FIXNUM_T:
1998 /* This looks evil, but it isn't. The bits identifying the objects
1999 as fixnums will be present in both, so & will preserve them.
2000 The only bits possibly turned off are the actual data bits. */
2001 result &= other;
2002 break;
2003 case BIGNUM_T:
2004 bignum_and (scratch_bignum, XBIGNUM_DATA (result),
2005 XBIGNUM_DATA (other));
2006 result = make_bignum_bg (scratch_bignum);
2007 break;
2008 }
2009 }
2010 return Fcanonicalize_number (result);
2011 #else /* !HAVE_BIGNUM */
1362 EMACS_INT bits = ~0; 2012 EMACS_INT bits = ~0;
1363 Lisp_Object *args_end = args + nargs; 2013 Lisp_Object *args_end = args + nargs;
1364 2014
1365 while (args < args_end) 2015 while (args < args_end)
1366 bits &= integer_char_or_marker_to_int (*args++); 2016 bits &= integer_char_or_marker_to_int (*args++);
1367 2017
1368 return make_int (bits); 2018 return make_int (bits);
2019 #endif /* HAVE_BIGNUM */
1369 } 2020 }
1370 2021
1371 DEFUN ("logior", Flogior, 0, MANY, 0, /* 2022 DEFUN ("logior", Flogior, 0, MANY, 0, /*
1372 Return bitwise-or of all the arguments. 2023 Return bitwise-or of all the arguments.
1373 Arguments may be integers, or markers or characters converted to integers. 2024 Arguments may be integers, or markers or characters converted to integers.
1374 */ 2025 */
1375 (int nargs, Lisp_Object *args)) 2026 (int nargs, Lisp_Object *args))
1376 { 2027 {
2028 #ifdef HAVE_BIGNUM
2029 REGISTER int i;
2030 Lisp_Object result, other;
2031
2032 if (nargs == 0)
2033 return make_int (0);
2034
2035 while (!(CHARP (args[0]) || MARKERP (args[0]) || INTEGERP (args[0])))
2036 args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]);
2037
2038 result = args[0];
2039 if (CHARP (result))
2040 result = make_int (XCHAR (result));
2041 else if (MARKERP (result))
2042 result = make_int (marker_position (result));
2043 for (i = 1; i < nargs; i++)
2044 {
2045 while (!(CHARP (args[i]) || MARKERP (args[i]) || INTEGERP (args[i])))
2046 args[i] = wrong_type_argument (Qnumber_char_or_marker_p, args[i]);
2047 other = args[i];
2048 switch (promote_args (&result, &other))
2049 {
2050 case FIXNUM_T:
2051 /* This looks evil, but it isn't. The bits identifying the objects
2052 as fixnums are the same in both, so | will preserve them. The
2053 only bits possibly turned on are the actual data bits. */
2054 result |= other;
2055 break;
2056 case BIGNUM_T:
2057 bignum_ior (scratch_bignum, XBIGNUM_DATA (result),
2058 XBIGNUM_DATA (other));
2059 result = make_bignum_bg (scratch_bignum);
2060 break;
2061 }
2062 }
2063 return Fcanonicalize_number (result);
2064 #else /* !HAVE_BIGNUM */
1377 EMACS_INT bits = 0; 2065 EMACS_INT bits = 0;
1378 Lisp_Object *args_end = args + nargs; 2066 Lisp_Object *args_end = args + nargs;
1379 2067
1380 while (args < args_end) 2068 while (args < args_end)
1381 bits |= integer_char_or_marker_to_int (*args++); 2069 bits |= integer_char_or_marker_to_int (*args++);
1382 2070
1383 return make_int (bits); 2071 return make_int (bits);
2072 #endif /* HAVE_BIGNUM */
1384 } 2073 }
1385 2074
1386 DEFUN ("logxor", Flogxor, 0, MANY, 0, /* 2075 DEFUN ("logxor", Flogxor, 0, MANY, 0, /*
1387 Return bitwise-exclusive-or of all the arguments. 2076 Return bitwise-exclusive-or of all the arguments.
1388 Arguments may be integers, or markers or characters converted to integers. 2077 Arguments may be integers, or markers or characters converted to integers.
1389 */ 2078 */
1390 (int nargs, Lisp_Object *args)) 2079 (int nargs, Lisp_Object *args))
1391 { 2080 {
2081 #ifdef HAVE_BIGNUM
2082 REGISTER int i;
2083 Lisp_Object result, other;
2084
2085 if (nargs == 0)
2086 return make_int (0);
2087
2088 while (!(CHARP (args[0]) || MARKERP (args[0]) || INTEGERP (args[0])))
2089 args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]);
2090
2091 result = args[0];
2092 if (CHARP (result))
2093 result = make_int (XCHAR (result));
2094 else if (MARKERP (result))
2095 result = make_int (marker_position (result));
2096 for (i = 1; i < nargs; i++)
2097 {
2098 while (!(CHARP (args[i]) || MARKERP (args[i]) || INTEGERP (args[i])))
2099 args[i] = wrong_type_argument (Qnumber_char_or_marker_p, args[i]);
2100 other = args[i];
2101 if (promote_args (&result, &other) == FIXNUM_T)
2102 {
2103 result = make_int (XREALINT (result) ^ XREALINT (other));
2104 }
2105 else
2106 {
2107 bignum_xor (scratch_bignum, XBIGNUM_DATA (result),
2108 XBIGNUM_DATA (other));
2109 result = make_bignum_bg (scratch_bignum);
2110 }
2111 }
2112 return Fcanonicalize_number (result);
2113 #else /* !HAVE_BIGNUM */
1392 EMACS_INT bits = 0; 2114 EMACS_INT bits = 0;
1393 Lisp_Object *args_end = args + nargs; 2115 Lisp_Object *args_end = args + nargs;
1394 2116
1395 while (args < args_end) 2117 while (args < args_end)
1396 bits ^= integer_char_or_marker_to_int (*args++); 2118 bits ^= integer_char_or_marker_to_int (*args++);
1397 2119
1398 return make_int (bits); 2120 return make_int (bits);
2121 #endif /* !HAVE_BIGNUM */
1399 } 2122 }
1400 2123
1401 DEFUN ("lognot", Flognot, 1, 1, 0, /* 2124 DEFUN ("lognot", Flognot, 1, 1, 0, /*
1402 Return the bitwise complement of NUMBER. 2125 Return the bitwise complement of NUMBER.
1403 NUMBER may be an integer, marker or character converted to integer. 2126 NUMBER may be an integer, marker or character converted to integer.
1404 */ 2127 */
1405 (number)) 2128 (number))
1406 { 2129 {
2130 #ifdef HAVE_BIGNUM
2131 if (BIGNUMP (number))
2132 {
2133 bignum_not (scratch_bignum, XBIGNUM_DATA (number));
2134 return make_bignum_bg (scratch_bignum);
2135 }
2136 #endif /* HAVE_BIGNUM */
1407 return make_int (~ integer_char_or_marker_to_int (number)); 2137 return make_int (~ integer_char_or_marker_to_int (number));
1408 } 2138 }
1409 2139
1410 DEFUN ("%", Frem, 2, 2, 0, /* 2140 DEFUN ("%", Frem, 2, 2, 0, /*
1411 Return remainder of first arg divided by second. 2141 Return remainder of first arg divided by second.
1412 Both must be integers, characters or markers. 2142 Both must be integers, characters or markers.
1413 */ 2143 */
1414 (number1, number2)) 2144 (number1, number2))
1415 { 2145 {
2146 #ifdef HAVE_BIGNUM
2147 while (!(CHARP (number1) || MARKERP (number1) || INTEGERP (number1)))
2148 number1 = wrong_type_argument (Qnumber_char_or_marker_p, number1);
2149 while (!(CHARP (number2) || MARKERP (number2) || INTEGERP (number2)))
2150 number2 = wrong_type_argument (Qnumber_char_or_marker_p, number2);
2151
2152 if (promote_args (&number1, &number2) == FIXNUM_T)
2153 {
2154 if (XREALINT (number2) == 0)
2155 Fsignal (Qarith_error, Qnil);
2156 return make_int (XREALINT (number1) % XREALINT (number2));
2157 }
2158 else
2159 {
2160 if (bignum_sign (XBIGNUM_DATA (number2)) == 0)
2161 Fsignal (Qarith_error, Qnil);
2162 bignum_mod (scratch_bignum, XBIGNUM_DATA (number1),
2163 XBIGNUM_DATA (number2));
2164 return Fcanonicalize_number (make_bignum_bg (scratch_bignum));
2165 }
2166 #else /* !HAVE_BIGNUM */
1416 EMACS_INT ival1 = integer_char_or_marker_to_int (number1); 2167 EMACS_INT ival1 = integer_char_or_marker_to_int (number1);
1417 EMACS_INT ival2 = integer_char_or_marker_to_int (number2); 2168 EMACS_INT ival2 = integer_char_or_marker_to_int (number2);
1418 2169
1419 if (ival2 == 0) 2170 if (ival2 == 0)
1420 Fsignal (Qarith_error, Qnil); 2171 Fsignal (Qarith_error, Qnil);
1421 2172
1422 return make_int (ival1 % ival2); 2173 return make_int (ival1 % ival2);
2174 #endif /* HAVE_BIGNUM */
1423 } 2175 }
1424 2176
1425 /* Note, ANSI *requires* the presence of the fmod() library routine. 2177 /* Note, ANSI *requires* the presence of the fmod() library routine.
1426 If your system doesn't have it, complain to your vendor, because 2178 If your system doesn't have it, complain to your vendor, because
1427 that is a bug. */ 2179 that is a bug. */
1443 Both X and Y must be numbers, characters or markers. 2195 Both X and Y must be numbers, characters or markers.
1444 If either argument is a float, a float will be returned. 2196 If either argument is a float, a float will be returned.
1445 */ 2197 */
1446 (x, y)) 2198 (x, y))
1447 { 2199 {
2200 #ifdef WITH_NUMBER_TYPES
2201 while (!(CHARP (x) || MARKERP (x) || REALP (x)))
2202 x = wrong_type_argument (Qnumber_char_or_marker_p, x);
2203 while (!(CHARP (y) || MARKERP (y) || REALP (y)))
2204 y = wrong_type_argument (Qnumber_char_or_marker_p, y);
2205 switch (promote_args (&x, &y))
2206 {
2207 case FIXNUM_T:
2208 {
2209 EMACS_INT ival;
2210 if (XREALINT (y) == 0) goto divide_by_zero;
2211 ival = XREALINT (x) % XREALINT (y);
2212 /* If the "remainder" comes out with the wrong sign, fix it. */
2213 if (XREALINT (y) < 0 ? ival > 0 : ival < 0)
2214 ival += XREALINT (y);
2215 return make_int (ival);
2216 }
2217 #ifdef HAVE_BIGNUM
2218 case BIGNUM_T:
2219 if (bignum_sign (XBIGNUM_DATA (y)) == 0) goto divide_by_zero;
2220 bignum_mod (scratch_bignum, XBIGNUM_DATA (x), XBIGNUM_DATA (y));
2221 return Fcanonicalize_number (make_bignum_bg (scratch_bignum));
2222 #endif
2223 #ifdef HAVE_RATIO
2224 case RATIO_T:
2225 if (ratio_sign (XRATIO_DATA (y)) == 0) goto divide_by_zero;
2226 ratio_div (scratch_ratio, XRATIO_DATA (x), XRATIO_DATA (y));
2227 bignum_div (scratch_bignum, ratio_numerator (scratch_ratio),
2228 ratio_denominator (scratch_ratio));
2229 ratio_set_bignum (scratch_ratio, scratch_bignum);
2230 ratio_mul (scratch_ratio, scratch_ratio, XRATIO_DATA (y));
2231 ratio_sub (scratch_ratio, XRATIO_DATA (x), scratch_ratio);
2232 return Fcanonicalize_number (make_ratio_rt (scratch_ratio));
2233 #endif
2234 case FLOAT_T:
2235 {
2236 double dval;
2237 if (XFLOAT_DATA (y) == 0.0) goto divide_by_zero;
2238 dval = fmod (XFLOAT_DATA (x), XFLOAT_DATA (y));
2239 /* If the "remainder" comes out with the wrong sign, fix it. */
2240 if (XFLOAT_DATA (y) < 0 ? dval > 0 : dval < 0)
2241 dval += XFLOAT_DATA (y);
2242 return make_float (dval);
2243 }
2244 #ifdef HAVE_BIGFLOAT
2245 case BIGFLOAT_T:
2246 bigfloat_set_prec (scratch_bigfloat,
2247 max (XBIGFLOAT_GET_PREC (x), XBIGFLOAT_GET_PREC (y)));
2248 bigfloat_div (scratch_bigfloat, XBIGFLOAT_DATA (x), XBIGFLOAT_DATA (y));
2249 bigfloat_trunc (scratch_bigfloat, scratch_bigfloat);
2250 bigfloat_mul (scratch_bigfloat, scratch_bigfloat, XBIGFLOAT_DATA (y));
2251 bigfloat_sub (scratch_bigfloat, XBIGFLOAT_DATA (x), scratch_bigfloat);
2252 return make_bigfloat_bf (scratch_bigfloat);
2253 #endif
2254 }
2255 #else /* !WITH_NUMBER_TYPES */
1448 int_or_double iod1, iod2; 2256 int_or_double iod1, iod2;
1449 number_char_or_marker_to_int_or_double (x, &iod1); 2257 number_char_or_marker_to_int_or_double (x, &iod1);
1450 number_char_or_marker_to_int_or_double (y, &iod2); 2258 number_char_or_marker_to_int_or_double (y, &iod2);
1451 2259
1452 if (!iod1.int_p || !iod2.int_p) 2260 if (!iod1.int_p || !iod2.int_p)
1473 if (iod2.c.ival < 0 ? ival > 0 : ival < 0) 2281 if (iod2.c.ival < 0 ? ival > 0 : ival < 0)
1474 ival += iod2.c.ival; 2282 ival += iod2.c.ival;
1475 2283
1476 return make_int (ival); 2284 return make_int (ival);
1477 } 2285 }
2286 #endif /* WITH_NUMBER_TYPES */
1478 2287
1479 divide_by_zero: 2288 divide_by_zero:
1480 Fsignal (Qarith_error, Qnil); 2289 Fsignal (Qarith_error, Qnil);
1481 return Qnil; /* not (usually) reached */ 2290 return Qnil; /* not (usually) reached */
1482 } 2291 }
1483 2292
1484 DEFUN ("ash", Fash, 2, 2, 0, /* 2293 DEFUN ("ash", Fash, 2, 2, 0, /*
1485 Return VALUE with its bits shifted left by COUNT. 2294 Return VALUE with its bits shifted left by COUNT.
1486 If COUNT is negative, shifting is actually to the right. 2295 If COUNT is negative, shifting is actually to the right.
1487 In this case, the sign bit is duplicated. 2296 In this case, the sign bit is duplicated.
2297 This function cannot be applied to bignums, as there is no leftmost sign bit
2298 to be duplicated. Use `lsh' instead.
1488 */ 2299 */
1489 (value, count)) 2300 (value, count))
1490 { 2301 {
1491 CHECK_INT_COERCE_CHAR (value); 2302 CHECK_INT_COERCE_CHAR (value);
1492 CONCHECK_INT (count); 2303 CONCHECK_INT (count);
1501 If COUNT is negative, shifting is actually to the right. 2312 If COUNT is negative, shifting is actually to the right.
1502 In this case, zeros are shifted in on the left. 2313 In this case, zeros are shifted in on the left.
1503 */ 2314 */
1504 (value, count)) 2315 (value, count))
1505 { 2316 {
2317 #ifdef HAVE_BIGNUM
2318 while (!(CHARP (value) || MARKERP (value) || INTEGERP (value)))
2319 wrong_type_argument (Qnumber_char_or_marker_p, value);
2320 CONCHECK_INTEGER (count);
2321
2322 if (promote_args (&value, &count) == FIXNUM_T)
2323 {
2324 if (XREALINT (count) <= 0)
2325 return make_int (XREALINT (value) >> -XREALINT (count));
2326 /* Use bignums to avoid overflow */
2327 bignum_set_long (scratch_bignum2, XREALINT (value));
2328 bignum_lshift (scratch_bignum, scratch_bignum2, XREALINT (count));
2329 return Fcanonicalize_number (make_bignum_bg (scratch_bignum));
2330 }
2331 else
2332 {
2333 if (bignum_sign (XBIGNUM_DATA (count)) <= 0)
2334 {
2335 bignum_neg (scratch_bignum, XBIGNUM_DATA (count));
2336 if (!bignum_fits_ulong_p (scratch_bignum))
2337 args_out_of_range (Qnumber_char_or_marker_p, count);
2338 bignum_rshift (scratch_bignum2, XBIGNUM_DATA (value),
2339 bignum_to_ulong (scratch_bignum));
2340 }
2341 else
2342 {
2343 if (!bignum_fits_ulong_p (XBIGNUM_DATA (count)))
2344 args_out_of_range (Qnumber_char_or_marker_p, count);
2345 bignum_lshift (scratch_bignum2, XBIGNUM_DATA (value),
2346 bignum_to_ulong (XBIGNUM_DATA (count)));
2347 }
2348 return Fcanonicalize_number (make_bignum_bg (scratch_bignum2));
2349 }
2350 #else /* !HAVE_BIGNUM */
1506 CHECK_INT_COERCE_CHAR (value); 2351 CHECK_INT_COERCE_CHAR (value);
1507 CONCHECK_INT (count); 2352 CONCHECK_INT (count);
1508 2353
1509 return make_int (XINT (count) > 0 ? 2354 return make_int (XINT (count) > 0 ?
1510 XUINT (value) << XINT (count) : 2355 XUINT (value) << XINT (count) :
1511 XUINT (value) >> -XINT (count)); 2356 XUINT (value) >> -XINT (count));
2357 #endif /* HAVE_BIGNUM */
1512 } 2358 }
1513 2359
1514 DEFUN ("1+", Fadd1, 1, 1, 0, /* 2360 DEFUN ("1+", Fadd1, 1, 1, 0, /*
1515 Return NUMBER plus one. NUMBER may be a number, character or marker. 2361 Return NUMBER plus one. NUMBER may be a number, character or marker.
1516 Markers and characters are converted to integers. 2362 Markers and characters are converted to integers.
1517 */ 2363 */
1518 (number)) 2364 (number))
1519 { 2365 {
1520 retry: 2366 retry:
1521 2367
1522 if (INTP (number)) return make_int (XINT (number) + 1); 2368 if (INTP (number)) return make_integer (XINT (number) + 1);
1523 if (CHARP (number)) return make_int (XCHAR (number) + 1); 2369 if (CHARP (number)) return make_integer (XCHAR (number) + 1);
1524 if (MARKERP (number)) return make_int (marker_position (number) + 1); 2370 if (MARKERP (number)) return make_integer (marker_position (number) + 1);
1525 if (FLOATP (number)) return make_float (XFLOAT_DATA (number) + 1.0); 2371 if (FLOATP (number)) return make_float (XFLOAT_DATA (number) + 1.0);
2372 #ifdef HAVE_BIGNUM
2373 if (BIGNUMP (number))
2374 {
2375 bignum_set_long (scratch_bignum, 1L);
2376 bignum_add (scratch_bignum2, XBIGNUM_DATA (number), scratch_bignum);
2377 return Fcanonicalize_number (make_bignum_bg (scratch_bignum2));
2378 }
2379 #endif
2380 #ifdef HAVE_RATIO
2381 if (RATIOP (number))
2382 {
2383 ratio_set_long (scratch_ratio, 1L);
2384 ratio_add (scratch_ratio, XRATIO_DATA (number), scratch_ratio);
2385 /* No need to canonicalize after adding 1 */
2386 return make_ratio_rt (scratch_ratio);
2387 }
2388 #endif
2389 #ifdef HAVE_BIGFLOAT
2390 if (BIGFLOATP (number))
2391 {
2392 bigfloat_set_prec (scratch_bigfloat, XBIGFLOAT_GET_PREC (number));
2393 bigfloat_set_long (scratch_bigfloat, 1L);
2394 bigfloat_add (scratch_bigfloat, XBIGFLOAT_DATA (number),
2395 scratch_bigfloat);
2396 return make_bigfloat_bf (scratch_bigfloat);
2397 }
2398 #endif
1526 2399
1527 number = wrong_type_argument (Qnumber_char_or_marker_p, number); 2400 number = wrong_type_argument (Qnumber_char_or_marker_p, number);
1528 goto retry; 2401 goto retry;
1529 } 2402 }
1530 2403
1534 */ 2407 */
1535 (number)) 2408 (number))
1536 { 2409 {
1537 retry: 2410 retry:
1538 2411
1539 if (INTP (number)) return make_int (XINT (number) - 1); 2412 if (INTP (number)) return make_integer (XINT (number) - 1);
1540 if (CHARP (number)) return make_int (XCHAR (number) - 1); 2413 if (CHARP (number)) return make_integer (XCHAR (number) - 1);
1541 if (MARKERP (number)) return make_int (marker_position (number) - 1); 2414 if (MARKERP (number)) return make_integer (marker_position (number) - 1);
1542 if (FLOATP (number)) return make_float (XFLOAT_DATA (number) - 1.0); 2415 if (FLOATP (number)) return make_float (XFLOAT_DATA (number) - 1.0);
2416 #ifdef HAVE_BIGNUM
2417 if (BIGNUMP (number))
2418 {
2419 bignum_set_long (scratch_bignum, 1L);
2420 bignum_sub (scratch_bignum2, XBIGNUM_DATA (number), scratch_bignum);
2421 return Fcanonicalize_number (make_bignum_bg (scratch_bignum2));
2422 }
2423 #endif
2424 #ifdef HAVE_RATIO
2425 if (RATIOP (number))
2426 {
2427 ratio_set_long (scratch_ratio, 1L);
2428 ratio_sub (scratch_ratio, XRATIO_DATA (number), scratch_ratio);
2429 /* No need to canonicalize after subtracting 1 */
2430 return make_ratio_rt (scratch_ratio);
2431 }
2432 #endif
2433 #ifdef HAVE_BIGFLOAT
2434 if (BIGFLOATP (number))
2435 {
2436 bigfloat_set_prec (scratch_bigfloat, XBIGFLOAT_GET_PREC (number));
2437 bigfloat_set_long (scratch_bigfloat, 1L);
2438 bigfloat_sub (scratch_bigfloat, XBIGFLOAT_DATA (number),
2439 scratch_bigfloat);
2440 return make_bigfloat_bf (scratch_bigfloat);
2441 }
2442 #endif
1543 2443
1544 number = wrong_type_argument (Qnumber_char_or_marker_p, number); 2444 number = wrong_type_argument (Qnumber_char_or_marker_p, number);
1545 goto retry; 2445 goto retry;
1546 } 2446 }
1547 2447
2485 DEFSYMBOL (Qsubrp); 3385 DEFSYMBOL (Qsubrp);
2486 DEFSYMBOL (Qsymbolp); 3386 DEFSYMBOL (Qsymbolp);
2487 DEFSYMBOL (Qintegerp); 3387 DEFSYMBOL (Qintegerp);
2488 DEFSYMBOL (Qcharacterp); 3388 DEFSYMBOL (Qcharacterp);
2489 DEFSYMBOL (Qnatnump); 3389 DEFSYMBOL (Qnatnump);
3390 DEFSYMBOL (Qnonnegativep);
2490 DEFSYMBOL (Qstringp); 3391 DEFSYMBOL (Qstringp);
2491 DEFSYMBOL (Qarrayp); 3392 DEFSYMBOL (Qarrayp);
2492 DEFSYMBOL (Qsequencep); 3393 DEFSYMBOL (Qsequencep);
2493 DEFSYMBOL (Qbufferp); 3394 DEFSYMBOL (Qbufferp);
2494 DEFSYMBOL (Qbitp); 3395 DEFSYMBOL (Qbitp);
2506 DEFSYMBOL_MULTIWORD_PREDICATE (Qweak_listp); 3407 DEFSYMBOL_MULTIWORD_PREDICATE (Qweak_listp);
2507 DEFSYMBOL (Qfloatp); 3408 DEFSYMBOL (Qfloatp);
2508 3409
2509 DEFSUBR (Fwrong_type_argument); 3410 DEFSUBR (Fwrong_type_argument);
2510 3411
3412 #ifdef HAVE_RATIO
3413 DEFSUBR (Fdiv);
3414 #endif
2511 DEFSUBR (Feq); 3415 DEFSUBR (Feq);
2512 DEFSUBR (Fold_eq); 3416 DEFSUBR (Fold_eq);
2513 DEFSUBR (Fnull); 3417 DEFSUBR (Fnull);
2514 Ffset (intern ("not"), intern ("null")); 3418 Ffset (intern ("not"), intern ("null"));
2515 DEFSUBR (Flistp); 3419 DEFSUBR (Flistp);
2521 DEFSUBR (Fcharacterp); 3425 DEFSUBR (Fcharacterp);
2522 DEFSUBR (Fchar_int_p); 3426 DEFSUBR (Fchar_int_p);
2523 DEFSUBR (Fchar_to_int); 3427 DEFSUBR (Fchar_to_int);
2524 DEFSUBR (Fint_to_char); 3428 DEFSUBR (Fint_to_char);
2525 DEFSUBR (Fchar_or_char_int_p); 3429 DEFSUBR (Fchar_or_char_int_p);
3430 #ifdef HAVE_BIGNUM
3431 DEFSUBR (Ffixnump);
3432 #else
2526 DEFSUBR (Fintegerp); 3433 DEFSUBR (Fintegerp);
3434 #endif
2527 DEFSUBR (Finteger_or_marker_p); 3435 DEFSUBR (Finteger_or_marker_p);
2528 DEFSUBR (Finteger_or_char_p); 3436 DEFSUBR (Finteger_or_char_p);
2529 DEFSUBR (Finteger_char_or_marker_p); 3437 DEFSUBR (Finteger_char_or_marker_p);
2530 DEFSUBR (Fnumberp); 3438 DEFSUBR (Fnumberp);
2531 DEFSUBR (Fnumber_or_marker_p); 3439 DEFSUBR (Fnumber_or_marker_p);
2532 DEFSUBR (Fnumber_char_or_marker_p); 3440 DEFSUBR (Fnumber_char_or_marker_p);
2533 DEFSUBR (Ffloatp); 3441 DEFSUBR (Ffloatp);
2534 DEFSUBR (Fnatnump); 3442 DEFSUBR (Fnatnump);
3443 DEFSUBR (Fnonnegativep);
2535 DEFSUBR (Fsymbolp); 3444 DEFSUBR (Fsymbolp);
2536 DEFSUBR (Fkeywordp); 3445 DEFSUBR (Fkeywordp);
2537 DEFSUBR (Fstringp); 3446 DEFSUBR (Fstringp);
2538 DEFSUBR (Fvectorp); 3447 DEFSUBR (Fvectorp);
2539 DEFSUBR (Fbitp); 3448 DEFSUBR (Fbitp);