diff options
author | Yitzchak Scott-Thoennes <sthoenna@efn.org> | 2005-08-07 20:03:00 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-08-17 12:33:18 +0000 |
commit | 2b54f59ff973752abae83d93b744e48e13815b05 (patch) | |
tree | 2afe8c8141068df5d32288207dab276c70e194ed /numeric.c | |
parent | 937b804e26ebbf3fb854afd0a028d8b26cf46829 (diff) | |
download | perl-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.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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 */ |