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
It would be good to be able to use the MidpointRounding option with Math.Round. It looks like big.js supports it & I think its the default for Math.round in JS too?
Hi @sWW26! Sorry for the late reply, I had a quick look at this and although it looks easy to solve, there are different things we need to do for proper support: deal with different overloads, MidpointRounding enum also has other cases, I couldn't find a "recommended" way to do half-up rounding in JS... so it may take some time. Of course any help to fix this is welcome!
After a bit of research into the other MidpointRounding options it seems some of them are not very intuitive, as in they're nothing to do with midpoint logic at all 😕 which probably makes things even worse! see: dotnet/runtime#38160 .
Description
It would be good to be able to use the MidpointRounding option with Math.Round. It looks like big.js supports it & I think its the default for Math.round in JS too?
Repro code
https://fable.io/repl3/#?code=PYBwpgdgBAygngZwC5gLYFgBQWA2YlQAmYAxgJaoCGOASmAgK44EC8UAspUgBYB0NwBhEIAKAEy8ArOwA0UAAxz2ZQiGBkISAUMIaA5rwCCAd0pwAYgCdgqAFphrASigB6F1ATdBOQlABGYFAAzHJ6ZABu9FBiuPhQAGY4wFx0jMxQbJw8-ILC4lJyihwqahpauboQBiZmVjb2Tq7unt6+AcGhEVExmABC1sYIDrwAIja8JMAQCMB4vEl6RKQU1KlMSFj9wIPDY6gTUzNzCwlJKfTrQA&html=Q&css=Q
Expected and actual results
Math.Round(1.5M, 0, MidpointRounding.AwayFromZero) = 2
Math.Round(1.5, 0, MidpointRounding.AwayFromZero) = 2
Math.Round(2.5M, 0, MidpointRounding.AwayFromZero) = 3
Math.Round(2.5, 0, MidpointRounding.AwayFromZero) = 3
The text was updated successfully, but these errors were encountered: