samhocevar / lolremez

📈 Polynomial Approximations using the Remez Algorithm
Do What The F*ck You Want To Public License
397 stars 36 forks source link

Query about the new --float --double --longdouble options #2

Closed sheredom closed 6 years ago

sheredom commented 7 years ago

I had a query about the new --float --double --longdouble options in 0.4 - specifically is there a way to sub the correctly represented float values back into the result?

I've had problems in the past where the rounding error when going from some any-precision-float -> float for the higher order terms of polynomials throws out the overall ULP of the result, and in the past I've had to then manually re-encode the correctly represented float values back into the original remez run so that the next term in the polynomial is aware of the precision loss of the preceding terms.

Thanks!

samhocevar commented 7 years ago

I’m afraid right now LolRemez ignores the fact that truncating to e.g. float creates a suboptimal solution.

Implementing this would require several additional full Remez runs (using the same technique as in this section of the tutorial), but it does make sense to make it automatic, yes.

sheredom commented 7 years ago

Ok - thanks for the quick response! I'll just run do some scripting in a loop for now as an interim solution.