Closed mattgallagher92 closed 3 weeks ago
In case it's not obvious, an easy workaround is to run the check yourself: if x < y then y else x
Looking at the generated code, it seems like when using if x < y then y else x
then Fable will call the Decimal.cmp
functions instead on relying on >
or <
operators.
It is possible that because Decimal
is a custom implementation via Big.js
then >
or <
operators don't works on it.
@mattgallagher92 It's not just occasionally, it's consistently wrong :)
Thanks for reporting, fixed in #3885.
Thanks @ncave!
Actually, max 0.1m 300m
seemed to work fine 🤷🏼 so there was some level of inconsistency
Using operators directly was comparing their internal string representation, so "01" < "300", but "9" > "300". Should be fixed in the next release.
Description
max
sometimes, but not always, returns the smaller rather than bigger value. So doesmin
.Repro code
max 9m 300m
Expected and actual results
Expected: 300 Actual: 9
Related information