示例#1
0
 public function testDiv()
 {
     $quotient;
     $reminder;
     CMathi::div(11, 5, $quotient, $reminder);
     $this->assertTrue($quotient === 2 && $reminder === 1);
     $quotient;
     $reminder;
     CMathi::div(9, 3, $quotient, $reminder);
     $this->assertTrue($quotient === 3 && $reminder === 0);
     $quotient;
     $reminder;
     CMathi::div(-25, 7, $quotient, $reminder);
     $this->assertTrue($quotient === -3 && $reminder === -4);
     $quotient;
     $reminder;
     CMathi::div(-25, -7, $quotient, $reminder);
     $this->assertTrue($quotient === 3 && $reminder === -4);
     $quotient;
     $reminder;
     CMathi::div(11.01, 5.01, $quotient, $reminder);
     $this->assertTrue($quotient === 2 && $reminder === 1);
     $quotient;
     $reminder;
     CMathi::div(9.01, 3.01, $quotient, $reminder);
     $this->assertTrue($quotient === 3 && $reminder === 0);
 }