ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Maths.php File Reference

Go to the source code of this file.

Functions

 hypo ($a, $b)
 Pythagorean Theorem:. More...
 

Function Documentation

◆ hypo()

hypo (   $a,
  $b 
)

Pythagorean Theorem:.

a = 3 b = 4 r = sqrt(square(a) + square(b)) r = 5

r = sqrt(a^2 + b^2) without under/overflow.

Parameters
mixed$a
mixed$b
Returns
float

Definition at line 18 of file Maths.php.

19{
20 if (abs($a) > abs($b)) {
21 $r = $b / $a;
22 $r = abs($a) * sqrt(1 + $r * $r);
23 } elseif ($b != 0) {
24 $r = $a / $b;
25 $r = abs($b) * sqrt(1 + $r * $r);
26 } else {
27 $r = 0.0;
28 }
29
30 return $r;
31}
$r
Definition: example_031.php:79

References $r.

Referenced by PhpOffice\PhpSpreadsheet\Shared\JAMA\SingularValueDecomposition\__construct(), PhpOffice\PhpSpreadsheet\Shared\JAMA\QRDecomposition\__construct(), and PhpOffice\PhpSpreadsheet\Shared\JAMA\EigenvalueDecomposition\tql2().

+ Here is the caller graph for this function: