コード例 #1
0
 /** @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();
 }