You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this is intended but calling number.hashCode is equivalent to number.toInt().
class _Double extends _Num implements double {
// ...
int get _identityHashCode {
if (isNaN || isInfinite) return 0;
return toInt();
}
}
This of course means that 3.14, 3.14159 and 3.9 all have the same hashCode. It gets even more confusing when you're trying to do hashCodes of numbers that are close to zero because 0 suggests some kind of other problem.
Not sure if this is intended but calling
number.hashCode
is equivalent tonumber.toInt()
.This of course means that
3.14
,3.14159
and3.9
all have the same hashCode. It gets even more confusing when you're trying to do hashCodes of numbers that are close to zero because0
suggests some kind of other problem.It would be useful to have something like Java's Double.hashCode().
The text was updated successfully, but these errors were encountered: