AMCNumericChoice rounding problem (Bug #818)
Description
answer as 9/4 with decimal=1 or 1/2 with decimal=0 in AMCNumericChoice give bad result.
History
Updated by Yves Combe over 2 years ago
This bug, probably, comes from the xfp package.
xfp gives the same rounding errors, where fp does not.
Updated by Yves Combe over 2 years ago
Sorry, i forgot: version 1.5.0-rc2 running on MX Linux (Debian 11 based).
Updated by Alexis Bienvenüe over 2 years ago
Seems OK for me, with development version:
Updated by Yves Combe over 2 years ago
As you maybe should know, 0.5 and 2.25 should be rounded as 1 and 2.3, respectively.
- File fp-xfp.png added
Updated by Yves Combe over 2 years ago
Got it. It rounds half to even.
[[https://en.wikipedia.org/wiki/Rounding#Round_half_to_even]]
- File round-to-even.png added
Updated by Alexis Bienvenüe over 2 years ago
Exactly. Here the round half to even from l3fp
is used — this is the same for e.g. python
and R
.
If you need another choice, round your result before passing it to \AMCNumericChoice
.
- Status changed from Feedback to Closed
- % Done changed from 0 to 100
Updated by Yves Combe over 2 years ago
You should add an option to round with +inf rule. xfp support it:
\fpeval{round(9/4,1,+inf)}