(SXHASH -0.0) != (SXHASH 0.0)

This commit is contained in:
Juan Jose Garcia Ripoll 2008-12-23 12:43:01 +01:00
parent 020af55b65
commit e6b3b6d944
2 changed files with 31 additions and 0 deletions

View file

@ -29,6 +29,8 @@ ECL 9.1.0:
- (FLOOR X X), (CEILING X X), etc, might return a second value which is a
signed zero if X is a float with a negative sign.
- (SXHASH -0.0) != (SXHASH 0.0)
;;; Local Variables: ***
;;; mode:text ***
;;; fill-column:79 ***

View file

@ -117,6 +117,35 @@ _hash_equal(int depth, cl_hashkey h, cl_object x)
return hash_string(h, x->vector.self.ch, x->vector.fillp / 8);
case t_random:
return _hash_equal(0, h, x->random.value);
#ifdef ECL_SIGNED_ZERO
# ifdef ECL_SHORT_FLOAT
case t_shortfloat: {
float f = ecl_short_float(x);
return hash_string(h, (unsigned char*)&f, sizeof(f));
}
# endif
case t_singlefloat: {
float f = sf(x);
if (f == 0.0) f = 0.0;
return hash_string(h, (unsigned char*)&f, sizeof(f));
}
case t_doublefloat: {
double f = df(x);
if (f == 0.0) f = 0.0;
return hash_string(h, (unsigned char*)&f, sizeof(f));
}
# ifdef ECL_LONG_FLOAT
case t_longfloat: {
long double f = ecl_long_float(x);
if (f == 0.0) f = 0.0;
return hash_string(h, (unsigned char*)&f, sizeof(f));
}
# endif
case t_complex: {
h = _hash_equal(depth, h, x->complex.real);
return _hash_equal(depth, h, x->complex.imag);
}
#endif
default:
return _hash_eql(h, x);
}