use strict; use warnings; use Math::Round qw(round_even); use v5.16; # numbers are actual numbers that I use to do math on video geometry # I'm having to upscale some video to match other geometry. # MP4 requires height and width be divisible by 2. my $h1 = 480; my $h2 = 368; my $w = 640; my $ratio = $h1/$h2; my $upscaled_w = $w * $ratio; say "Raw upscale is $upscaled_w"; my $rounded = round_even($upscaled_w); say "Rounded upscale is $rounded";