cocalc
cocalc copied to clipboard
Rounding inconsistencies are still present
The balance and "exact" hover over show the difference by exactly one cent:
The account where it happens is in ticket 15046
The code: https://github.com/sagemathinc/cocalc/blob/master/src/packages/frontend/purchases/money-statistic.tsx
It uses rounded down to 2 decimals for the displayed amount and round4 on the original value for the tooltip.
The actual value is "2.319999933242798".
Would you prefer that instead of round4, that it does no rounding at all and instead shows "2.319999933242798" ?
Why do you call this a "rounding inconsistency"? The reason for displaying a value in the tooltip is to show information to more precision that the displayed amount. It should be expected to differ sometimes from the displayed amount, or there would be no point in displaying it at.
Maybe the solution is to add a line of text to the tooltip that says: "Values in this tooltip are rounded to 4 places after the decimal point, whereas the displayed value is rounded down to 2 decimal points." But that makes the tooltip pretty big...
When the same exact number is displayed as both "2.31" and "2.32", I think this is exactly rounding inconsistency, how else would you call it?
The exact inconsistency in this case is the direction of rounding - when it is used for the same purpose (to display the value here), it should use the same direction, i.e. down, so it would be "2.31" and "2.3199".
And if it is not terribly hard to implement, I would never show "2.32" if the intention is to show 4 decimal places, it should be "2.3200"
With transaction 34633 to a zero balance account without any purchases the user has added $2.54 to pay for the license that cost that much. The transaction was not finalized requiring another payment. The current balance is shown as $2.53, with $2.54 on hover. This penny issue is preventing transactions from finishing.
In ticket 15130 the user claims "website asked me to update my account balance to pay 20.78. Then it deliberatly set me up to add 20.77" - the payment in Stripe was for 20.77. The course fee is shown as $20.78. There was a positive fraction of a penny left from previous purchases.
The screenshot from the description now works out to $2.50 and $2.509 on hover, which is more reasonable. The issue with charging for 1 cent less than needed stopped coming up.