Date: Aug 7, 2005 8:03 PM
Message-ID: <
20050807180308.GA2112@efn.org>
Subject: Re: [perl #36654] Inconsistent treatment of NaN
From: Yitzchak Scott-Thoennes <sthoenna@efn.org>
Date: Wed, 10 Aug 2005 22:53:51 -0700
Message-ID: <
20050811055351.GA2296@efn.org>
p4raw-id: //depot/perl@25299
++s;
}
+ /* punt to strtod for NaN/Inf; if no support for it there, tough luck */
+
+#ifdef HAS_STRTOD
+ if (*s == 'n' || *s == 'N' || *s == 'i' || *s == 'I') {
+ char *p = negative ? s-1 : s;
+ char *endp;
+ NV rslt;
+ rslt = strtod(p, &endp);
+ if (endp != p) {
+ *value = rslt;
+ return (char *)endp;
+ }
+ }
+#endif
+
/* we accumulate digits into an integer; when this becomes too
* large, we add the total to NV and start again */
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'
+ 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.