The truth is rarely pure and never simple

gnuplot-fit: Undefined value during function evaluation

When I tried to fit some date for f(x)=a*(1-2*exp(-b*x)) gnuplot gave me the error

gnuplot> fit f(x) "foo" using 1:3 via a, b
         Undefined value during function evaluation

The reason could be found easily:

gnuplot> print a
0.312581387868822
gnuplot> print b
-1.44080853023923

As the valid range for x covers [1:500], the evaluated number exceeds the C double data range. But how to avoid this error when the fitting algorithm of gnuplot is considered being fixed? Go with f(x)=a*(1-2*exp(-b*b*x)) so the sign is always preserved. Just keep in mind that the error estimates of gnuplot have be to corrected according to the modified fitting function.