File: trigamma.t

package info (click to toggle)
libmath-mpfr-perl 4.45-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,716 kB
  • sloc: perl: 1,508; ansic: 517; makefile: 9
file content (26 lines) | stat: -rwxr-xr-x 693 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Test script for:
# mpfr_trigamma - new in 4.3.0 (version 262912)

use strict;
use warnings;
use Math::MPFR qw(:mpfr);
use Test::More;

my ($inex, $x, $y) = ('hello', Math::MPFR->new(), Math::MPFR->new());

Rmpfr_set_inf($y, -1);
Rmpfr_set_inf($x,  1);

eval { $inex = Rmpfr_trigamma($y, $x, MPFR_RNDN);};

if(MPFR_VERSION >= 262912) {
  cmp_ok($inex            , '==', 0, "result of trigamma(+Inf) is exact");
  cmp_ok(Rmpfr_zero_p($y) , '!=', 0, "trigamma(+Inf) set to zero");
  cmp_ok(Rmpfr_signbit($y), '==', 0, "trigamma(+Inf) signbit is unset");

}
else {
  like($@, qr/^Rmpfr_trigamma function not implemented until mpfr\-4\.3\.0/, "trigamma() croaks as expected");
}

done_testing();