Re: [ROOT] TF1 formula evaluates incorrectly

From: Stanislav Nesterov (Stanislav.Nesterov@cern.ch)
Date: Sat Jun 21 2003 - 12:02:07 MEST


    Hi Stilianos,
    Actually this is not true: Double_t and double types on most machines 
are identical. And even e^{-100} doesn't hit Float-type precision. 
    There is an artificial limit on exp(x) in TFormula::EvalPar that 
abs(x) can't be greater than 70 (I don't know why).

    So, Robert, if you really need such fine precision you have to write:

    TF1 f1("f1","expo",0,150);
    f1.SetParameter(0,1);
    f1.SetParameter(1,-1);
    f1.Eval(71);

				Best regards,
						Stanislav.


 On Fri, 20 Jun 2003, Stilianos Kesisoglou wrote:

> Hi Robert,
> 
>     Your TF1 formula evaluates correctly but you hit the machine precision
> for the
> specified returned type (Double_t).
> 
>     If you try "f1.Eval(70)" you get a non zero result.
> 
>     Look at the type of the returned value, it's "Double_t" for f1 and
> "double" for exp(-71)
> 
> Stelios.
> 
> ----- Original Message ----- 
> From: "Robert Vogel" <robert_vogel@msn.com>
> To: <Roottalk@pcroot.cern.ch>
> Sent: Friday, June 20, 2003 2:45 PM
> Subject: [ROOT] TF1 formula evaluates incorrectly
> 
> 
> > Running 3.04/02 on Redhat Linux 7.3.
> >
> > My TF1 formula does not evaluate correctly, while the explicit formula
> > using CINT does:
> >
> > root [0] TF1 f1("myf1","exp(-x)",0,150)
> > root [1] f1.Eval(71)
> > (Double_t)0.00000000000000000e+00
> > root [2] exp(-71)
> > (double)1.46248622725123092e-31
> > root [3]
> >
> > Any suggestions?
> >
> > Robert Vogel
> >
> > _________________________________________________________________
> > Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> > http://join.msn.com/?page=features/featuredemail
> >
> >
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET