Example #1
0
 public function testToNatural()
 {
     $real = new Real(3.14);
     $nativeNatural = new Natural(3);
     $natural = $real->toNatural();
     $this->assertTrue($natural->sameValueAs($nativeNatural));
 }
Example #2
0
 public function testNegativeToNaturalHalfUp()
 {
     $real = new Real(-0.5);
     $natural = $real->toNatural(RoundingMode::HALF_UP());
     $this->assertInstanceOf(Natural::class, $natural);
     $this->assertSame(1, $natural->value());
 }