public function testsub() { $a = 1234; $b = '1234123412341234123412341234123412412341234213412421341342342'; $c = '0x1234123412341234123412341234123412412341234213412421341342342'; $math = new GmpEngine(); $this->assertEquals(gmp_strval(gmp_sub($a, $a)), $math->sub($a, $a)); $this->assertEquals(gmp_strval(gmp_sub($b, $b)), $math->sub($b, $b)); $this->assertEquals(gmp_strval(gmp_sub($c, $c)), $math->sub($c, $c)); $this->assertEquals(0, $math->sub(1, 1)); }
public function testMod() { $a = 1234; $b = '-1675975991242824637446753124775730765934920727574049172215445180465096172921808707643480960976619010162856846742450225672776411590632518780962349126898196'; $c = '115792089237316195423570985008687907853269984665640564039457584007908834671663'; $math = new BcEngine(); $gmp = new GmpEngine(); $this->assertEquals($gmp->mod($a, $a), $math->mod($a, $a)); $this->assertEquals($gmp->mod($a, $b), $math->mod($a, $b)); $this->assertEquals($gmp->mod($b, $c), $math->mod($b, $c)); }