Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Two d128 values are equal, but their hashes aren't #66

@mispecto

Description

@mispecto

Here's reproduction:

let d1 = d128::from_str("0.12342342000000000").unwrap();
let d2 = d128::from_str("0.12342342").unwrap();
assert_eq!(d1, d2); // Succeeds

let mut hasher1 = DefaultHasher::new();
d1.hash(&mut hasher1);
let h1 = hasher1.finish();

let mut hasher2 = DefaultHasher::new();
d2.hash(&mut hasher2);
let h2 = hasher2.finish();

assert_eq!(h1, h2); // Crashes on 'assertion failed: `(left == right)` left: `14437253609867582409`, right: `1217654567999082045`'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions