Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,9 @@ Perl_grok_bin_oct_hex(pTHX_ const char * const start,
break;
}

/* How many real digits have been processed */
STRLEN bytes_so_far = s - s0;

/* In overflows, this keeps track of how much to multiply the overflowed NV
* by as we continue to parse the remaining digits */
NV factor = shift << bytes_so_far;
NV factor = 0.0;

bool overflowed = FALSE;
NV value_nv = 0;
Expand Down
7 changes: 6 additions & 1 deletion t/op/oct.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
chdir 't' if -d 't';
require './test.pl';
use strict;
no warnings 'overflow';

plan(tests => 79);
plan(tests => 81);

foreach(['0b1_0101', 0b101_01],
['0b10_101', 0_2_5],
Expand Down Expand Up @@ -58,6 +59,8 @@ foreach(['0b1_0101', 0b101_01],
# Additional syntax for octals
["0o7_654_321", 2054353],
["O4567", 0o4_567],
# Overflow approximation
["52" x 32, 4184734490257787175890526282138444277401570296309356341930],
) {
my ($string, $value) = @$_;
my $result = oct $string;
Expand Down Expand Up @@ -95,6 +98,8 @@ foreach(['01_234', 0b_1001000110100],
# Allow uppercase base markers (#76296)
["0XCAFE", 0xCAFE],
["XCAFE", 0xCAFE],
# Overflow approximation
["5" x 48, 2092367245128893587945263141069222138700785148154678170965],
) {
my ($string, $value) = @$_;
my $result = hex $string;
Expand Down
Loading