39 return cell_a->
tag.value == cell_b->
tag.value;
48 return nilp(
string ) ||
62 long double fa = fabsl( a );
63 long double fb = fabsl( b );
65 long double diff = fabsl( fa - fb );
67 long double av = ( fa > fb ) ? ( fa - diff ) : ( fb - diff );
69 long double tolerance = av * 0.000000001;
71 bool result = ( fabsl( a - b ) < tolerance );
102 L
"\nequality is not yet implemented for bignums compared to reals." );
128 switch ( cell_b->
tag.value ) {
163 switch ( cell_b->
tag.value ) {
196 bool result =
eq( a, b );
207 switch ( cell_a->
tag.value ) {
215 switch ( cell_b->
tag.value ) {
253 bool result =
eq( a, b );
259 switch ( cell_a->
tag.value ) {
283 && cell_a->
payload.string.character ==
284 cell_b->
payload.string.character
294 ( cell_a->
payload.integer.value ==
295 cell_b->
payload.integer.value ) &&
297 cell_b->
payload.integer.more );
306 double max = fabs( num_a ) > fabs( num_b )
313 result = fabs( num_a - num_b ) < ( max / 1000000.0 );
#define KEYTV
The string KEYW, considered as an unsigned int.
#define SYMBOLTV
The string SYMB, considered as an unsigned int.
union cons_space_object::@2 tag
union cons_space_object::@3 payload
uint32_t page
the index of the page on which this cell resides
#define STRINGTV
The string STRG, considered as an unsigned int.
#define INTEGERTV
The string INTR, considered as an unsigned int.
#define RATIOTV
The string RTIO, considered as an unsigned int.
#define CONSTV
The string CONS, considered as an unsigned int.
#define nilp(conspoint)
true if conspoint points to the special cell NIL, else false (there should only be one of these so it...
#define NLAMBDATV
The string NLMD, considered as an unsigned int.
uint32_t offset
the index of the cell within the page
#define REALTV
The string REAL, considered as an unsigned int.
#define LAMBDATV
The string LMDA, considered as an unsigned int.
#define pointer2cell(pointer)
given a cons_pointer as argument, return the cell.
#define numberp(conspoint)
true if conspoint points to some sort of a number cell, else false
An indirect pointer to a cons cell.
void debug_printf(int level, wchar_t *format,...)
wprintf adapted for the debug logging system.
void debug_print(wchar_t *message, int level)
print this debug message to stderr, if verbosity matches level.
void debug_print_object(struct cons_pointer pointer, int level)
print the object indicated by this pointer to stderr, if verbosity matches level.
#define DEBUG_ARITH
Print messages debugging arithmetic operations.
bool equal_ld_ld(long double a, long double b)
compare two long doubles and returns true if they are the same to within a tolerance of one part in a...
bool equal_integer_number(struct cons_pointer a, struct cons_pointer b)
Private function, don't use.
bool equal_number_number(struct cons_pointer a, struct cons_pointer b)
Private function, don't use.
bool same_type(struct cons_pointer a, struct cons_pointer b)
True if the objects at these two cons pointers have the same tag, else false.
bool equal_integer_real(struct cons_pointer a, struct cons_pointer b)
Private function, don't use.
bool end_of_string(struct cons_pointer string)
Some strings will be null terminated and some will be NIL terminated... ooops!
bool equal_real_number(struct cons_pointer a, struct cons_pointer b)
Private function, don't use.
bool equal(struct cons_pointer a, struct cons_pointer b)
Deep, and thus expensive, equality: true if these two objects have identical structure,...
bool eq(struct cons_pointer a, struct cons_pointer b)
Shallow, and thus cheap, equality: true if these two objects are the same object, else false.
bool equal_integer_integer(struct cons_pointer a, struct cons_pointer b)
true if a and be are both integers whose value is the same value.
long double to_long_double(struct cons_pointer arg)
Return the closest possible binary64 representation to the value of this arg, expected to be an integ...
long double c_ratio_to_ld(struct cons_pointer rat)
convert a ratio to an equivalent long double.
bool equal_ratio_ratio(struct cons_pointer a, struct cons_pointer b)
True if a and be are identical rationals, else false.