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
Without fpu library, currently the accuracy of math functions divide and reciprocal are not so good. eTeX's \dimexpr might help, by using
‘scaling’ operations (a multiplication immediately followed by a division) which are performed as one combined operation with a 64-bit product as intermediate value. excerpted from the eTeX manual, sec. 3.5 "Expressions"
\documentclass{article}
\usepackage{pgfmath}
\begin{document}
\pgfmathprint{38.89993/38.9}, % = 1.2, should be less than 1\pgfmathprint{38.8999/38.9} % = 1.1\pgfmathreciprocal{1.25}\pgfmathresult% = 0.80019, 0.8 expected\end{document}
The text was updated successfully, but these errors were encountered:
I think you are conflating a few different things here. There are a number of orthogonal issues with the divide and reciprocal functions:
Loss of precision (\pgfmathreciprocal{1.25})
Dimension too large (\pgfmathdivide{1000.0}{0.001})
Bogus results (\pgfmathdivide{38.89993}{38.9})
The most pressing issue is fixing the bogus results. Eventually we should find workarounds for the other two issues as well, but as of now they just reflect the nature and limitations of TeX's fixed-point arithmetic.
Brief outline of the bug
Without fpu library, currently the accuracy of math functions
divide
andreciprocal
are not so good. eTeX's\dimexpr
might help, by usingExisting discussions
divide
: Symbol 1's analysis on TeX-SX, Henri's attempt hmenke@5077895reciprocal
: Wrong position of a point using the "scale" option #1146, related TeX-SX questionsMinimal working example (MWE)
The text was updated successfully, but these errors were encountered: