s++;
if (s >= send)
return numtype;
- if (len == 10 && memEQ(pv, "0 but true", 10)) {
+ if (memEQs(pv, len, "0 but true")) {
if (valuep)
*valuep = 0;
return IS_NUMBER_IN_UV;
NV
Perl_my_atof(pTHX_ const char* s)
{
+ /* 's' must be NUL terminated */
+
NV x = 0.0;
+
+ PERL_ARGS_ASSERT_MY_ATOF;
+
#ifdef USE_QUADMATH
+
Perl_my_atof2(aTHX_ s, &x);
- return x;
+
+#elif ! defined(USE_LOCALE_NUMERIC)
+
+ Perl_atof2(s, x);
+
#else
-# ifdef USE_LOCALE_NUMERIC
- PERL_ARGS_ASSERT_MY_ATOF;
{
DECLARATION_FOR_LC_NUMERIC_MANIPULATION;
* that we have to determine this beforehand because on some
* systems, Perl_atof2 is just a wrapper around the system's atof.
* */
- const char * const standard = strchr(s, '.');
- const char * const local = strstr(s, SvPV_nolen(PL_numeric_radix_sv));
- const bool use_standard_radix = standard && (!local || standard < local);
+ const char * const standard_pos = strchr(s, '.');
+ const char * const local_pos
+ = strstr(s, SvPV_nolen(PL_numeric_radix_sv));
+ const bool use_standard_radix
+ = standard_pos && (!local_pos || standard_pos < local_pos);
if (use_standard_radix)
SET_NUMERIC_STANDARD();
Perl_atof2(s, x);
RESTORE_LC_NUMERIC();
}
-# else
- Perl_atof2(s, x);
-# endif
+
#endif
+
return x;
}
else if (!seen_dp && GROK_NUMERIC_RADIX(&s, send)) {
seen_dp = 1;
if (sig_digits > MAX_SIG_DIGITS) {
- do {
+ while (isDIGIT(*s)) {
++s;
- } while (isDIGIT(*s));
+ }
break;
}
}