[ROOT] Modifications to TMath

From: GENTIT Francois-Xavier DAPNIA (GENTIT@dapnia.cea.fr)
Date: Wed Apr 28 2004 - 13:13:55 MEST

Hello Rooters,


Concerning the discussion about modifications in TMath, I want to report
about a problem I had recently. Try the following (in CINT or in compile
mode, it does not matter)


--> Double_t a = 1.0;

--> Double_t b = 4.0e-16;

--> a += b ;

--> Double_t c = TMath ::ACos(a)


  c is now equal to -1.#IND. If you are a purist, you will say ok, nothing
wrong, because the ACos of a value bigger than 1 does not make sense. But
such a small error as 4.0e-16 is normal when calculating in double
precision. So that it happens! For me, it happened when doing the scalar
product of 2 unit vectors which were parallel. And it does not crash the
program, but the program continues delivering wrong results!

  This is a nasty problem which obliged me to derive a new ACos (and ASin)
function with protections.







This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET