On page 1/2 xfp package we see ternary operator x ? y : z
as a valid boolean expression. it deserves the author puts at least the definition of this.
In C I was told we have:
variable = Expression1 ? Expression2 : Expression3
is equivalent toif(Expression1) { variable = Expression2;} else {variable = Expression3;}.
To check the validity of the definition above I wrote a code below:
\documentclass{article}
\usepackage{xfp}
\begin{document}
\edef\x{6.25}
\edef\y{-1}
\edef\z {{\x > \y} ? {\x} :{ \y}}
$(x>y)?x:y=\fpeval{\z}$
\end{document}
But got an error:
! File ended while scanning use of \__fp_parse_continue:NwN.
Do you know how to fix it?
\edef\z{(\x > \y) ? (\x) : (\y)}
\fpeval
and\inteval
inxfp
package are just wrappers of latex3 functions\fp_eval:n
and\int_eval:n
, which (as well as their argument, floating point expression and integer expression) are fully documented intexdoc interface3
, sec. XI.1, XXIII.2, and XXIII.9.\edef
? That’s the wrong bit to begin with.