changeset 31660:ccbf38427774 stable

doc: Note interaction between format and output_precision (bug #39832) * libinterp/corefcn/pr-flt-fmt.cc (output_precision), pr-output.cc (format): Add note to docstring indicating that format can change the set value of output_precision.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Sat, 10 Dec 2022 07:19:18 -0500
parents 963672a9ae7b
children 5fb15fb04e09 505ed551e366
files libinterp/corefcn/pr-flt-fmt.cc libinterp/corefcn/pr-output.cc
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/pr-flt-fmt.cc	Fri Dec 09 12:21:14 2022 -0500
+++ b/libinterp/corefcn/pr-flt-fmt.cc	Sat Dec 10 07:19:18 2022 -0500
@@ -60,7 +60,9 @@
 
 Note that regardless of the value set for @code{output_precision}, the
 number of digits of precision displayed is limited to 16 for double
-precision values and 7 for single precision values.
+precision values and 7 for single precision values.  Also, calls to the
+@code{format} function that change numeric display can also change the set
+value for @code{output_precision}.
 
 When called from inside a function with the @qcode{"local"} option, the
 variable is changed locally for the function and any subroutines it calls.
--- a/libinterp/corefcn/pr-output.cc	Fri Dec 09 12:21:14 2022 -0500
+++ b/libinterp/corefcn/pr-output.cc	Sat Dec 10 07:19:18 2022 -0500
@@ -3819,10 +3819,12 @@
 Reset or specify the format of the output produced by @code{disp} and Octave's
 normal echoing mechanism.
 
-This command only affects the display of numbers, but not how they are stored
+This command only affects the display of numbers, not how they are stored
 or computed.  To change the internal representation from the default double use
 one of the conversion functions such as @code{single}, @code{uint8},
-@code{int64}, etc.
+@code{int64}, etc.  Any @code{format} options that change the number of
+displayed significant digits will also be reflected by the
+@code{output_precision} function.
 
 By default, Octave displays 5 significant digits in a human readable form
 (option @samp{short}, option @samp{lowercase}, and option @samp{loose} format