In the present paper, we investigate the approximation of a function by a polynomial with floating-point coefficients; we are looking for the best approximation in the L2 sense. Finding a best polynomial L2-approximation with real coefficients is an easy exercise about orthogonal projections. However, truncating the coefficients to floating-point numbers, which is needed for further computations, makes the approximation way worse. Hence, we study the problem of computing best approximations under the constraint that coefficients are floating-point numbers. We show that the corresponding problem is NP-hard, by reduction to the CVP problem.
We investigate the practical behaviour of exact and approximate algorithms for this problem. The conclusion is that it is possible in a short amount of time to obtain a relative or absolute best L^2 -approximation. The main applications are for large dimension, as a preliminary step of finding L-approximations and for functions with large variations, for which relative best approximation is by far more interesting than absolute.