I understand that the less automatic solution to compare multiple integer logical statements is by using \int_compare_p:nNn {...}{...}{...}
along with \bool_if:nTF {condition(s)}{true}{false}
. My question is why does \fp_compare:nTF {...}{...}{...}
works fine with logical operators but \int_compare:nTF {...}{...}{...}
yield an error even though all of the values used are integers?
\documentclass{article}
\ExplSyntaxOn
\NewDocumentCommand{\compare}{mmm}{
\fp_compare:nTF {#1}{#2}{#3}
}
\NewDocumentCommand{\compareHardcode}{mm}{
\bool_if:nTF {
\int_compare_p:nNn {1} < {2} && \int_compare_p:nNn {2} < {3}
}{#1}{#2}
}
\NewDocumentCommand{\compareError}{mmm}{
%will not work using \int_compare:nTF
\int_compare:nTF {#1}{#2}{#3}
}
\ExplSyntaxOff
\begin{document}
\compare{1 < 2 && 2 < 3}{yes}{no} % prints yes
\compareHardcode{yes}{no} % prints yes
% Erroneous line commented:
% \compareError{1 < 2 && 2 < 3}{yes}{no}
\end{document}
\int_compare:nTF { 1 < 2 < 3} {yes} {no}
instead.\ifnum
and l3fp tests are very different, so there are limits on how far you can make things look the same, but I don't recall this difference being specifically discussed,\numexpr
and do not have infix conditional expressions. You can combine integer comparisons using l3boolean functions, just not as inline int expressions. l3fp is different as it is not based on any tex provided expression syntax.