Is there an easy way to test if a number is negative?
I don't need a general solution, but it does need to be able to handle a floating point value. I was using this solution from the TeX FAQ until I realized that it has problems with positive floating point numbers. Here is a test file
\documentclass{article}
\def\IsPositive#1{%
TT\fi%
\ifcat_\ifnum0<0#1 _\else A\fi%
}
\newcommand{\PrintSignOfNumber}[1]{%
\if\IsPositive{#1}%
$#1 \ge 0$%
\else%
$#1 < 0$%
\fi%
}
\begin{document}
\PrintSignOfNumber{2}\par
\PrintSignOfNumber{-2}
\PrintSignOfNumber{2.0}\par % reported as negative
\PrintSignOfNumber{-2.0}
\end{document}
I don't need a very general solution. Even if it just tested the first character as being a negative sign would suffice for my application. I would think that the etoolbox could do this easily, but I can't quite figure out how. If anyone knows of a good document that contains examples of using etoolbox that would be great.

+/-, digits,.). This is of course a general problem, but other solutions would be simple wrong, not causing an error. Ok, sometimes an error is what you want. This points you directly to the wrong input. – Martin Scharrer Apr 08 '11 at 13:12,as well. – Martin Scharrer Apr 08 '11 at 13:37