Fitting TGraphErrors returns incorrect errors

Hello Rooters,

I fitted TGraphErrors and got incorrect errors of fitting values.

Double_t x1[2] = {1.e8, 1.e8 + 1.e6}; //base 1.e8 has no problem.
Double_t x2[2] = {1.e9, 1.e9 + 1.e6}; //base 1.e9 returns not proper error.
Double_t y[2] = {0., 1.};
Double_t ex[2] = {1., 1.}; //if error x is 0, fits have no problems.
Double_t ey[2] = {0.1, 0.1};

TGraphErrors *gr1 = new TGraphErrors(num, x1, y, ex, ey);
TGraphErrors *gr2 = new TGraphErrors(num, x2, y, ex, ey);

pol1 fitting of the two graphs returns different errors, especially the fitting of gr2 returns too small errors.
Please see attachment for detail.

Does anybody knows why it does not return correct errors?

I’m using
ROOT 5.34/36
MacOS 10.11.6

Best regards,
fit2points.C (861 Bytes)


This is clearly a numerical error due to the limited double precision. You should just rescale your x values around 1 and I am sure you will get the correct error.