Skip to content

Conversation

@mhseiden
Copy link

@mhseiden mhseiden commented Jan 2, 2017

This fixes #18 by introducing a better implementation of Hash which improves the added tests such that neither has any collisions. Previously, the whole number test had ~50% unique hash codes, and the fractional test had ~80% unique hash codes.

Also, my auto-rustfmt kicked in on a few lines, hence the unrelated whitespace changes.

} else {
false
}
if other.as_ref().is_nan() { true } else { false }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it occurs to me that this should just be other.as_ref().is_nan() the if/else is totally unnecessary

note: I know this is just an automated whitespace change but if it's convenient feel free to make the change

impl Error for FloatIsNaN {
fn description(&self) -> &str {
return "NotNaN constructed with NaN"
return "NotNaN constructed with NaN";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could also just be the literal

@reem
Copy link
Owner

reem commented Jan 31, 2017

I noticed some random stuff that could be improved, but since it's unrelated to your excellent change I'll just go ahead and merge this.

@reem reem merged commit 7fcc0b6 into reem:master Jan 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hash impl is pretty poor

2 participants