Example #1
0
 /** @test */
 public function should_find_the_power_of_two_numbers()
 {
     $command = new PowerCommand(new AnyNumber(23.43), new AnyNumber(3), new PositiveNumber(5));
     $total = $command->run();
     $this->assertInstanceOf('PhilipBrown\\Math\\Number', $total);
     $this->assertEquals(12862.2476, $total->value());
 }
Example #2
0
 /**
  * Find the power two numbers
  *
  * @param mixed $left
  * @param mixed $right
  * @param mixed $scale
  * @return Number
  */
 public static function power($left, $right, $scale = 0)
 {
     $left = new AnyNumber($left);
     $right = new AnyNumber($right);
     $scale = new PositiveNumber($scale);
     $command = new PowerCommand($left, $right, $scale);
     return $command->run();
 }