AMCNumericChoice rounding problem (Bug #818)


Added by Yves Combe over 2 years ago. Updated over 2 years ago.


Status:Closed Start date:04/12/2022
Priority:Normal Due date:
Assignee:- % Done:

100%

Category:-
Target version:-

Description

answer as 9/4 with decimal=1 or 1/2 with decimal=0 in AMCNumericChoice give bad result.


source.tex - source example (2.2 kB) Yves Combe, 04/12/2022 08:42 am

12r.png (10.6 kB) Alexis Bienvenüe, 04/12/2022 09:02 am

94r.png (10.6 kB) Alexis Bienvenüe, 04/12/2022 09:02 am

fp-xfp.png (11.9 kB) Yves Combe, 04/12/2022 09:18 am

round-to-even.png (41.4 kB) Yves Combe, 04/12/2022 09:37 am


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:

  • Status changed from New to Feedback
  • File 12r.png added
  • File 94r.png added

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.

Updated by Yves Combe over 2 years ago

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)}

Also available in: Atom PDF