File: inits.t

package info (click to toggle)
libmath-mpfr-perl 3.23-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 856 kB
  • ctags: 51
  • sloc: perl: 507; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 848 bytes parent folder | download | duplicates (6)
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
27
28
29
30
31
32
33
use warnings;
use strict;
use Math::MPFR ':mpfr';

print "1..5\n";

print  "# Using Math::MPFR version ", $Math::MPFR::VERSION, "\n";
print  "# Using mpfr library version ", MPFR_VERSION_STRING, "\n";
print  "# Using gmp library version ", Math::MPFR::gmp_v(), "\n";

my @mpfr1 = Rmpfr_inits(17);
if(scalar(@mpfr1) == 17) {print "ok 1\n"}
else {print "not ok 1 ", scalar(@mpfr1), "\n"}

my $ok = 1;
for(@mpfr1) {$ok = 0 if !Rmpfr_nan_p($_) }
if($ok) {print "ok 2\n"}
else {print "not ok 2 $ok\n"}

my @mpfr2 = Rmpfr_inits2(101, 17);
if(scalar(@mpfr1) == 17) {print "ok 3\n"}
else {print "not ok 3 ", scalar(@mpfr1), "\n"}

$ok = 1;
for(@mpfr2) {$ok = 0 if !Rmpfr_nan_p($_) }
if($ok) {print "ok 4\n"}
else {print "not ok 4 $ok\n"}

$ok = 1;
for(@mpfr2) {$ok = 0 if Rmpfr_get_prec($_) != 101 }
if($ok) {print "ok 5\n"}
else {print "not ok 5 $ok\n"}