/** @test */
 public function should_find_the_square_root_of_two_numbers()
 {
     $command = new SquareRootCommand(new AnyNumber(32.222223344), new AnyNumber(7));
     $total = $command->run();
     $this->assertInstanceOf('PhilipBrown\\Math\\Number', $total);
     $this->assertEquals(5.6764622, $total->value());
 }
示例#2
0
文件: Math.php 项目: philipbrown/math
 /**
  * Find the square root of two numbers
  *
  * @param mixed $operant
  * @param mixed $scale
  * @return Number
  */
 public static function squareRoot($operand, $scale)
 {
     $operand = new AnyNumber($operand);
     $scale = new AnyNumber($scale);
     $command = new SquareRootCommand($operand, $scale);
     return $command->run();
 }