\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\begin{array}{l}
t_0 := \sqrt[3]{r \cdot \pi}\\
\frac{0.25 \cdot e^{\frac{-r}{s}}}{r \cdot \left(s \cdot \left(2 \cdot \pi\right)\right)} + \frac{0.75 \cdot e^{\frac{\frac{-r}{3}}{s}}}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(s \cdot \left({t_0}^{2.5} \cdot \sqrt{t_0}\right)\right) \cdot 6\right)\right)}
\end{array}
(FPCore (s r) :precision binary32 (+ (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r)) (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r))))
(FPCore (s r)
:precision binary32
(let* ((t_0 (cbrt (* r PI))))
(+
(/ (* 0.25 (exp (/ (- r) s))) (* r (* s (* 2.0 PI))))
(/
(* 0.75 (exp (/ (/ (- r) 3.0) s)))
(expm1 (log1p (* (* s (* (pow t_0 2.5) (sqrt t_0))) 6.0)))))))float code(float s, float r) {
return ((0.25f * expf(-r / s)) / (((2.0f * ((float) M_PI)) * s) * r)) + ((0.75f * expf(-r / (3.0f * s))) / (((6.0f * ((float) M_PI)) * s) * r));
}
float code(float s, float r) {
float t_0 = cbrtf(r * ((float) M_PI));
return ((0.25f * expf(-r / s)) / (r * (s * (2.0f * ((float) M_PI))))) + ((0.75f * expf((-r / 3.0f) / s)) / expm1f(log1pf((s * (powf(t_0, 2.5f) * sqrtf(t_0))) * 6.0f)));
}



Bits error versus s



Bits error versus r
Results
Initial program 0.1
Applied associate-/r*_binary320.1
Applied expm1-log1p-u_binary320.2
Simplified0.2
Applied add-cube-cbrt_binary320.2
Applied add-sqr-sqrt_binary320.2
Applied associate-*r*_binary320.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2022039
(FPCore (s r)
:name "Disney BSSRDF, PDF of scattering profile"
:precision binary32
:pre (and (and (<= 0.0 s) (<= s 256.0)) (and (< 1e-6 r) (< r 1000000.0)))
(+ (/ (* 0.25 (exp (/ (- r) s))) (* (* (* 2.0 PI) s) r)) (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r))))