Root output numbers in scientific format

Dear ROOT experts,

Good Morning.!

I have recently installed ROOT 6.10.04 on my macbook with El Capitan 10.11.6 following the instructions from REAEME/INSTALL with cmake build.

One thing which bothers me was the notation of the number output. For example, the simple GetMean() function returns the value as shown,

root [0] hist->GetMean()
(double) 35477527242146.218750

But, I wanted the output in scientific notation. Could you suggest me any trick to get the output in the desired format?

Thanks a lot in advance,
Prasad

On Mac, with the master version, I get:

$ root
   -----------------------------------------------------------------
  | Welcome to ROOT 6.11/01                     http://root.cern.ch |
  |                                    (c) 1995-2017, The ROOT Team |
  | Built for macosx64                                              |
  | From heads/master@v6-09-02-1926-gcf9ce83, Aug 08 2017, 10:31:53 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'      |
   -----------------------------------------------------------------

root [0] hpx->GetMean();
root [1] cout << hpx->GetMean() << endl;
-0.00401052
root [2] printf("%g\n",hpx->GetMean());
-0.00401052
root [3] printf("%f\n",hpx->GetMean());
-0.004011
root [4] printf("%e\n",hpx->GetMean());
-4.010516e-03
root [5] 

That works. Thanks a lot.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.