Stop shell calculator from rounding?

Hello community,

I would like to use the shell as an interactive calculator but without coding.

When performing a trivial calculation, output is rounded up.

root [0] 100.8748564398013560*2
(double) 201.74971

I would rather see something closer to

201.749712879602712

I understand the vast possibilities of coding but is there a simple setting I can change?

   ------------------------------------------------------------------
  | Welcome to ROOT 6.28/04                        https://root.cern |
  | (c) 1995-2022, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on May 08 2023, 02:44:07                 |
  | From tags/v6-28-04@v6-28-04                                      |
  | With c++ (GCC) 13.1.1 20230429                                   |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------

Welcome to the ROOT forum.

That’s a matter of printout formating:

root [0] double a = 100.8748564398013560*2
(double) 201.74971
root [1] printf("%20.15f\n",a)
 201.749712879602725
(int) 21
root [2] 

Thank you couet.

Is there a way to account for the difference of 0.000000000000013 ? When I use other calculators, I am given 201.749712879602712

root [0] double a = 100.8748564398013560*2
(double) 201.74971
root [1] printf("%30.25f\n",a)
 201.7497128796027254793443717
root [2] 

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