1 + v \cdot \log \left(u + \left(1 - u\right) \cdot e^{\frac{-2}{v}}\right)
\begin{array}{l}
t_0 := \log \left(\mathsf{fma}\left(1 - u, e^{\frac{-2}{v}}, u\right)\right)\\
\mathsf{fma}\left(v, \sqrt[3]{t_0 \cdot t_0} \cdot \sqrt[3]{t_0}, 1\right)
\end{array}
(FPCore (u v) :precision binary32 (+ 1.0 (* v (log (+ u (* (- 1.0 u) (exp (/ -2.0 v))))))))
(FPCore (u v) :precision binary32 (let* ((t_0 (log (fma (- 1.0 u) (exp (/ -2.0 v)) u)))) (fma v (* (cbrt (* t_0 t_0)) (cbrt t_0)) 1.0)))
float code(float u, float v) {
return 1.0f + (v * logf(u + ((1.0f - u) * expf(-2.0f / v))));
}
float code(float u, float v) {
float t_0 = logf(fmaf((1.0f - u), expf(-2.0f / v), u));
return fmaf(v, (cbrtf(t_0 * t_0) * cbrtf(t_0)), 1.0f);
}



Bits error versus u



Bits error versus v
Initial program 0.2
Simplified0.2
Applied add-cube-cbrt_binary320.2
Applied add-cbrt-cube_binary320.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2021329
(FPCore (u v)
:name "HairBSDF, sample_f, cosTheta"
:precision binary32
:pre (and (and (<= 1e-5 u) (<= u 1.0)) (and (<= 0.0 v) (<= v 109.746574)))
(+ 1.0 (* v (log (+ u (* (- 1.0 u) (exp (/ -2.0 v))))))))