Disney BSSRDF, PDF of scattering profile

Percentage Accurate: 99.6% → 99.6%
Time: 7.2s
Alternatives: 3
Speedup: N/A×

Specification

?
\[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
\[\begin{array}{l} \\ \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} \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))))
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));
}
function code(s, r)
	return Float32(Float32(Float32(Float32(0.25) * exp(Float32(Float32(-r) / s))) / Float32(Float32(Float32(Float32(2.0) * Float32(pi)) * s) * r)) + Float32(Float32(Float32(0.75) * exp(Float32(Float32(-r) / Float32(Float32(3.0) * s)))) / Float32(Float32(Float32(Float32(6.0) * Float32(pi)) * s) * r)))
end
function tmp = code(s, r)
	tmp = ((single(0.25) * exp((-r / s))) / (((single(2.0) * single(pi)) * s) * r)) + ((single(0.75) * exp((-r / (single(3.0) * s)))) / (((single(6.0) * single(pi)) * s) * r));
end
\begin{array}{l}

\\
\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}
\end{array}

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 3 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \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} \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))))
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));
}
function code(s, r)
	return Float32(Float32(Float32(Float32(0.25) * exp(Float32(Float32(-r) / s))) / Float32(Float32(Float32(Float32(2.0) * Float32(pi)) * s) * r)) + Float32(Float32(Float32(0.75) * exp(Float32(Float32(-r) / Float32(Float32(3.0) * s)))) / Float32(Float32(Float32(Float32(6.0) * Float32(pi)) * s) * r)))
end
function tmp = code(s, r)
	tmp = ((single(0.25) * exp((-r / s))) / (((single(2.0) * single(pi)) * s) * r)) + ((single(0.75) * exp((-r / (single(3.0) * s)))) / (((single(6.0) * single(pi)) * s) * r));
end
\begin{array}{l}

\\
\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}
\end{array}

Alternative 1: 99.6% accurate, N/A× speedup?

\[\begin{array}{l} \\ \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(\pi \cdot 6\right) \cdot \left(s \cdot r\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)))) (* (* PI 6.0) (* s r)))))
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)))) / ((((float) M_PI) * 6.0f) * (s * r)));
}
function code(s, r)
	return Float32(Float32(Float32(Float32(0.25) * exp(Float32(Float32(-r) / s))) / Float32(Float32(Float32(Float32(2.0) * Float32(pi)) * s) * r)) + Float32(Float32(Float32(0.75) * exp(Float32(Float32(-r) / Float32(Float32(3.0) * s)))) / Float32(Float32(Float32(pi) * Float32(6.0)) * Float32(s * r))))
end
function tmp = code(s, r)
	tmp = ((single(0.25) * exp((-r / s))) / (((single(2.0) * single(pi)) * s) * r)) + ((single(0.75) * exp((-r / (single(3.0) * s)))) / ((single(pi) * single(6.0)) * (s * r)));
end
\begin{array}{l}

\\
\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(\pi \cdot 6\right) \cdot \left(s \cdot r\right)}
\end{array}
Derivation
  1. Initial program 99.5%

    \[\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} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\color{blue}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}} \]
    2. lift-*.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\color{blue}{\left(\left(6 \cdot \pi\right) \cdot s\right)} \cdot r} \]
    3. associate-*l*N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\color{blue}{\left(6 \cdot \pi\right) \cdot \left(s \cdot r\right)}} \]
    4. lower-*.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\color{blue}{\left(6 \cdot \pi\right) \cdot \left(s \cdot r\right)}} \]
    5. lift-PI.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\left(6 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot \left(s \cdot r\right)} \]
    6. lift-*.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\color{blue}{\left(6 \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(s \cdot r\right)} \]
    7. *-commutativeN/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\color{blue}{\left(\mathsf{PI}\left(\right) \cdot 6\right)} \cdot \left(s \cdot r\right)} \]
    8. lower-*.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\color{blue}{\left(\mathsf{PI}\left(\right) \cdot 6\right)} \cdot \left(s \cdot r\right)} \]
    9. lift-PI.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\color{blue}{\pi} \cdot 6\right) \cdot \left(s \cdot r\right)} \]
    10. lower-*.f3299.5

      \[\leadsto \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(\pi \cdot 6\right) \cdot \color{blue}{\left(s \cdot r\right)}} \]
  4. Applied rewrites99.5%

    \[\leadsto \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}}}{\color{blue}{\left(\pi \cdot 6\right) \cdot \left(s \cdot r\right)}} \]
  5. Add Preprocessing

