docs on NaN
authorNicholas Clark <nick@ccl4.org>
Mon, 11 Dec 2000 01:48:38 +0000 (01:48 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Mon, 11 Dec 2000 15:09:11 +0000 (15:09 +0000)
Message-ID: <20001211014838.B99205@plum.flirble.org>

p4raw-id: //depot/perl@8078

pod/perlop.pod

index 70fef45..0bb506d 100644 (file)
@@ -300,8 +300,13 @@ to the right argument.
 Binary "<=>" returns -1, 0, or 1 depending on whether the left
 argument is numerically less than, equal to, or greater than the right
 argument.  If your platform supports NaNs (not-a-numbers) as numeric
-values, using them with "<=>" (or any other numeric comparison)
-returns undef.
+values, using them with "<=>" returns undef.  NaN is not "<", "==", ">",
+"<=" or ">=" anything (even NaN), so those 5 return false. NaN != NaN
+returns true, as does NaN != anything else. If your platform doesn't
+support NaNs then NaN is just a string with numeric value 0.
+
+    perl -le '$a = NaN; print "No NaN support here" if $a == $a'
+    perl -le '$a = NaN; print "NaN support here" if $a != $a'
 
 Binary "eq" returns true if the left argument is stringwise equal to
 the right argument.