I have a program that solves equations and sometimes the solutions x1
and x2
are numbers with a lot of decimal numbers. For example when Δ = 201
(Δ = discriminant) the square root gives me a floating point number.
I need a good approximation of that number because I also have a function that converts it into a fraction. So I thought to do this:
Result := FormatFloat('0.#####', StrToFloat(solx1));
The solx1
is a double. In this way, the number '456,9067896' becomes '456,90679'.
My question is this: if I approximate in this way, the fraction of 456,9067896
will be correct (and the same) if I have 456,90679
?