GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
pr-flt-fmt.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-2018 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software: you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if defined (HAVE_CONFIG_H)
24 # include "config.h"
25 #endif
26 
27 #include "defun.h"
28 #include "error.h"
29 #include "pr-flt-fmt.h"
30 #include "variables.h"
31 
32 // The precision of the numbers printed by the default output
33 // routines.
34 static int Voutput_precision = 5;
35 
36 int
38 {
39  return Voutput_precision;
40 }
41 
42 void
43 set_output_prec (int prec)
44 {
45  Voutput_precision = prec;
46 }
47 
48 DEFUN (output_max_field_width, , ,
49  doc: /* -*- texinfo -*-
50 @deftypefn {} {} output_max_field_width
51 This function is obsolete and will be removed from a future version
52 of Octave.
53 @end deftypefn */)
54 {
55  return octave_value (20);
56 }
57 
59  doc: /* -*- texinfo -*-
60 @deftypefn {} {@var{val} =} output_precision ()
61 @deftypefnx {} {@var{old_val} =} output_precision (@var{new_val})
62 @deftypefnx {} {} output_precision (@var{new_val}, "local")
63 Query or set the internal variable that specifies the minimum number of
64 significant figures to display for numeric output.
65 
66 Note that regardless of the value set for @code{output_precision}, the
67 number of digits of precision displayed is limited to 16 for double
68 precision values and 7 for single precision values.
69 
70 When called from inside a function with the @qcode{"local"} option, the
71 variable is changed locally for the function and any subroutines it calls.
72 The original variable value is restored when exiting the function.
73 
74 @seealso{format, fixed_point_format}
75 @end deftypefn */)
76 {
78 }
#define SET_INTERNAL_VARIABLE_WITH_LIMITS(NM, MINVAL, MAXVAL)
Definition: variables.h:115
int output_precision(void)
Definition: pr-flt-fmt.cc:37
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
Definition: defun.h:53
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
Definition: ov-usr-fcn.cc:997
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
static int Voutput_precision
Definition: pr-flt-fmt.cc:34
void set_output_prec(int prec)
Definition: pr-flt-fmt.cc:43