- sqrt: documentation ( source)
<?php
function delta(float $a, float $b, float $c): float
{
return ($b^2) - (4*$a*$c);
}
echo "Delta wynosi: ".delta(1,25,3) . "\n";
function msc_zerowe(float $a, float $b, float $c): float
{
return (-$b-sqrt(delta($a, $b, $c)))/2*$a;
}
echo "Miejsce zerowe wynosi: ".msc_zerowe(1, 25, 3);