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

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. Using strategy rm
  3. Applied add-cbrt-cube_binary320.1

    \[\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 \color{blue}{\sqrt[3]{\left(s \cdot s\right) \cdot s}}}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  4. Applied add-cbrt-cube_binary320.1

    \[\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}{\color{blue}{\sqrt[3]{\left(3 \cdot 3\right) \cdot 3}} \cdot \sqrt[3]{\left(s \cdot s\right) \cdot s}}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  5. Applied cbrt-unprod_binary320.1

    \[\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}{\color{blue}{\sqrt[3]{\left(\left(3 \cdot 3\right) \cdot 3\right) \cdot \left(\left(s \cdot s\right) \cdot s\right)}}}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  6. Applied add-cbrt-cube_binary320.1

    \[\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{\color{blue}{\sqrt[3]{\left(\left(-r\right) \cdot \left(-r\right)\right) \cdot \left(-r\right)}}}{\sqrt[3]{\left(\left(3 \cdot 3\right) \cdot 3\right) \cdot \left(\left(s \cdot s\right) \cdot s\right)}}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  7. Applied cbrt-undiv_binary320.1

    \[\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^{\color{blue}{\sqrt[3]{\frac{\left(\left(-r\right) \cdot \left(-r\right)\right) \cdot \left(-r\right)}{\left(\left(3 \cdot 3\right) \cdot 3\right) \cdot \left(\left(s \cdot s\right) \cdot s\right)}}}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  8. Final simplification0.1

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

Reproduce

herbie shell --seed 2021206 
(FPCore (s r)
  :name "Disney BSSRDF, PDF of scattering profile"
  :precision binary32
  :pre (and (<= 0.0 s 256.0) (< 1e-6 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))))