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; }
// 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); }