changeset 27433:fc7504df6a12

Display "0" for true zeros rather than "0.0000" (bug #53083). * pr-output.cc (pr_any_float): Add "else if" clause to check for 0 value and output "0" if found.
author Rik <rik@octave.org>
date Fri, 20 Sep 2019 21:47:53 -0700
parents 1e79d913baaa
children 57f5c5768eb3
files libinterp/corefcn/pr-output.cc
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc	Fri Sep 20 15:22:01 2019 -0700
+++ b/libinterp/corefcn/pr-output.cc	Fri Sep 20 21:47:53 2019 -0700
@@ -1360,6 +1360,15 @@
             }
         }
     }
+  else if (val == 0)
+    {
+      octave::preserve_stream_state stream_state (os);
+
+      if (fw > 0)
+        os << std::setw (fw) << "0";
+      else
+        os << "0";
+    }
   else if (octave::math::isna (val))
     {
       octave::preserve_stream_state stream_state (os);