Average Error: 0.1 → 0.1
Time: 6.5s
Precision: binary32
\[\left(0 \leq s \land s \leq 256\right) \land \left(10^{-6} < r \land r < 1000000\right)\]
\[\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} \]
\[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(2 \cdot \pi\right) \cdot \left(r \cdot s\right)} + \frac{0.75}{s \cdot \left(\pi \cdot 6\right)} \cdot \frac{e^{\frac{-r}{s \cdot 3}}}{r} \]
\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}
\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(2 \cdot \pi\right) \cdot \left(r \cdot s\right)} + \frac{0.75}{s \cdot \left(\pi \cdot 6\right)} \cdot \frac{e^{\frac{-r}{s \cdot 3}}}{r}
(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
 (+
  (/ (* 0.25 (exp (/ (- r) s))) (* (* 2.0 PI) (* r s)))
  (* (/ 0.75 (* s (* PI 6.0))) (/ (exp (/ (- r) (* s 3.0))) 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));
}
float code(float s, float r) {
	return ((0.25f * expf(-r / s)) / ((2.0f * ((float) M_PI)) * (r * s))) + ((0.75f / (s * (((float) M_PI) * 6.0f))) * (expf(-r / (s * 3.0f)) / r));
}

Error

Bits error versus s

Bits error versus r

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[\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. Applied associate-*l*_binary320.1

    \[\leadsto \frac{0.25 \cdot e^{\frac{-r}{s}}}{\color{blue}{\left(2 \cdot \pi\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} \]
  3. Applied times-frac_binary320.1

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

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

Reproduce

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