From 98ec8456931f20c91e6bc6675eacfc4ee538cf25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Wed, 17 Jan 2018 11:03:00 +0100 Subject: [PATCH] [apps] Graph: cheat for extremum on 0 --- apps/graph/cartesian_function.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/graph/cartesian_function.cpp b/apps/graph/cartesian_function.cpp index f033c6935..b2d56b274 100644 --- a/apps/graph/cartesian_function.cpp +++ b/apps/graph/cartesian_function.cpp @@ -63,6 +63,11 @@ CartesianFunction::Point CartesianFunction::nextMinimumOfFunction(double start, result = brentAlgorithm(bracket[0], bracket[2], evaluate, context); x = bracket[1]; } while (std::isnan(result.abscissa) && (step > 0.0 ? x <= max : x >= max)); + + if (std::fabs(result.abscissa) < 1E2*k_sqrtEps) { + result.abscissa = 0; + result.value = evaluate(this, 0, context); + } return result; }