# HG changeset patch # User jwe # Date 757906160 0 # Node ID a419f80fc9a844b408e50950bfe6027f45df90fe # Parent ddf76073ce9620c4181c004be3483d6dee3fdfd8 [project @ 1994-01-07 01:26:09 by jwe] diff -r ddf76073ce96 -r a419f80fc9a8 src/builtins.cc --- a/src/builtins.cc Thu Jan 06 22:47:01 1994 +0000 +++ b/src/builtins.cc Fri Jan 07 01:29:20 1994 +0000 @@ -1,7 +1,7 @@ // builtins.cc -*- C++ -*- /* -Copyright (C) 1992, 1993 John W. Eaton +Copyright (C) 1992, 1993, 1994 John W. Eaton This file is part of Octave. @@ -721,6 +721,9 @@ "if a function does not return any values explicitly, return the\n\ last computed value", }, + { "save_precision", "??", set_save_precision, + "number of significant figures kept by the ASCII save command", }, + { "silent_functions", "false", silent_functions, "suppress printing results in called functions", }, @@ -845,6 +848,9 @@ tmp = new tree_constant (4.0 * atan (1.0)); bind_builtin_variable ("pi", tmp, 1, 1); + tmp = new tree_constant (17.0); + bind_builtin_variable ("save_precision", tmp, 0, 1); + tmp = new tree_constant (0.0); bind_builtin_variable ("stdin", tmp, 1, 1); diff -r ddf76073ce96 -r a419f80fc9a8 src/user-prefs.cc --- a/src/user-prefs.cc Thu Jan 06 22:47:01 1994 +0000 +++ b/src/user-prefs.cc Fri Jan 07 01:29:20 1994 +0000 @@ -1,7 +1,7 @@ // user-prefs.cc -*- C++ -*- /* -Copyright (C) 1992, 1993 John W. Eaton +Copyright (C) 1992, 1993, 1994 John W. Eaton This file is part of Octave. @@ -401,6 +401,35 @@ } int +set_save_precision (void) +{ + int status = 0; + + static int kludge = 0; + + double val; + if (builtin_real_scalar_variable ("save_precision", val) == 0) + { + int ival = NINT (val); + if (ival >= 0 && (double) ival == val) + { + user_pref.save_precision = ival; + return status; + } + } + + if (kludge == 0) + kludge++; + else + { + warning ("invalid value specified for save_precision"); + status = -1; + } + + return status; +} + +int sv_loadpath (void) { int status = 0; diff -r ddf76073ce96 -r a419f80fc9a8 src/user-prefs.h --- a/src/user-prefs.h Thu Jan 06 22:47:01 1994 +0000 +++ b/src/user-prefs.h Fri Jan 07 01:29:20 1994 +0000 @@ -1,7 +1,7 @@ // user-prefs.h -*- C++ -*- /* -Copyright (C) 1992, 1993 John W. Eaton +Copyright (C) 1992, 1993, 1994 John W. Eaton This file is part of Octave. @@ -47,6 +47,7 @@ int page_screen_output; int output_max_field_width; int output_precision; + int save_precision; char *loadpath; char *info_file; @@ -82,6 +83,7 @@ extern int set_output_max_field_width (void); extern int set_output_precision (void); +extern int set_save_precision (void); extern int sv_loadpath (void); extern int sv_info_file (void);