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 : Expression3is 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)}– Henri Menke Aug 16 '20 at 05:58{x > y} ? {x} :{y}also doesn't compile in C. https://wandbox.org/permlink/AfzIMPvpyhwgno8K – Henri Menke Aug 16 '20 at 06:02\fpevaland\intevalinxfppackage are just wrappers of latex3 functions\fp_eval:nand\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. – muzimuzhi Z Aug 16 '20 at 06:52\edef? That’s the wrong bit to begin with. – egreg Aug 16 '20 at 08:01xfppackage required)? Please advise. – Mico Aug 16 '20 at 08:40