-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fpu] precision problem in int
and floor
functions
#734
Comments
The problem is neither \pgfkeys{/pgf/fpu}\pgfmathparse{12/4}\pgfmathresult outputs |
The two input arguments to pgf/tex/generic/pgf/libraries/pgflibraryfpu.code.tex Lines 1297 to 1303 in 08275e3
After that we have \pgfmathfloat@arga=12.000 and \pgfmathfloat@argb=40.00 . Most of the rest of the function does nothing because neither number is negative, or zero, or nan, or inf. Thus we fall through to the division of the mantissae.
So we essentially do \dimen0=12pt
\divide\dimen0 by 40 and that is by TeX's arithmetic When you encounter precision problems you could instead use |
@Mo-Gul I'm about to close this as wont-fix because I can't actually do anything about it. Are you okay with that? |
If there really isn't anything that you can do I/we'll have to live with it and it is fine to close it. So please allow me to ask for one maybe possible solution/workaround: |
You mean in each and every of the thousands of invocations of |
Is it a guess or a statement that "this" is "horribly inefficient"? Just to be sure: One really would need to check for |
Well yes, of course there would have to be a check for the operand being 12 and 40 because not every division amounts to 0.3, right? Since it is an extra branch with two comparisons it will necessarily be slower than anything without this branch. Also I presume that 12 and 40 will not be the only exceptions, so we'd end up with a huge table of exceptions, massively slowing down the code. |
I'm with @hmenke here: if you need a real FPU, use the LaTeX3 one, as it's designed from the ground up to handle this sort of thing (at the cost that it is slower than the |
You are the experts, so I trust your opinion. So you are welcome to close this issue. But could you state an example here (or at one of the TeX.SX questions) on how to use the |
Using eTeX's expression may help here since
according to PS: I (re)read this issue when searched for possible duplicates of TeX-SX question no.611573, in which one of the causes is about the jumping result of |
Doesn't pass CI unfortunately. |
I am pretty sure that I encountered that specific problem several times now, so maybe it can be fixed. When
fpu
is enabled thefloor
andint
functions can yield wrong results as e.g. shown in the following MWE.Here a list were I know that this problem encountered:
The text was updated successfully, but these errors were encountered: