-
Notifications
You must be signed in to change notification settings - Fork 143
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
What is the right way to compare 2 currency values? #303
Comments
Right now, there's no built in way to determine equality, but both var c1 = currency(2.52).subtract(.01);
var c2 = currency(2.50).add(.01);
c1.value === c2.value; // => true There is a babel plugin that makes it so you can do straight up comparisons: currency(1.23) === currency(1.23); // => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't see any method like
equals
to comparecurrency1.equals(currency2)
. What is the right way for comparing values?Is
c1.value === c2.value
safe considering floating point precision?Please take under consideration implementing .equals, or .compare() method :)
The text was updated successfully, but these errors were encountered: