In LaTeX, how do I declare a new command that gives different output depending no the result of a test with non-integer numbers? Specifically, I'd like to a command to compare a number with 0.01 (the numbers would come from a different script): if the number is greater than or equal to 0.01, print p = 0.45
(or whatever number p is); if the number if less than 0.01, print p < 0.01
.
I have looked at ifnumless
in etoolbox
but it only takes integers and dimensions.
How do I do this with numbers with decimal points? Thanks.
calc
can help.0.05
to0.05pt
and then perform a length test (like\ifdim 0.05pt<0.01pt\relax<true>\else<false>\fi
).etoolbox
does provide length tests, and so does other packages. The following seems to be a duplicate: Conditional using non-integer numbers - it handles the same approach of real-to-length usage.