diff libinterp/corefcn/pr-output.cc @ 27434:57f5c5768eb3

Disallow exponential format in combination with fixed_point_format. * pr-output.cc (pr_float, pr_scale_header): Add test for "! print_e" to existing test for "! print_g" to disable fixed_point_format when either format is in use.
author Rik <rik@octave.org>
date Sat, 21 Sep 2019 17:17:02 -0700
parents fc7504df6a12
children 251056aeba5d
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc	Fri Sep 20 21:47:53 2019 -0700
+++ b/libinterp/corefcn/pr-output.cc	Sat Sep 21 17:17:02 2019 -0700
@@ -1416,7 +1416,7 @@
 {
   double scale = fmt.scale_factor ();
 
-  if (Vfixed_point_format && ! print_g && scale != 1)
+  if (Vfixed_point_format && ! (print_g || print_e) && scale != 1)
     val /= scale;
 
   pr_any_float (os, fmt.real_format (), val);
@@ -1442,7 +1442,7 @@
   T scale = static_cast<T> (dscale);
 
   std::complex<T> tmp
-    = ((Vfixed_point_format && ! print_g && scale != 1)
+    = ((Vfixed_point_format && ! (print_g || print_e) && scale != 1)
        ? cval / scale : cval);
 
   T r = tmp.real ();
@@ -1513,7 +1513,7 @@
 static inline void
 pr_scale_header (std::ostream& os, double scale)
 {
-  if (Vfixed_point_format && ! print_g && scale != 1)
+  if (Vfixed_point_format && ! (print_g || print_e) && scale != 1)
     {
       octave::preserve_stream_state stream_state (os);