in reply to Re^2: Static typing is mostly a waste of time
in thread Static typing is mostly a waste of time
...for square roots even if you can trust the compiler that you are getting a number, you have to make sure that it is not negative (unless your sqrt function deals with complex numbers).Even if your sqrt doesn't do complex numbers, you'll still get an exception for negative answers. Which seems like a better alternative than returning a garbage answer.
$a = ["abc",123]; $b = -1; print sqrt($a); print sqrt($b);
|
|---|