develooper Front page | perl.perl5.porters | Postings from April 2018

Why is Perl_strtod defined, but then ignored ?

From:
sisyphus1
Date:
April 17, 2018 12:59
Subject:
Why is Perl_strtod defined, but then ignored ?
Message ID:
E1B9F3781E4F493DBF4F1DC372B5361A@OwnerPC311012
Hi,

On Linux (Ubuntu), when I build current devel (5.27.10), Perl_strtod is 
defined.
But then, instead of using Perl_strtod to assign floating point values, perl 
still uses it's own atof routine.
This is somewhat disappointing because Perl_strtod assigns accurately 
(rounding to nearest, ties to even) whereas perl's atof mostly does not.

The exception here is the -Dusequadmath build which *does* assign the value 
that Perl_strtod ascribes - and therefore assigns values accurately.
Bizarrely it then claims (in its 'perl -V') that USE_PERL_ATOF was a 
compile-time option.

When I hack numeric.c so that the 'double' and 'long double' builds follow 
the same pathway as the quadmath build then, lo and behold, they also assign 
accurately.

What is the rationale here that has Perl_strtod ignored on 'double' and 
'long double' builds when it is defined ?
(I had envisaged that the defining of Perl_strtod would signal that *it* 
should be used by perl to assign values. Was that ever the case ?)

Cheers,
Rob



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About