changeset 14691:e3da2a68d709

Fix memory exhausted bug with log plots of small negative constant data (bug #36493) * graphics.cc (get_axis_limits): Widen small axis limits based on sign of smaller axis limit.
author Rik <octave@nomad.inbox5.com>
date Fri, 25 May 2012 16:02:05 -0700
parents 22244a235fd0
children 775fed9ed47d 972890bc9f38
files src/graphics.cc
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/graphics.cc	Thu May 24 15:38:59 2012 -0400
+++ b/src/graphics.cc	Fri May 25 16:02:05 2012 -0700
@@ -5928,8 +5928,17 @@
           // FIXME -- maybe this test should also be relative?
           if (std::abs (min_val - max_val) < sqrt (DBL_EPSILON))
             {
-              min_val *= 0.9;
-              max_val *= 1.1;
+              // Widen range when too small
+              if (min_val >= 0)
+                {
+                  min_val *= 0.9;
+                  max_val *= 1.1;
+                }
+              else
+                {
+                  min_val *= 1.1;
+                  max_val *= 0.9;
+                }
             }
           if (min_val > 0)
             {