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

What to do about Utils.toFixedNumber usages? #243

Closed
zepumph opened this issue Nov 17, 2020 · 4 comments
Closed

What to do about Utils.toFixedNumber usages? #243

zepumph opened this issue Nov 17, 2020 · 4 comments
Assignees

Comments

@zepumph
Copy link
Member

zepumph commented Nov 17, 2020

There are currently 18 usages of Utils.toFixedNumber( . . . , 6 );. This is because lots of code in the sim uses triple equals (===) to perform certain functions. I don't know if this problem is generally avoidable, or if I just need to do a better job of factoring this out.

@zepumph
Copy link
Member Author

zepumph commented Dec 10, 2020

Over in #279 (comment) it seems like using Utils.toFixedNumber is not working as a general solution, error is being collected that shows up in the 6th decimal place.

@zepumph
Copy link
Member Author

zepumph commented Dec 10, 2020

After speaking with @jonathanolson,

We think that the issue is that I was rounding stored values in the model, instead of just rounding when comparing/displaying in the view. I will refactor the model to store as granular of numbers as possible and hopefully all will work out. Thanks JO!

@zepumph
Copy link
Member Author

zepumph commented Dec 11, 2020

After the above, no model values are being rounded to 6 decimal places. Next I'd like to factor out the remaining view usages to a single spot.

@zepumph
Copy link
Member Author

zepumph commented Dec 11, 2020

This has been done. Thanks again @jonathanolson for the help. Once I understood the problem, this was an easy fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant