Hi F.X, I have protected TMath::Acos and ASin in the CVS version. Rene Brun On Wed, 28 Apr 2004, GENTIT Francois-Xavier DAPNIA wrote: > 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. > > > > F.X.Gentit > > DAPNIA/SPP CEA Saclay > > http://gentit.home.cern.ch/gentit/ > > > >
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET