summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-05-24 21:39:53 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-05-24 21:39:53 +0000
commita36244b753e9b2747b70a6f37a7bcd86eaa61bcb (patch)
treed73f214fc3b31ff05dec205d9a5295567e34ac7c /numeric.c
parent2d9f38380dc851bc1703b949879f3a47e731a03f (diff)
downloadperl-a36244b753e9b2747b70a6f37a7bcd86eaa61bcb.tar.gz
In some (rare) platforms (such as UNICOS) using the native
atof is still better. p4raw-id: //depot/perl@16771
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/numeric.c b/numeric.c
index 93f4cb4c0d..d2144164cd 100644
--- a/numeric.c
+++ b/numeric.c
@@ -783,17 +783,17 @@ Perl_my_atof(pTHX_ const char* s)
/* Scan the number twice; once using locale and once without;
* choose the larger result (in absolute value). */
- Perl_atof2(aTHX_ s, &x);
+ Perl_atof2(s, x);
SET_NUMERIC_STANDARD();
- Perl_atof2(aTHX_ s, &y);
+ Perl_atof2(s, y);
SET_NUMERIC_LOCAL();
if ((y < 0.0 && y < x) || (y > 0.0 && y > x))
return y;
}
else
- Perl_atof2(aTHX_ s, &x);
+ Perl_atof2(s, x);
#else
- Perl_atof2(aTHX_ s, &x);
+ Perl_atof2(s, x);
#endif
return x;
}
@@ -802,8 +802,9 @@ char*
Perl_my_atof2(pTHX_ const char* orig, NV* value)
{
NV result = 0.0;
- bool negative = 0;
char* s = (char*)orig;
+#ifdef USE_PERL_ATOF
+ bool negative = 0;
char* send = s + strlen(orig) - 1;
bool seendigit = 0;
I32 expextra = 0;
@@ -926,6 +927,7 @@ Perl_my_atof2(pTHX_ const char* orig, NV* value)
/* now apply the sign */
if (negative)
result = -result;
+#endif /* USE_PERL_ATOF */
*value = result;
return s;
}