-
Notifications
You must be signed in to change notification settings - Fork 351
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
Decimal * Uint128 treats Uint128 as a raw Decimal value #1156
Comments
Thanks for brining this up. I'm really unsure what the desired output type is. There is also no generic and safe conversion
This makes it hard to say: Use this output type that can easily be converted. |
Looking at https://stackoverflow.com/a/44552464/2013738, it feels like this should not be implemented at all. |
This should be implemented. I'd expect |
i.e. I have |
Basically, there are two ways we could want. 200 * 50% = 100 (multiply my number by some decimal) - this is implemented as majority case Maybe this is included in #1186 ? But if we have |
The mixed type arithmetic Decimal * Uint128 should be removed when we get the chance. Created a ticket for 2.0: #1485 |
Seems to be a "feature" so raw
Uint128
values can be treated as decimals.This is very surprising, since the
Div
implementation doesn't follow this behavior, andMul
doesn't this either.Similar to #1155 I propose the
Decimal()
constructor to be made public. TheMul
implementation should be fixed, then the old behavior can be more explicit viadecimal_val * Decimal(uint_val)
.The text was updated successfully, but these errors were encountered: