Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

setup_starlab.C

Go to the documentation of this file.
00001 /*
00002  *  setup.C:    Basic setup for starlab programs.
00003  *
00004  *              currently, only sets output precision...
00005  *
00006  *.............................................................................
00007  *    version 1:  Nov 1994   Steve McMillan
00008  *    version 2:  
00009  *.............................................................................
00010  *  non-local functions: 
00011  *    set_starlab_precision
00012  *.............................................................................
00013  */
00014 
00015 #include "stdinc.h"
00016 
00017 static int precision = 0;
00018 
00019 #ifndef TOOLBOX
00020 
00021 void set_starlab_precision(ostream& o)
00022 {
00023     if (!precision) {
00024         char* s = getenv("STARLAB_PRECISION");
00025         if (s)
00026             precision = atoi(s);
00027         else
00028             precision = -1;
00029     }
00030 
00031     if (precision > 0) o.precision(precision);
00032 }
00033 
00034 #else
00035 
00036 main()
00037 {
00038    set_starlab_precision(cout);
00039 
00040    real x = sqrt(2.0);
00041    cout << "x = " << x << endl;
00042 }
00043 
00044 #endif

Generated at Sun Feb 24 09:57:15 2002 for STARLAB by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001