Alternative 2: 99.6% accurate, N/A× speedup?

\[\begin{array}{l} \\ \frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\pi \cdot 2\right) \cdot \left(s \cdot r\right)} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \end{array} \]
(FPCore (s r)
 :precision binary32
 (+
  (/ (* 0.25 (exp (/ (- r) s))) (* (* PI 2.0) (* s r)))
  (/ (* 0.75 (exp (/ (- r) (* 3.0 s)))) (* (* (* 6.0 PI) s) r))))
float code(float s, float r) {
	return ((0.25f * expf((-r / s))) / ((((float) M_PI) * 2.0f) * (s * r))) + ((0.75f * expf((-r / (3.0f * s)))) / (((6.0f * ((float) M_PI)) * s) * r));
}
function code(s, r)
	return Float32(Float32(Float32(Float32(0.25) * exp(Float32(Float32(-r) / s))) / Float32(Float32(Float32(pi) * Float32(2.0)) * Float32(s * r))) + Float32(Float32(Float32(0.75) * exp(Float32(Float32(-r) / Float32(Float32(3.0) * s)))) / Float32(Float32(Float32(Float32(6.0) * Float32(pi)) * s) * r)))
end
function tmp = code(s, r)
	tmp = ((single(0.25) * exp((-r / s))) / ((single(pi) * single(2.0)) * (s * r))) + ((single(0.75) * exp((-r / (single(3.0) * s)))) / (((single(6.0) * single(pi)) * s) * r));
end
\begin{array}{l}

\\
\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\pi \cdot 2\right) \cdot \left(s \cdot r\right)} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\end{array}
Derivation
  1. Initial program 99.5%

    \[\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} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
    2. lift-*.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right)} \cdot r} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
    3. associate-*l*N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\color{blue}{\left(2 \cdot \pi\right) \cdot \left(s \cdot r\right)}} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
    4. lower-*.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\color{blue}{\left(2 \cdot \pi\right) \cdot \left(s \cdot r\right)}} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
    5. lift-PI.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\left(2 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot \left(s \cdot r\right)} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
    6. lift-*.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\color{blue}{\left(2 \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(s \cdot r\right)} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
    7. *-commutativeN/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\color{blue}{\left(\mathsf{PI}\left(\right) \cdot 2\right)} \cdot \left(s \cdot r\right)} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
    8. lower-*.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\color{blue}{\left(\mathsf{PI}\left(\right) \cdot 2\right)} \cdot \left(s \cdot r\right)} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
    9. lift-PI.f32N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{\frac{-r}{s}}}{\left(\color{blue}{\pi} \cdot 2\right) \cdot \left(s \cdot r\right)} + \frac{\frac{3}{4} \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
    10. lower-*.f3299.4

      \[\leadsto \frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\pi \cdot 2\right) \cdot \color{blue}{\left(s \cdot r\right)}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  4. Applied rewrites99.4%

    \[\leadsto \frac{0.25 \cdot e^{\frac{-r}{s}}}{\color{blue}{\left(\pi \cdot 2\right) \cdot \left(s \cdot r\right)}} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  5. Add Preprocessing

Alternative 3: 8.6% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(r \cdot \pi\right)}^{2}\\ t_1 := \frac{-r}{s}\\ \frac{r}{s} \cdot \frac{0.015625 \cdot \left(\frac{e^{t\_1 \cdot 2}}{t\_0} - \frac{e^{\left(-0.3333333333333333 \cdot \frac{r}{s}\right) \cdot 2}}{t\_0}\right)}{0.125 \cdot \left(\frac{e^{t\_1}}{\pi} - \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{\pi}\right)} \end{array} \end{array} \]
(FPCore (s r)
 :precision binary32
 (let* ((t_0 (pow (* r PI) 2.0)) (t_1 (/ (- r) s)))
   (*
    (/ r s)
    (/
     (*
      0.015625
      (-
       (/ (exp (* t_1 2.0)) t_0)
       (/ (exp (* (* -0.3333333333333333 (/ r s)) 2.0)) t_0)))
     (*
      0.125
      (- (/ (exp t_1) PI) (/ (pow (exp -0.3333333333333333) (/ r s)) PI)))))))
