You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would have expected the value to be $3.50; the same is also true for add. Perhaps this is expected behavior and creating a currency object using fromCents means that arithmetic performed is in cent amounts rather than
dollar amounts. If that's the case, I'd say that the name fromCents is misleading as it implies you get a regular currency object, except that the initial value is converted from cents; there's nothing to indicate that arithmatic is done in cent values.
Thanks.
The text was updated successfully, but these errors were encountered:
The currency object inherits all of the options passed into the initial function. I would think the opposite behavior would be more confusing, as I would think all of your nominal values would be similar - but I haven't actively used fromCents much myself.
Hi @scurker ,
I've found some inconsistencies when applying arithmetic after using
fromCents
:I would have expected the value to be
$3.50
; the same is also true foradd
. Perhaps this is expected behavior and creating a currency object usingfromCents
means that arithmetic performed is in cent amounts rather thandollar amounts. If that's the case, I'd say that the name
fromCents
is misleading as it implies you get a regular currency object, except that the initial value is converted from cents; there's nothing to indicate that arithmatic is done in cent values.Thanks.
The text was updated successfully, but these errors were encountered: