On Thu Sep 17 09:06:35 2015, jellisii wrote:
Show quoted text> round_even doesn't behave as expected. example code:
> 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";
Above code, on my system, returns the following:
Raw upscale is 834.782608695652
Rounded upscale is 835.
I expect it to return 836, not 835.
If the intention of the function is to only exclusively round .5 values to an even value, then this may be working as intended and I apologize for wasting your time.
eellis@tc01:~/convert_e360$ perl -v
This is perl 5, version 18, subversion 2 (v5.18.2) built for x86_64-linux-gnu-thread-multi
(with 41 registered patches, see perl -V for more detail)