Exemple #1
0
// cube root approximation using 3 iterations of Newton's method (float)
static float newton_cbrt3f(float d)
{
    float a = cbrt_5f(d);
    a = cbrta_newtonf(a, d);
    a = cbrta_newtonf(a, d);
    return cbrta_newtonf(a, d);
}
Exemple #2
0
static float
lab_f(const float x)
{
  const float epsilon = 216.0f/24389.0f;
  const float kappa   = 24389.0f/27.0f;
  if(x > epsilon)
  {
    // approximate cbrtf(x):
    const float a = cbrt_5f(x);
    return cbrta_halleyf(a, x);
  }
  else return (kappa*x + 16.0f)/116.0f;
}
Exemple #3
0
// cube root approximation using 2 iterations of Halley's method (float)
static float halley_cbrt2f(float d)
{
    float a = cbrt_5f(d);
    a = cbrta_halleyf(a, d);
    return cbrta_halleyf(a, d);
}