New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent treatment of NaN #8036
Comments
From @sisyphusCreated by @sisyphususe warnings; my $z = NaN; $z += 1; print $z, "\n"; __END__ When I run that I get an output of simply: NaN + 1 should be NaN, not 1. If NaN is treated as a string, then Same problem on both Linux and Win32. There has been some discussion about this on the c.l.p.misc thread Seems that the perlop, perlfunc, and perldata docs are also in need Perl Info
|
From @ysthOn Mon, Jul 25, 2005 at 05:27:36PM -0700, Sisyphus wrote:
My impression is that we lost nan/inf handling when we switched away Inline Patch--- perl/numeric.c.orig 2005-06-07 10:30:19.000000000 -0700
+++ perl/numeric.c 2005-08-07 10:23:55.574304000 -0700
@@ -893,6 +893,21 @@
++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 */
They need to not encourage barewords, at least. |
The RT System itself - Status changed from 'new' to 'open' |
From @andk
> My impression is that we lost nan/inf handling when we switched away According to a binary search it was patch 10379: ----Program---- ----Output of .../pml0oxv/perl-5.7.1@10378/bin/perl---- ----EOF ($?='0')---- ----EOF ($?='0')---- -- |
From @ysthOn Sun, Aug 07, 2005 at 11:03:08AM -0700, Yitzchak Scott-Thoennes wrote:
Now tested; no new failures. The more I think about it, the more this The below could be improved by using strtold for long double NVs if
|
From @ysthOn Sun, Aug 07, 2005 at 11:03:08AM -0700, Yitzchak Scott-Thoennes wrote:
"Fixing" that part: Inline Patch--- perl/pod/perlop.pod.orig 2005-07-18 02:22:07.000000000 -0700
+++ perl/pod/perlop.pod 2005-08-10 22:51:33.017411200 -0700
@@ -369,8 +369,8 @@
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. |
From @ysthCan the patches in: be applied (or receive feedback)? Thanks. |
From @sisyphus----- Original Message -----
Hi, Is this a question directed to me ? (If so, I don't feel qualified to One thing which surprised me a little was the notion that NaN should be Anyway - if the above-mentioned patches are going to make for better Cheers, |
From @ysthOn Wed, Aug 17, 2005 at 04:15:56PM +1000, Sisyphus wrote:
It was just a CC to you; sorry for the confusion. Bugs mostly get
AFAIK, NaN and Inf have never been treated as numeric constants; when |
@rgs - Status changed from 'open' to 'resolved' |
From @rgsYitzchak Scott-Thoennes wrote:
Thanks, both have been applied as change #25299. |
Migrated from rt.perl.org#36654 (status was 'resolved')
Searchable as RT36654$
The text was updated successfully, but these errors were encountered: