X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/937b804e26ebbf3fb854afd0a028d8b26cf46829..2b54f59ff973752abae83d93b744e48e13815b05:/numeric.c diff --git a/numeric.c b/numeric.c index 3015842..5eafdda 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 */