Skip to content

Instantly share code, notes, and snippets.

@reinsteam
Last active February 18, 2017 10:27
Show Gist options
  • Select an option

  • Save reinsteam/38e19d1afbf05a1c6b1aefbd3809961f to your computer and use it in GitHub Desktop.

Select an option

Save reinsteam/38e19d1afbf05a1c6b1aefbd3809961f to your computer and use it in GitHub Desktop.
Coefficients of minimax polynomial approximation of exp2(x) using the Remez Exchange Algorithm in range (0.0, 1.0]
// maximum relative error : 2.38418579e-07
const float exp2_c0 = 0.999999930f;
const float exp2_c1 = 0.693153100f;
const float exp2_c2 = 0.240153617f;
const float exp2_c3 = 0.055826318f;
const float exp2_c4 = 0.008989340f;
const float exp2_c5 = 0.0018775767f;
inline float exp2_zero_one_range(float x)
{
const float x2 = x * x;
const float poly0 = exp2_c1 * x + exp2_c0;
const float poly1 = exp2_c3 * x + exp2_c2;
const float poly2 = exp2_c5 * x + exp2_c4;
const float x4 = x2 * x2;
return poly2 * x4 + (poly1 * x2 + poly0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment