Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Yes, that solves it in the sense of task setter. :() Commented yesterday
  • +1. I injected your l3fp code in my answer and used \NewDocumentCommand\SN{O{5} m}{\np{\fpeval{round(Phi(#2), #1)}}} (so \np from numprint is used in both cases for fair comparison) A bit to my surprise, it seems pdflatex takes about 5% more time with the l3fp code than with the xint one. Apart from that it seems \fpeval trims trailing zero and I don't know how to reinject them. Commented 17 hours ago
  • @user691586 well, l3fp isn't know to be the fastest, it's known to be one of the most precise :) If you aim for speed consider rewriting the polynomial using Horner's method. If I do that for your xintexpr based document compiling it takes 2.9s, while after sticking my l3fp-function into your \SN the entire document took 1.7s. So in this case l3fp was faster for this. Without Horner's l3fp took 4.0s and xintexpr only 3.8s. Commented 12 hours ago
  • @jps thanks for these interesting timings... maybe xint is a bit more nimble with powers, which Horner's method avoids. It is possible that for algebra l3fp is only a bit faster than xint, for the math functions it is more convincingly faster which however is not completely surprising as xint is multi-precision, not only 16 decimal digits. Commented 10 hours ago