isCli()) { $helper->log('This example should only be run from a Web Browser' . PHP_EOL); return; } ?>
Enter the coefficients for the Ax2 + Bx + C = 0

If A=0, the equation is not quadratic.
log('The equation is not quadratic'); } else { // Calculate and Display the results $helper->log('
Roots:
'); $discriminantFormula = '=POWER(' . $_POST['B'] . ',2) - (4 * ' . $_POST['A'] . ' * ' . $_POST['C'] . ')'; $discriminant = Calculation::getInstance()->calculateFormula($discriminantFormula); $r1Formula = '=IMDIV(IMSUM(-' . $_POST['B'] . ',IMSQRT(' . $discriminant . ')),2 * ' . $_POST['A'] . ')'; $r2Formula = '=IF(' . $discriminant . '=0,"Only one root",IMDIV(IMSUB(-' . $_POST['B'] . ',IMSQRT(' . $discriminant . ')),2 * ' . $_POST['A'] . '))'; /** @var string */ $output = Calculation::getInstance()->calculateFormula($r1Formula); $helper->log("$output"); /** @var string */ $output = Calculation::getInstance()->calculateFormula($r2Formula); $helper->log("$output"); $callEndTime = microtime(true); $helper->logEndingNotes(); } }