summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorYitzchak Scott-Thoennes <sthoenna@efn.org>2005-08-07 20:03:00 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-08-17 12:33:18 +0000
commit2b54f59ff973752abae83d93b744e48e13815b05 (patch)
tree2afe8c8141068df5d32288207dab276c70e194ed /numeric.c
parent937b804e26ebbf3fb854afd0a028d8b26cf46829 (diff)
downloadperl-2b54f59ff973752abae83d93b744e48e13815b05.tar.gz
Re: [perl #36654] Inconsistent treatment of NaN
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
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/numeric.c b/numeric.c
index 301584234b..5eafddaf9f 100644
--- a/numeric.c
+++ b/numeric.c
@@ -893,6 +893,21 @@ Perl_my_atof2(pTHX_ const char* orig, NV* value)
++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 */