comparison src/number.h @ 5438:8d29f1c4bb98

Merge with 21.5 trunk.
author Mats Lidell <matsl@xemacs.org>
date Fri, 26 Nov 2010 06:43:36 +0100
parents b9167d522a9a c096d8051f89
children 56144c8593a8
comparison
equal deleted inserted replaced
5437:002cb5224e4f 5438:8d29f1c4bb98
148 148
149 extern Fixnum Vmost_negative_fixnum, Vmost_positive_fixnum; 149 extern Fixnum Vmost_negative_fixnum, Vmost_positive_fixnum;
150 EXFUN (Fintegerp, 1); 150 EXFUN (Fintegerp, 1);
151 EXFUN (Fevenp, 1); 151 EXFUN (Fevenp, 1);
152 EXFUN (Foddp, 1); 152 EXFUN (Foddp, 1);
153
154 /* There are varying mathematical definitions of what a natural number is,
155 differing about whether 0 is inside or outside the set. The Oxford
156 English Dictionary, second edition, does say that they are whole numbers,
157 not fractional, but it doesn't give a bound, and gives a quotation
158 talking about the natural numbers from 1 to 100. Since 100 is certainly
159 *not* the upper bound on natural numbers, we can't take 1 as the lower
160 bound from that example. The Real Academia Española's dictionary, not of
161 English but certainly sharing the western academic tradition, says of
162 "número natural":
163
164 1. m. Mat. Cada uno de los elementos de la sucesión 0, 1, 2, 3...
165
166 that is, "each of the elements of the succession 0, 1, 2, 3 ...". The
167 various Wikipedia articles in languages I can read agree. It's
168 reasonable to call this macro and the associated Lisp function
169 NATNUMP. */
170
171 #ifdef HAVE_BIGNUM
172 #define NATNUMP(x) ((INTP (x) && XINT (x) >= 0) || \
173 (BIGNUMP (x) && bignum_sign (XBIGNUM_DATA (x)) >= 0))
174 #else
175 #define NATNUMP(x) (INTP (x) && XINT (x) >= 0)
176 #endif
177
178 #define CHECK_NATNUM(x) do { \
179 if (!NATNUMP (x)) \
180 dead_wrong_type_argument (Qnatnump, x); \
181 } while (0)
182
183 #define CONCHECK_NATNUM(x) do { \
184 if (!NATNUMP (x)) \
185 x = wrong_type_argument (Qnatnump, x); \
186 } while (0)
153 187
154 188
155 /********************************** Ratios **********************************/ 189 /********************************** Ratios **********************************/
156 #ifdef HAVE_RATIO 190 #ifdef HAVE_RATIO
157 191