Ejemplo n.º 1
0
 public function testToBasePrecisionLessThanNumberOfDecimals()
 {
     $x = new \MyOddWeb\BigNumber(0.375);
     $base = $x->ToBase(10, 1);
     $this->assertSame("0.3", $base);
     $base = $x->ToBase(10, 2);
     $this->assertSame("0.37", $base);
     $base = $x->ToBase(10, 3);
     $this->assertSame("0.375", $base);
     $base = $x->ToBase(10, 10);
     $this->assertSame("0.375", $base);
     $x = new \MyOddWeb\BigNumber(1234.375);
     $base = $x->ToBase(10, 1);
     $this->assertSame("1234.3", $base);
     $base = $x->ToBase(10, 2);
     $this->assertSame("1234.37", $base);
     $base = $x->ToBase(10, 3);
     $this->assertSame("1234.375", $base);
     $base = $x->ToBase(10, 10);
     $this->assertSame("1234.375", $base);
 }