float code(float s, float r) {
	float t_0 = powf((r * ((float) M_PI)), 2.0f);
	float t_1 = -r / s;
	return (r / s) * ((0.015625f * ((expf((t_1 * 2.0f)) / t_0) - (expf(((-0.3333333333333333f * (r / s)) * 2.0f)) / t_0))) / (0.125f * ((expf(t_1) / ((float) M_PI)) - (powf(expf(-0.3333333333333333f), (r / s)) / ((float) M_PI)))));
}
function code(s, r)
	t_0 = Float32(r * Float32(pi)) ^ Float32(2.0)
	t_1 = Float32(Float32(-r) / s)
	return Float32(Float32(r / s) * Float32(Float32(Float32(0.015625) * Float32(Float32(exp(Float32(t_1 * Float32(2.0))) / t_0) - Float32(exp(Float32(Float32(Float32(-0.3333333333333333) * Float32(r / s)) * Float32(2.0))) / t_0))) / Float32(Float32(0.125) * Float32(Float32(exp(t_1) / Float32(pi)) - Float32((exp(Float32(-0.3333333333333333)) ^ Float32(r / s)) / Float32(pi))))))
end
function tmp = code(s, r)
	t_0 = (r * single(pi)) ^ single(2.0);
	t_1 = -r / s;
	tmp = (r / s) * ((single(0.015625) * ((exp((t_1 * single(2.0))) / t_0) - (exp(((single(-0.3333333333333333) * (r / s)) * single(2.0))) / t_0))) / (single(0.125) * ((exp(t_1) / single(pi)) - ((exp(single(-0.3333333333333333)) ^ (r / s)) / single(pi)))));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(r \cdot \pi\right)}^{2}\\
t_1 := \frac{-r}{s}\\
\frac{r}{s} \cdot \frac{0.015625 \cdot \left(\frac{e^{t\_1 \cdot 2}}{t\_0} - \frac{e^{\left(-0.3333333333333333 \cdot \frac{r}{s}\right) \cdot 2}}{t\_0}\right)}{0.125 \cdot \left(\frac{e^{t\_1}}{\pi} - \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{\pi}\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 99.5%

    \[\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} \]
  2. Add Preprocessing
  3. Applied rewrites10.8%

    \[\leadsto \color{blue}{\frac{{\left(0.25 \cdot \frac{e^{\frac{-r}{s}}}{\left(\left(\pi \cdot 2\right) \cdot s\right) \cdot r}\right)}^{2} - {\left(\frac{0.75}{\left(\pi \cdot 6\right) \cdot s} \cdot \frac{e^{\frac{\frac{-r}{3}}{s}}}{r}\right)}^{2}}{\frac{\frac{e^{\frac{-r}{s}} \cdot 0.25}{\left(\pi \cdot 2\right) \cdot s} - \frac{e^{\frac{\frac{-r}{3}}{s}} \cdot 0.75}{\left(\pi \cdot 6\right) \cdot s}}{r}}} \]
  4. Taylor expanded in s around 0

    \[\leadsto \color{blue}{\frac{r \cdot \left(\frac{1}{64} \cdot \frac{{\left(e^{-1 \cdot \frac{r}{s}}\right)}^{2}}{{r}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}} - \frac{1}{64} \cdot \frac{{\left(e^{\frac{-1}{3} \cdot \frac{r}{s}}\right)}^{2}}{{r}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}}\right)}{s \cdot \left(\frac{1}{8} \cdot \frac{e^{-1 \cdot \frac{r}{s}}}{\mathsf{PI}\left(\right)} - \frac{1}{8} \cdot \frac{e^{\frac{-1}{3} \cdot \frac{r}{s}}}{\mathsf{PI}\left(\right)}\right)}} \]
  5. Applied rewrites10.2%

    \[\leadsto \color{blue}{\frac{r}{s} \cdot \frac{0.015625 \cdot \left(\frac{e^{\frac{-r}{s} \cdot 2}}{{\left(r \cdot \pi\right)}^{2}} - \frac{e^{\left(-0.3333333333333333 \cdot \frac{r}{s}\right) \cdot 2}}{{\left(r \cdot \pi\right)}^{2}}\right)}{0.125 \cdot \left(\frac{e^{\frac{-r}{s}}}{\pi} - \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{\pi}\right)}} \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2025057 
(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))))