2
Copyright (C) 1994 M. Hagiya, W. Schelter, T. Yuasa
4
This file is part of GNU Common Lisp, herein referred to as GCL
6
GCL is free software; you can redistribute it and/or modify it under
7
the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE as published by
8
the Free Software Foundation; either version 2, or (at your option)
11
GCL is distributed in the hope that it will be useful, but WITHOUT
12
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14
License for more details.
16
You should have received a copy of the GNU Library General Public License
17
along with GCL; see the file COPYING. If not, write to the Free Software
18
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27
#include "num_include.h"
31
number_zerop(object x)
58
return(number_zerop(x->cmp.cmp_real) &&
59
number_zerop(x->cmp.cmp_imag));
62
FEwrong_type_argument(sLnumber, x);
68
number_plusp(object x)
85
if (number_plusp(x->rat.rat_num))
103
FEwrong_type_argument(TSor_rational_float,x);
109
number_minusp(object x)
111
switch (type_of(x)) {
126
if (number_minusp(x->rat.rat_num))
144
FEwrong_type_argument(TSor_rational_float,x);
150
number_oddp(object x)
154
if (type_of(x) == t_fixnum)
156
else if (type_of(x) == t_bignum)
157
i = MP_LOW(MP(x),lgef(MP(x)));
159
FEwrong_type_argument(sLinteger, x);
164
number_evenp(object x)
168
if (type_of(x) == t_fixnum)
170
else if (type_of(x) == t_bignum)
171
i = MP_LOW(MP(x),lgef(MP(x)));
173
FEwrong_type_argument(sLinteger, x);
180
check_type_number(&vs_base[0]);
181
if (number_zerop(vs_base[0]))
190
check_type_or_rational_float(&vs_base[0]);
191
if (number_plusp(vs_base[0]))
200
check_type_or_rational_float(&vs_base[0]);
201
if (number_minusp(vs_base[0]))
210
check_type_integer(&vs_base[0]);
211
if (number_oddp(vs_base[0]))
220
check_type_integer(&vs_base[0]);
221
if (number_evenp(vs_base[0]))
227
/* this is just to force things into memory in num_co.c */
228
/* static void _assure_in_memory (void *p) */
234
/* lf_eqlp(double *p, double *q) */
236
/* return *p == *q; */
241
gcl_init_num_pred(void)
244
big_register_1 = new_bignum();
245
ZERO_BIG(big_register_1);
246
enter_mark_origin(&big_register_1);
248
make_function("ZEROP", Lzerop);
249
make_function("PLUSP", Lplusp);
250
make_function("MINUSP", Lminusp);
251
make_function("ODDP", Loddp);
252
make_function("EVENP", Levenp);