aboutsummaryrefslogtreecommitdiff
path: root/challenge-167/e-choroba/perl/ch-2.pl
blob: 0de37755835b1d8879607c192006962775a5c3ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl
use warnings;
use strict;

use PDL;
use PDL::GSLSF::GAMMA;

sub gamma {
    unpdl((gsl_sf_gamma(shift))[0])->[0]
}

use Test2::V0 qw{ is plan within };
plan 3;

my $TOLERANCE = 0.0100000000001;

is gamma(3), within(1.99, $TOLERANCE);
is gamma(5), within(24);
is gamma(7), within(719.99, $TOLERANCE);