This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_sv_vcatpvfn_flags: better calc f/p buf size
authorDavid Mitchell <davem@iabyn.com>
Wed, 17 May 2017 11:27:18 +0000 (12:27 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 7 Jun 2017 08:11:01 +0000 (09:11 +0100)
commitccb8ae84d412f65e7f257f6d21742aad77857514
treec818e500cf5686c177f325f4c18ca79e9d10b52b
parent559a021f1d52c32a82cbdf9184aa59a58e898b08
Perl_sv_vcatpvfn_flags: better calc f/p buf size

How it works out the needed buffer size for the various floating point
formats is a bit opaque. This commit extensively documents and
rationalises the process. In particular it will no longer allocate a very
large buffer for %g printing a large number (%g switches to %e style
format rather than %f in cases like this). Also it no longer relies on a
+40 fudge factor to accommodate exponents - this is now factored in
properly.

It still includes a +20 safety fudge factor for production builds, but
this is disabled under DEBUGGING so that ASAN and the like are likely to
more quickly spot issues during development.
sv.c
t/op/sprintf2.t