-
Notifications
You must be signed in to change notification settings - Fork 109
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
ifthenelse evaluates both branches #1006
Comments
It seems some laziness support is needed, either internal to |
Also related questions in TeX.SX |
The culprit lies in the fact that the definition of \pgfmathifthenelse:
macro:#1#2#3->\pgfmathparse {#1}\let \pgfmath@argument@1 =\pgfmathresult \pgfmathparse {#2}\let \pgfmath@argument@2 =\pgfmathresult \pgfmathparse {#3}\let \pgfmath@argument@3 =\pgfmathresult \pgfmathifthenelse@ {\pgfmath@argument@1 }{\pgfmath@argument@2 }{\pgfmath@argument@3 } So we either need some separate implementations for all functions to handle laziness or we just redefine |
\pgfmathprint{and(false, 1/0)}
\pgfmathprint{or(true, 1/0)} |
Brief outline of the bug
ifthenelse
always evaluates both branches, regardless of the condition. It should short-circuit and only evaluate the branch that is actually taken.Minimal working example (MWE)
The text was updated successfully, but these errors were encountered: