From 4b75f7d46963871eca863854be35103b08ee8ca6 Mon Sep 17 00:00:00 2001 From: Gabriel Machado Date: Thu, 16 Mar 2017 12:24:43 -0300 Subject: [PATCH] Fix Quadratic equation solver example (#120) --- samples/45_Quadratic_equation_solver.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/45_Quadratic_equation_solver.php b/samples/45_Quadratic_equation_solver.php index 56bf4e7e..f5e11e47 100644 --- a/samples/45_Quadratic_equation_solver.php +++ b/samples/45_Quadratic_equation_solver.php @@ -1,7 +1,7 @@ -
+ Enter the coefficients for the Ax2 + Bx + C = 0 @@ -28,13 +28,13 @@ if (isset($_POST['submit'])) { echo '
Roots:
'; $discriminantFormula = '=POWER(' . $_POST['B'] . ',2) - (4 * ' . $_POST['A'] . ' * ' . $_POST['C'] . ')'; - $discriminant = PhpSpreadsheet_Calculation::getInstance()->calculateFormula($discriminantFormula); + $discriminant = \PhpOffice\PhpSpreadsheet\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'] . '))'; - echo PhpSpreadsheet_Calculation::getInstance()->calculateFormula($r1Formula) . '
'; - echo PhpSpreadsheet_Calculation::getInstance()->calculateFormula($r2Formula) . '
'; + echo \PhpOffice\PhpSpreadsheet\Calculation::getInstance()->calculateFormula($r1Formula) . '
'; + echo \PhpOffice\PhpSpreadsheet\Calculation::getInstance()->calculateFormula($r2Formula) . '
'; $callEndTime = microtime(true); $helper->logEndingNotes(); }