summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sv.c10
-rw-r--r--t/op/sprintf2.t2
2 files changed, 6 insertions, 6 deletions
diff --git a/sv.c b/sv.c
index ce1a8cefe7..ae70d7b266 100644
--- a/sv.c
+++ b/sv.c
@@ -12517,12 +12517,12 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
bool overflow = FALSE;
if (v0[precis + 1] < 0x8) {
/* Round down, nothing to do. */
- } else if (v[precis + 1] > 0x8) {
+ } else if (v0[precis + 1] > 0x8) {
/* Round up. */
- v0[precis + 1]++;
- overflow = v0[precis + 1] > 0xF;
- v0[precis + 1] &= 0xF;
- } else { /* v[precis + 1] == 0x8 */
+ v0[precis]++;
+ overflow = v0[precis] > 0xF;
+ v0[precis] &= 0xF;
+ } else { /* v0[precis] == 0x8 */
/* Half-point: round towards the one
* with the even least-significant digit:
* 08 -> 0 88 -> 8
diff --git a/t/op/sprintf2.t b/t/op/sprintf2.t
index 2cf999dd1c..d28185081b 100644
--- a/t/op/sprintf2.t
+++ b/t/op/sprintf2.t
@@ -786,7 +786,7 @@ SKIP: {
[ '3e-323', '%.4a', '0x1.8000p-1072' ],
[ '3e-324', '%.4a', '0x1.0000p-1074' ],
[ '3e-320', '%.1a', '0x1.8p-1062' ],
- [ '3e-321', '%.1a', '0x1.2p-1065' ],
+ [ '3e-321', '%.1a', '0x1.3p-1065' ],
[ '3e-322', '%.1a', '0x1.ep-1069' ],
[ '3e-323', '%.1a', '0x1.8p-1072' ],
[ '3e-324', '%.1a', '0x1.0p-1074' ],