I am fitting data, with pol2, pol3, pol4,…
To describe the data best, I tries to fit them with pol5, of course now the function describes the data very well, but I found that in output text file, some output lines of the command fout<<fcn->GetParameter(i)<<"\t"<<fcn->GetParError(i);
is strange. for example

the error of a parameter is larger than the parameter, and it’s a very int 1…
when I tried to fit using pol4, error is usually 2-3 orders smaller than the parameter.
It’s seems the precision of error was lost, even for a large parameter like -0.0548926, right?

How can I keep the right errors of the large parameters at least?

Your introduction has a statement that is statistically speaking not correct:

“To describe the data best, I tries to fit them with pol5, of course now the function describes the data very well”

The fact that the line is closer to the points does not imply that it describes the data very well. This statement should be quantified with an F-test.

Hello Stefano,
Thanks for your reply, I deleted some lines, the code can reproduce the problem I introduced, if you change the value of npol to be 4 or smaller you will find the output parameters keep their precision. please find the attachments.
The output parameters would be saved in outputx.txt file.

Looking at your script+Data I notice that you do many fits with 30 points,
Each data point has x,y,dx,dy where dy is always 1.e-8.

Fitting a pol5 (6 parameters) you get results like

FCN=7296.59 FROM MINOS STATUS=PROBLEMS 1749 CALLS 9751 TOTAL
EDM=1.39941e-05 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 -3.39492e-02 2.63602e-05 2.90635e-08 -1.06365e+02
2 p1 2.44712e-03 5.98027e-08 -6.42361e-11 -1.56948e+05
3 p2 -7.96638e-08 1.88004e-11 -1.07878e-14 -5.84373e+08
4 p3 3.36353e-11 5.13638e-15 1.63028e-17 -2.17246e+12
5 p4 -6.75592e-15 1.97983e-18 -2.42450e-21 -7.16996e+15
6 p5 5.07464e-19 2.58296e-22 2.58296e-22 -1.45940e+20

Now realize that with doubles for delta < 1e-16, 1+delta = 1, so things are getting
suspicious around p4.

(Entertaining write-up about representation of numbers here)

If you are really interested in these high-order terms, you should represent your data differently .
Fit it first with “cheb2”, a seconder order member of the orthogonal set of Chebyshev functions.
Now subtract this fit from the data points and proceed with a cheb5, (the first three coefficients should be zero, or at least very close to it because the fit is non-linear).