[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (random 0) => losing error message
From: jeff
> (random 0)
Error: 0 is not of type (INTEGER 0 *).
Signalled by RANDOM.
Unfortunately, 0 *is* of type (INTEGER 0 *). ....
There was a bug in the definition of the C function rando
in file c/num_rand.c. To fix the bug, first replace the if statement
if (number_compare(x, small_fixnum(0)) != 1)
FEwrong_type_argument(TSnon_negative_integer, x);
with
if (number_compare(x, small_fixnum(0)) != 1)
FEwrong_type_argument(TSpositive_number, x);
and add the following lines marked with "->" into three other files.
1. c/typespec.c:
object SA; /* symbol * */
-> object Splusp;
object TSor_symbol_string;
object TSor_string_symbol;
object TSor_symbol_string_package;
object TSnon_negative_integer;
-> object TSpositive_number;
object TSor_integer_float;
object TSor_rational_float;
.....
SA = make_ordinary("*");
enter_mark_origin(&SA);
-> Splusp = make_ordinary("PLUSP");
-> enter_mark_origin(&Splusp);
.....
TSnon_negative_integer
= make_cons(Sinteger,
make_cons(make_fixnum(0), make_cons(SA, Cnil)));
enter_mark_origin(&TSnon_negative_integer);
-> TSpositive_number = make_cons(Ssatisfies, make_cons(Splusp, Cnil));
-> enter_mark_origin(&TSpositive_number);
TSor_integer_float
= make_cons(Sor, make_cons(Sinteger, make_cons(Sfloat, Cnil)));
enter_mark_origin(&TSor_integer_float);
2. h/external.h:
object SA;
-> object Splusp;
object TSor_symbol_string;
object TSor_string_symbol;
object TSor_symbol_string_package;
object TSnon_negative_integer;
-> object TSpositive_number;
object TSor_integer_float;
3. h/att_ext.h: (You may not have this file.)
object SA;
-> object Splusp;
object TSor_symbol_string;
object TSor_string_symbol;
object TSor_symbol_string_package;
object TSnon_negative_integer;
-> object TSpositive_number;
object TSor_integer_float;
-- Taiichi