This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix F0convert() on edge cases
authorZefram <zefram@fysh.org>
Fri, 19 Jan 2018 05:05:07 +0000 (05:05 +0000)
committerZefram <zefram@fysh.org>
Fri, 19 Jan 2018 05:09:07 +0000 (05:09 +0000)
commit60fa46621ae5d0d44c802aedc205274584701fa0
tree70bcd377015aeb2dc0bdd0321bbce0b70d7adb3f
parent8c7aa727bdcea40fd6b4ffb9ca8bbf53c0fadb10
fix F0convert() on edge cases

The F0convert() function used to implement the %.0f format specifier
more cheaply went wrong on some edge cases.  Its rounding went wrong
when the exponent is such that fractional values are not representable,
making the "+= 0.5" invoke floating point rounding.  Fix that by only
invoking that rounding logic for values that start out fractional.
That fixes the output part of [perl #47602].  It also failed to emit the
sign for negative zero.  Fix that by making it not apply to zero values.
sv.c
t/op/sprintf2.t