note
syphilis
<i>off-by-one error</i><br><br>
It seems you've hit some precision limit - which is avoided if you <c>use bigint</c>.
<br>Try placing an extra number at the beginning of $x, and you'll soon see what I mean.
<br>For every extra number you prepend to the start of $x, you get an extra "0" at the end of $y:
<c>
use strict;
use warnings;
use feature 'say';
use bignum;#num;
# (1) #use bignum downgrade => "Math::BigInt", upgrade => "Math::BigInt";
## (2) #use bigint;
say $^V;
my $x = 999999999921778071482940061661655974875633165533182;
say $x;
my $y = $x / 2;
say $y;
__END__
For me, outputs:
D:\pscrpt>perl try.pl
v5.39.5
999999999921778071482940061661655974875633165533182
499999999960889035741470030830827987437800000000000
</c>
Cheers,<br>Rob
11154952
11155774