X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/51b56f5c7c7e109a2c53226c83c2d324801d4f9b..d43c116b2ae74ec1f3ed78829d4f3ca76f091390:/numeric.c?ds=sidebyside diff --git a/numeric.c b/numeric.c index a476881..52c4547 100644 --- a/numeric.c +++ b/numeric.c @@ -16,9 +16,6 @@ */ /* -=for apidoc_section Numeric Functions - -=cut This file contains all the stuff needed by perl for manipulating numeric values, including such things as replacements for the OS's atof() function @@ -1467,7 +1464,18 @@ S_mulexp10(NV value, I32 exponent) NV Perl_my_atof(pTHX_ const char* s) { - /* 's' must be NUL terminated */ + +/* +=for apidoc my_atof + +L(3)>, but properly works with Perl locale handling, accepting a dot +radix character always, but also the current locale's radix character if and +only if called from within the lexical scope of a Perl C statement. + +N.B. C must be NUL terminated. + +=cut +*/ NV x = 0.0; @@ -1832,9 +1840,15 @@ Perl_my_atof3(pTHX_ const char* orig, NV* value, const STRLEN len) /* now apply the sign */ if (negative) result[2] = -result[2]; -#endif /* USE_PERL_ATOF */ *value = result[2]; return (char *)s; +#else /* USE_PERL_ATOF */ + /* If you see this error you both don't have strtod (or configured -Ud_strtod or + or it's long double/quadmath equivalent) and disabled USE_PERL_ATOF, thus + removing any way for perl to convert strings to floating point numbers. + */ +# error No mechanism to convert strings to numbers available +#endif } /*