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

[perl #41202] text->float conversion gives wrong answer

Thread Previous
From: via RT
July 14, 2018 20:18
[perl #41202] text->float conversion gives wrong answer
Message ID:
On Sun, 11 Mar 2018 04:11:50 -0700, sisyphus wrote:
> Le Fri, 09 Mar 2018 22:47:01 -0800, sisyphus a écrit :
> > Annoyingly, on the Windows 'long double' build only, the patch altered
> > the way that the numification of the string '9875'x1000 alters the
> > internals. (This caused one Math::MPFR test to fail, and I need to
> > investigate it.)
> Looks to me like a mingw runtime bug in strtold() - which I've reported to:

The bug turns out to be easily worked around. Attached is the patch I eventually used with perl-5.28.0.
On the systems I've tested, it works flawlessly and I've yet to find a value that gets assigned incorrectly on either "double" builds or extended precision "long double" builds or "__float128" builds of perl.
It also does not cause any of the tests (in the perl-5.28.0 test suite) to fail.

The systems I've tested have been Ubuntu-16.04 (gcc-5.4.0 &, glibc-2.23), Debian Wheezy (gcc-4.6.3 & glibc-2.13) and MS Windows (various mingw-w64 ports of gcc-4.7.0 thru to 8.1.0).

I'm therefore unaware of any valid reason that this modified patch should not be incorporated into perl-5.29.
If objections exist, please raise them so that I can attend to them.

The effects of this patch can be nullified by building perl such that HAS_STRTOD or HAS_STRTOLD is not defined. On Linux this is as simple as configuring the perl build with -Ud_strtod or -Ud_strtold.

I've given a little more detail at


via perlbug:  queue: perl5 status: open

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About