summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-08-08 11:20:01 -0600
committerKarl Williamson <khw@cpan.org>2018-08-09 11:23:15 -0600
commitb93d1309412c6ce0c1526b177a2a2e845bd4806e (patch)
tree0af61592cd8437069a0e7a0b72e72cdcfa730986 /numeric.c
parentb9965e1496efe3cb6116e74d50aa83152c70e877 (diff)
downloadperl-b93d1309412c6ce0c1526b177a2a2e845bd4806e.tar.gz
numeric.c: Quadmath now honors LC_numeric
Previously the code compiled under quadmath did not bother to check for locale. Fixing this was a simple matter of a little rearrangement.
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/numeric.c b/numeric.c
index e776f7332e..f9006f6544 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1243,6 +1243,12 @@ S_mulexp10(NV value, I32 exponent)
}
#endif /* #ifndef USE_QUADMATH */
+#ifdef USE_QUADMATH
+# define ATOF(s, x) my_atof2(s, &x)
+# else
+# define ATOF(s, x) Perl_atof2(s, x)
+# endif
+
NV
Perl_my_atof(pTHX_ const char* s)
{
@@ -1252,13 +1258,9 @@ Perl_my_atof(pTHX_ const char* s)
PERL_ARGS_ASSERT_MY_ATOF;
-#ifdef USE_QUADMATH
+#if ! defined(USE_LOCALE_NUMERIC)
- my_atof2(s, &x);
-
-#elif ! defined(USE_LOCALE_NUMERIC)
-
- Perl_atof2(s, x);
+ ATOF(s, x);
#else
@@ -1284,15 +1286,16 @@ Perl_my_atof(pTHX_ const char* s)
LOCK_LC_NUMERIC_STANDARD();
}
- Perl_atof2(s, x);
+ ATOF(s,x);
if (use_standard_radix) {
UNLOCK_LC_NUMERIC_STANDARD();
SET_NUMERIC_UNDERLYING();
}
}
- else
- Perl_atof2(s, x);
+ else {
+ ATOF(s,x);
+ }
RESTORE_LC_NUMERIC();
}