TFormula::GetExpFormula() parameter rounding

Recently I ran into issues when I was fitting a graph to a parametric function. After fitting, I was making a copy of a TF2 using TF2::GetFormula ()->GetExpFormula(“P”) [1] and then computing fit error per point (data - fit). After a while, I found out that TFormula::GetExpFormula(“P”) rounds the parameters of the functions to 6 decimal places and this was producing very weird shapes for the error distribution.

Is there a way to specify the number of decimal places to use in TFormula::GetExpFormula(“P”)? If not, the fact that 6 decimal places is always used should be clearly stated in the documentation.

Thanks.

[1] ROOT: TFormula Class Reference

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

Hi @quantiser ,

thank you for the feedback and sorry for the high latency. We need @moneta to comment here, let’s ping him.

Cheers,
Enrico

1 Like

Hi,

I think this is an issue that we should fix. Since the parameters are double we should round them to the double precision value. I will open a GitHub issue on this

Cheers

Lorenzo

1 Like

Well, you should not “round” them. You simply need to make sure that every double-precision number is converted to a decimal string with (at least) 17 significant digits (for a single-precision number, a decimal string with 9 significant digits is needed).

BTW. The same problems appear in many places in ROOT, where the "%g" print format is unconditionally used. Example: TH1::Print

1 Like