diff --git a/apps/graph/test/ranges.cpp b/apps/graph/test/ranges.cpp index 5056fd343..a2f5b8edf 100644 --- a/apps/graph/test/ranges.cpp +++ b/apps/graph/test/ranges.cpp @@ -71,7 +71,7 @@ QUIZ_CASE(graph_ranges_single_function) { assert_best_cartesian_range_is("0", -10, 10, -5.81249952, 4.81249952); assert_best_cartesian_range_is("1", -10, 10, -4.81249952, 5.81249952); - assert_best_cartesian_range_is("-100", -10, 10, -105.662506, -95.0375061); + assert_best_cartesian_range_is("-100", -10, 10, -105.8125, -95.1875); assert_best_cartesian_range_is("0.01", -10, 10, -5.81249952, 4.81249952); assert_best_cartesian_range_is("x", -10, 10, -5.66249943, 4.96249962); diff --git a/poincare/src/zoom.cpp b/poincare/src/zoom.cpp index b999a4d17..ac9eb6390 100644 --- a/poincare/src/zoom.cpp +++ b/poincare/src/zoom.cpp @@ -317,7 +317,7 @@ void Zoom::RangeWithRatioForDisplay(ValueAtAbscissa evaluation, float yxRatio, f * X axis. Conversely, very flat functions may only take a small portion of * the Y range. In those cases, the ratio is not suitable. */ if (bestBreadth < minimalXCoverage * sampleSize - || sample[bestIndex + bestBreadth] - sample[bestIndex] < minimalYCoverage * yRange) { + || sample[bestIndex + bestBreadth - 1] - sample[bestIndex] < minimalYCoverage * yRange) { *xMin = NAN; *xMax = NAN; *yMin = NAN;