Hi Christophe, The explanation of this apparent problem is the following: When you do: root [1] cout << x-6.7 << endl; CINT makes the difference between x (a float) and 6.7 (a double) if you do float x=6.7; float y = 6.7 cout <<x-y<<endl; you will get 0 Rene Brun Christophe DELAERE wrote: > > Part 1.1 Type: Plain Text (text/plain) > Encoding: 7bit Hi rooters, I've noticed the following strange behaviour using ROOT 3.02/07. When I declare a single variable, there are discrepancies between the value entered and actual value stored, even for basic float objects. When a float is declared and filled, the value stored is slightly different from what is needed. In most of the cases this is not a problem, but it can be if the variable is multiplied by a large interger. Is this fact known ? Is there a simple solution? Thanks, Christophe. p.s: Here is a c&p of a minimal session. I'm running linux redhat 6.2 with a precompiled ROOT 3.02/07. root [0] Float_t x = 6.7 root [1] cout << x-6.7 << endl; -1.90735e-07 root [2] cout << x << endl; 6.7 root [3] x (Float_t)6.69999980926513672e+00
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:52 MET