Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hashCode should be stable for any scale #15

Open
a14n opened this issue Jan 19, 2025 · 0 comments
Open

hashCode should be stable for any scale #15

a14n opened this issue Jan 19, 2025 · 0 comments

Comments

@a14n
Copy link

a14n commented Jan 19, 2025

  var a = BigDecimal.parse('1.000');
  var b = BigDecimal.parse('1.00');
  // a and b are equal, but they have different hash codes
  print(a.hashCode);
  print(b.hashCode);
  print(a.hashCode == b.hashCode); // false (SHOULD be true)
  print(a == b); // true
  // so a set containing `a` does not contain `b` although they are equal
  print({a}.contains(b)); // false (SHOULD be true)
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

No branches or pull requests

1 participant