From 7d3a9d88333294f7510d5755825d4f26422ffba1 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 11 Dec 2000 01:48:38 +0000 Subject: [PATCH] docs on NaN Message-ID: <20001211014838.B99205@plum.flirble.org> p4raw-id: //depot/perl@8078 --- pod/perlop.pod | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pod/perlop.pod b/pod/perlop.pod index 70fef45..0bb506d 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -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. -- 2.7.4