00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
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