I've peeked at the source for Scalar::Util (versions 1.13 and 1.15), and apparently its
looks_like_number function will detect NaN, Inf and Infinity depending upon your version of Perl. Here are some related nodes which contain some information that may be of some help to you:
Detecting if a scalar has a number or string
Extended IEEE 754 parsing