-
Notifications
You must be signed in to change notification settings - Fork 8
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
NeptuneCoins display issues #179
Comments
these lines in the
why 100.0? Seems short and arbitrary. And I'd be much happier if we could avoid floating point math and rounding altogether. floating point is usually avoided like the plague when representing monetary amounts. that said, I don't understand this code well enough yet to be certain that is the problem or suggest a proper fix. |
According to how I intended In my understanding,
That said, the first test seems suspect because
It is a larger range. Any number of nau that is less than 0.005 Neptune should display as "0".
Well, usually on receipts and invoices people write a number of dollars and a number of cents, with a comma or a point separating the whole dollar number from the two remaining digits. I'm not sure how much capacity average users have for reasoning about Neptune amounts in finer granularity than hundredths; and I don't think it's worth degrading the experience of average users for the benefit of a select few who can think in terms of higher granularities.
Agreed. You'll find that floating point is not used internally and used here only for converting to a user-facing display. And you could even make the argument that the temporary floating point variables used for computing this display should be fixed point, and I'll be happy to merge a "fix" to that effect.
The display form ( |
I made these simple tests for
impl Display
that fail:failures:
I first noticed that there is a display issue with one nau because a test was using it and the log was printing "0" coins inside a block reachable only by comparing greater than another
NeptuneCoin
of known zero value. So either theOrd
orDisplay
impl is wrong.Ord
tests ok, butDisplay
does not.I'm not sure if it is only one nau that displays as "0", or possibly a larger range. I do see that "0.1" displays as "0.10" for some reason which is not mathematically incorrect but doesn't seem "right" either.
The text was updated successfully, but these errors were encountered: