Skip to content

Commit

Permalink
Add a few div_In tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Jan 17, 2018
1 parent 46cf367 commit 92730bf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion t/nqp/060-bigint.t
@@ -1,7 +1,7 @@
#! nqp
use nqpmo;

plan(130);
plan(134);

my $knowhow := nqp::knowhow();
my $bi_type := $knowhow.new_type(:name('TestBigInt'), :repr('P6bigint'));
Expand Down Expand Up @@ -216,6 +216,14 @@ my $n := nqp::div_In(
nqp::pow_I(box(203), box(200), $n_type, $bi_type),
nqp::pow_I(box(200), box(200), $n_type, $bi_type),
);

my $huge := nqp::pow_I(box(10), box(300), $n_type, $bi_type);

ok(nqp::div_In(box(1), $huge) == 1e-300, 'super small result from div_In work');
ok(nqp::div_In(box(-1), box(5)) == -0.2, 'div_In -1 by 5');
ok(nqp::div_In(box(-1), box(20)) == -0.05, 'div_In -1 by 20');
ok(nqp::div_In(box(1), box(-200)) == -0.005, 'div_In 1 by -20');

ok(nqp::abs_n($n - 19.6430286394751) < 1e-10, 'div_In with big numbers');

my $maxRand := nqp::fromstr_I('10000000000000000000000000000000000000000', $bi_type);
Expand Down

0 comments on commit 92730bf

Please sign in to comment.