
(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))))
\begin{array}{l}
\\
\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \mathsf{PI}\left(\right)\right) \cdot s\right) \cdot r}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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))))
\begin{array}{l}
\\
\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \mathsf{PI}\left(\right)\right) \cdot s\right) \cdot r}
\end{array}
(FPCore (s r) :precision binary32 (+ (/ (* 0.25 (exp (/ r (- s)))) (* r (* s (* 2.0 (PI))))) (/ (* 0.75 (/ (exp (/ r (* s -3.0))) r)) (* s (* (PI) 6.0)))))
\begin{array}{l}
\\
\frac{0.25 \cdot e^{\frac{r}{-s}}}{r \cdot \left(s \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)} + \frac{0.75 \cdot \frac{e^{\frac{r}{s \cdot -3}}}{r}}{s \cdot \left(\mathsf{PI}\left(\right) \cdot 6\right)}
\end{array}
Initial program 99.7%
lift-*.f32N/A
lift-neg.f32N/A
lift-/.f32N/A
lift-exp.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
times-fracN/A
associate-*l/N/A
lower-/.f32N/A
Applied rewrites99.7%
Final simplification99.7%
(FPCore (s r)
:precision binary32
(let* ((t_0 (* s (PI)))
(t_1 (* s t_0))
(t_2 (exp (/ r (- s))))
(t_3 (/ (* 0.25 t_2) (* r (* s (* 2.0 (PI)))))))
(if (<=
(+ t_3 (/ (* 0.75 (exp (- (/ r (* s 3.0))))) (* r (* s (* (PI) 6.0)))))
1.999999987845058e-8)
(fma
(fma t_1 (/ 0.125 (PI)) (* s (* r -0.041666666666666664)))
(/ 1.0 (* s (* r t_1)))
(/ t_2 (* r (* t_0 8.0))))
(+
t_3
(/
(+
(/
(+
(/ (* r 0.006944444444444444) (PI))
(/ (* -0.0007716049382716049 (* r r)) t_0))
(* s s))
(+ (/ 0.125 (* r (PI))) (/ -0.041666666666666664 t_0)))
s)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \mathsf{PI}\left(\right)\\
t_1 := s \cdot t\_0\\
t_2 := e^{\frac{r}{-s}}\\
t_3 := \frac{0.25 \cdot t\_2}{r \cdot \left(s \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)}\\
\mathbf{if}\;t\_3 + \frac{0.75 \cdot e^{-\frac{r}{s \cdot 3}}}{r \cdot \left(s \cdot \left(\mathsf{PI}\left(\right) \cdot 6\right)\right)} \leq 1.999999987845058 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(t\_1, \frac{0.125}{\mathsf{PI}\left(\right)}, s \cdot \left(r \cdot -0.041666666666666664\right)\right), \frac{1}{s \cdot \left(r \cdot t\_1\right)}, \frac{t\_2}{r \cdot \left(t\_0 \cdot 8\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3 + \frac{\frac{\frac{r \cdot 0.006944444444444444}{\mathsf{PI}\left(\right)} + \frac{-0.0007716049382716049 \cdot \left(r \cdot r\right)}{t\_0}}{s \cdot s} + \left(\frac{0.125}{r \cdot \mathsf{PI}\left(\right)} + \frac{-0.041666666666666664}{t\_0}\right)}{s}\\
\end{array}
\end{array}
if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 1.99999999e-8Initial program 99.8%
Taylor expanded in s around inf
div-subN/A
sub-negN/A
associate-/l*N/A
associate-/l/N/A
associate-*l*N/A
unpow2N/A
lower-+.f32N/A
Applied rewrites3.7%
Applied rewrites3.7%
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
associate-*r*N/A
lift-*.f32N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f32N/A
lower-/.f323.7
lift-*.f32N/A
*-commutativeN/A
lower-*.f323.7
Applied rewrites3.7%
Applied rewrites98.1%
if 1.99999999e-8 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) Initial program 98.2%
Taylor expanded in s around -inf
Applied rewrites34.7%
lift-*.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-/.f32N/A
lift-*.f32N/A
lift-PI.f32N/A
lift-/.f32N/A
+-commutativeN/A
lower-+.f32N/A
lift-/.f32N/A
associate-*r/N/A
lower-/.f32N/A
lower-*.f3266.3
Applied rewrites66.3%
Final simplification93.7%
(FPCore (s r)
:precision binary32
(let* ((t_0 (* s (PI)))
(t_1 (* s t_0))
(t_2 (exp (/ r (- s))))
(t_3 (/ (* 0.25 t_2) (* r (* s (* 2.0 (PI)))))))
(if (<=
(+ t_3 (/ (* 0.75 (exp (- (/ r (* s 3.0))))) (* r (* s (* (PI) 6.0)))))
0.0)
(fma
(fma t_1 (/ 0.125 (PI)) (* s (* r -0.041666666666666664)))
(/ 1.0 (* s (* r t_1)))
(/ t_2 (* r (* t_0 8.0))))
(+
t_3
(/
(+
(+ (/ 0.125 (* r (PI))) (/ -0.041666666666666664 t_0))
(/ (* r 0.006944444444444444) t_1))
s)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \mathsf{PI}\left(\right)\\
t_1 := s \cdot t\_0\\
t_2 := e^{\frac{r}{-s}}\\
t_3 := \frac{0.25 \cdot t\_2}{r \cdot \left(s \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)}\\
\mathbf{if}\;t\_3 + \frac{0.75 \cdot e^{-\frac{r}{s \cdot 3}}}{r \cdot \left(s \cdot \left(\mathsf{PI}\left(\right) \cdot 6\right)\right)} \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(t\_1, \frac{0.125}{\mathsf{PI}\left(\right)}, s \cdot \left(r \cdot -0.041666666666666664\right)\right), \frac{1}{s \cdot \left(r \cdot t\_1\right)}, \frac{t\_2}{r \cdot \left(t\_0 \cdot 8\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3 + \frac{\left(\frac{0.125}{r \cdot \mathsf{PI}\left(\right)} + \frac{-0.041666666666666664}{t\_0}\right) + \frac{r \cdot 0.006944444444444444}{t\_1}}{s}\\
\end{array}
\end{array}
if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 0.0Initial program 100.0%
Taylor expanded in s around inf
div-subN/A
sub-negN/A
associate-/l*N/A
associate-/l/N/A
associate-*l*N/A
unpow2N/A
lower-+.f32N/A
Applied rewrites3.7%
Applied rewrites3.7%
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
associate-*r*N/A
lift-*.f32N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f32N/A
lower-/.f323.7
lift-*.f32N/A
*-commutativeN/A
lower-*.f323.7
Applied rewrites3.7%
Applied rewrites100.0%
if 0.0 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) Initial program 96.6%
Taylor expanded in s around -inf
Applied rewrites30.4%
Taylor expanded in r around 0
associate-*r/N/A
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
associate-*l*N/A
lower-*.f32N/A
lower-*.f32N/A
lower-PI.f3253.6
Applied rewrites53.6%
Final simplification93.6%
(FPCore (s r)
:precision binary32
(let* ((t_0 (* s (PI))) (t_1 (* s t_0)) (t_2 (exp (/ r (- s)))))
(if (<=
(+
(/ (* 0.25 t_2) (* r (* s (* 2.0 (PI)))))
(/ (* 0.75 (exp (- (/ r (* s 3.0))))) (* r (* s (* (PI) 6.0)))))
0.0)
(fma
(fma t_1 (/ 0.125 (PI)) (* s (* r -0.041666666666666664)))
(/ 1.0 (* s (* r t_1)))
(/ t_2 (* r (* t_0 8.0))))
(/
(+
(/ (* 0.06944444444444445 (/ r (PI))) (* s s))
(+ (/ 0.25 (* r (PI))) (/ -0.16666666666666666 t_0)))
s))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \mathsf{PI}\left(\right)\\
t_1 := s \cdot t\_0\\
t_2 := e^{\frac{r}{-s}}\\
\mathbf{if}\;\frac{0.25 \cdot t\_2}{r \cdot \left(s \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)} + \frac{0.75 \cdot e^{-\frac{r}{s \cdot 3}}}{r \cdot \left(s \cdot \left(\mathsf{PI}\left(\right) \cdot 6\right)\right)} \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(t\_1, \frac{0.125}{\mathsf{PI}\left(\right)}, s \cdot \left(r \cdot -0.041666666666666664\right)\right), \frac{1}{s \cdot \left(r \cdot t\_1\right)}, \frac{t\_2}{r \cdot \left(t\_0 \cdot 8\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.06944444444444445 \cdot \frac{r}{\mathsf{PI}\left(\right)}}{s \cdot s} + \left(\frac{0.25}{r \cdot \mathsf{PI}\left(\right)} + \frac{-0.16666666666666666}{t\_0}\right)}{s}\\
\end{array}
\end{array}
if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 0.0Initial program 100.0%
Taylor expanded in s around inf
div-subN/A
sub-negN/A
associate-/l*N/A
associate-/l/N/A
associate-*l*N/A
unpow2N/A
lower-+.f32N/A
Applied rewrites3.7%
Applied rewrites3.7%
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
associate-*r*N/A
lift-*.f32N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f32N/A
lower-/.f323.7
lift-*.f32N/A
*-commutativeN/A
lower-*.f323.7
Applied rewrites3.7%
Applied rewrites100.0%
if 0.0 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) Initial program 96.6%
lift-*.f32N/A
lift-neg.f32N/A
lift-/.f32N/A
lift-exp.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
times-fracN/A
associate-*l/N/A
lower-/.f32N/A
Applied rewrites96.9%
Taylor expanded in s around -inf
Applied rewrites47.4%
Final simplification93.0%
(FPCore (s r)
:precision binary32
(let* ((t_0 (* s (PI))) (t_1 (* s t_0)) (t_2 (exp (/ r (- s)))))
(if (<=
(+
(/ (* 0.25 t_2) (* r (* s (* 2.0 (PI)))))
(/ (* 0.75 (exp (- (/ r (* s 3.0))))) (* r (* s (* (PI) 6.0)))))
1.0000000168623835e-16)
(fma
(fma (PI) (* -0.041666666666666664 (* r s)) (* 0.125 t_1))
(/ 1.0 (* t_0 (* r t_1)))
(/ t_2 (* r (* t_0 8.0))))
(/
(+
(/ (* 0.06944444444444445 (/ r (PI))) (* s s))
(+ (/ 0.25 (* r (PI))) (/ -0.16666666666666666 t_0)))
s))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \mathsf{PI}\left(\right)\\
t_1 := s \cdot t\_0\\
t_2 := e^{\frac{r}{-s}}\\
\mathbf{if}\;\frac{0.25 \cdot t\_2}{r \cdot \left(s \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)} + \frac{0.75 \cdot e^{-\frac{r}{s \cdot 3}}}{r \cdot \left(s \cdot \left(\mathsf{PI}\left(\right) \cdot 6\right)\right)} \leq 1.0000000168623835 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{PI}\left(\right), -0.041666666666666664 \cdot \left(r \cdot s\right), 0.125 \cdot t\_1\right), \frac{1}{t\_0 \cdot \left(r \cdot t\_1\right)}, \frac{t\_2}{r \cdot \left(t\_0 \cdot 8\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.06944444444444445 \cdot \frac{r}{\mathsf{PI}\left(\right)}}{s \cdot s} + \left(\frac{0.25}{r \cdot \mathsf{PI}\left(\right)} + \frac{-0.16666666666666666}{t\_0}\right)}{s}\\
\end{array}
\end{array}
if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 1.00000002e-16Initial program 99.9%
Taylor expanded in s around inf
div-subN/A
sub-negN/A
associate-/l*N/A
associate-/l/N/A
associate-*l*N/A
unpow2N/A
lower-+.f32N/A
Applied rewrites3.7%
Applied rewrites3.7%
Applied rewrites99.2%
if 1.00000002e-16 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) Initial program 97.5%
lift-*.f32N/A
lift-neg.f32N/A
lift-/.f32N/A
lift-exp.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
times-fracN/A
associate-*l/N/A
lower-/.f32N/A
Applied rewrites97.8%
Taylor expanded in s around -inf
Applied rewrites50.5%
Final simplification94.7%
(FPCore (s r)
:precision binary32
(let* ((t_0 (* s (PI))) (t_1 (* s t_0)) (t_2 (exp (/ r (- s)))))
(if (<=
(+
(/ (* 0.25 t_2) (* r (* s (* 2.0 (PI)))))
(/ (* 0.75 (exp (- (/ r (* s 3.0))))) (* r (* s (* (PI) 6.0)))))
0.0)
(fma
(fma r (* t_0 -0.041666666666666664) (* 0.125 t_1))
(/ 1.0 (* t_0 (* r t_1)))
(/ t_2 (* (* r t_0) 8.0)))
(/
(+
(/ (* 0.06944444444444445 (/ r (PI))) (* s s))
(+ (/ 0.25 (* r (PI))) (/ -0.16666666666666666 t_0)))
s))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \mathsf{PI}\left(\right)\\
t_1 := s \cdot t\_0\\
t_2 := e^{\frac{r}{-s}}\\
\mathbf{if}\;\frac{0.25 \cdot t\_2}{r \cdot \left(s \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)} + \frac{0.75 \cdot e^{-\frac{r}{s \cdot 3}}}{r \cdot \left(s \cdot \left(\mathsf{PI}\left(\right) \cdot 6\right)\right)} \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(r, t\_0 \cdot -0.041666666666666664, 0.125 \cdot t\_1\right), \frac{1}{t\_0 \cdot \left(r \cdot t\_1\right)}, \frac{t\_2}{\left(r \cdot t\_0\right) \cdot 8}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.06944444444444445 \cdot \frac{r}{\mathsf{PI}\left(\right)}}{s \cdot s} + \left(\frac{0.25}{r \cdot \mathsf{PI}\left(\right)} + \frac{-0.16666666666666666}{t\_0}\right)}{s}\\
\end{array}
\end{array}
if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 0.0Initial program 100.0%
Taylor expanded in s around inf
div-subN/A
sub-negN/A
associate-/l*N/A
associate-/l/N/A
associate-*l*N/A
unpow2N/A
lower-+.f32N/A
Applied rewrites3.7%
Applied rewrites100.0%
if 0.0 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) Initial program 96.6%
lift-*.f32N/A
lift-neg.f32N/A
lift-/.f32N/A
lift-exp.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
times-fracN/A
associate-*l/N/A
lower-/.f32N/A
Applied rewrites96.9%
Taylor expanded in s around -inf
Applied rewrites47.4%
Final simplification94.7%
(FPCore (s r)
:precision binary32
(let* ((t_0 (* s (PI))) (t_1 (exp (/ r (- s)))) (t_2 (* r (PI))))
(if (<=
(+
(/ (* 0.25 t_1) (* r (* s (* 2.0 (PI)))))
(/ (* 0.75 (exp (- (/ r (* s 3.0))))) (* r (* s (* (PI) 6.0)))))
3.999999999279835e-23)
(fma
t_1
(/ 0.125 (* r t_0))
(fma -0.041666666666666664 (/ 1.0 (* s t_0)) (/ 0.125 (* s t_2))))
(/
(+
(/ (* 0.06944444444444445 (/ r (PI))) (* s s))
(+ (/ 0.25 t_2) (/ -0.16666666666666666 t_0)))
s))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \mathsf{PI}\left(\right)\\
t_1 := e^{\frac{r}{-s}}\\
t_2 := r \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;\frac{0.25 \cdot t\_1}{r \cdot \left(s \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)} + \frac{0.75 \cdot e^{-\frac{r}{s \cdot 3}}}{r \cdot \left(s \cdot \left(\mathsf{PI}\left(\right) \cdot 6\right)\right)} \leq 3.999999999279835 \cdot 10^{-23}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \frac{0.125}{r \cdot t\_0}, \mathsf{fma}\left(-0.041666666666666664, \frac{1}{s \cdot t\_0}, \frac{0.125}{s \cdot t\_2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.06944444444444445 \cdot \frac{r}{\mathsf{PI}\left(\right)}}{s \cdot s} + \left(\frac{0.25}{t\_2} + \frac{-0.16666666666666666}{t\_0}\right)}{s}\\
\end{array}
\end{array}
if (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) < 4e-23Initial program 99.9%
Taylor expanded in s around inf
div-subN/A
sub-negN/A
associate-/l*N/A
associate-/l/N/A
associate-*l*N/A
unpow2N/A
lower-+.f32N/A
Applied rewrites3.7%
Applied rewrites3.7%
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
lift-/.f32N/A
+-commutativeN/A
lift-/.f32N/A
div-invN/A
lower-fma.f32N/A
lower-/.f327.1
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*l*N/A
Applied rewrites7.1%
if 4e-23 < (+.f32 (/.f32 (*.f32 #s(literal 1/4 binary32) (exp.f32 (/.f32 (neg.f32 r) s))) (*.f32 (*.f32 (*.f32 #s(literal 2 binary32) (PI.f32)) s) r)) (/.f32 (*.f32 #s(literal 3/4 binary32) (exp.f32 (/.f32 (neg.f32 r) (*.f32 #s(literal 3 binary32) s)))) (*.f32 (*.f32 (*.f32 #s(literal 6 binary32) (PI.f32)) s) r))) Initial program 97.0%
lift-*.f32N/A
lift-neg.f32N/A
lift-/.f32N/A
lift-exp.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
times-fracN/A
associate-*l/N/A
lower-/.f32N/A
Applied rewrites97.3%
Taylor expanded in s around -inf
Applied rewrites48.9%
Final simplification10.8%
(FPCore (s r) :precision binary32 (+ (/ (* (/ 0.125 (* s (PI))) (exp (/ r (- s)))) r) (/ (* 0.75 (exp (/ r (* s -3.0)))) (* r (* s (* (PI) 6.0))))))
\begin{array}{l}
\\
\frac{\frac{0.125}{s \cdot \mathsf{PI}\left(\right)} \cdot e^{\frac{r}{-s}}}{r} + \frac{0.75 \cdot e^{\frac{r}{s \cdot -3}}}{r \cdot \left(s \cdot \left(\mathsf{PI}\left(\right) \cdot 6\right)\right)}
\end{array}
Initial program 99.7%
lift-neg.f32N/A
lift-/.f32N/A
lift-exp.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
times-fracN/A
associate-*r/N/A
lower-/.f32N/A
Applied rewrites99.7%
lift-*.f32N/A
distribute-frac-negN/A
distribute-frac-neg2N/A
lower-/.f32N/A
lift-*.f32N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f32N/A
metadata-eval99.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (s r) :precision binary32 (+ (/ (* 0.25 (exp (/ r (- s)))) (* r (* s (* 2.0 (PI))))) (/ (* 0.75 (exp (/ (* r -0.3333333333333333) s))) (* r (* s (* (PI) 6.0))))))
\begin{array}{l}
\\
\frac{0.25 \cdot e^{\frac{r}{-s}}}{r \cdot \left(s \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)} + \frac{0.75 \cdot e^{\frac{r \cdot -0.3333333333333333}{s}}}{r \cdot \left(s \cdot \left(\mathsf{PI}\left(\right) \cdot 6\right)\right)}
\end{array}
Initial program 99.7%
lift-neg.f32N/A
associate-/r*N/A
lower-/.f32N/A
frac-2negN/A
lift-neg.f32N/A
remove-double-negN/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f32N/A
metadata-eval99.6
Applied rewrites99.6%
Final simplification99.6%
(FPCore (s r) :precision binary32 (* (/ 0.125 (* s (PI))) (+ (/ (exp (/ r (* s -3.0))) r) (/ (exp (/ r (- s))) r))))
\begin{array}{l}
\\
\frac{0.125}{s \cdot \mathsf{PI}\left(\right)} \cdot \left(\frac{e^{\frac{r}{s \cdot -3}}}{r} + \frac{e^{\frac{r}{-s}}}{r}\right)
\end{array}
Initial program 99.7%
Applied rewrites99.6%
(FPCore (s r) :precision binary32 (/ (* 0.125 (+ (exp (/ r (- s))) (exp (* -0.3333333333333333 (/ r s))))) (* r (* s (PI)))))
\begin{array}{l}
\\
\frac{0.125 \cdot \left(e^{\frac{r}{-s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}\right)}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}
\end{array}
Initial program 99.7%
Applied rewrites96.9%
lift-*.f32N/A
lift-/.f32N/A
lift-exp.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
lift-neg.f32N/A
lift-/.f32N/A
lift-exp.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
Applied rewrites99.6%
Final simplification99.6%
(FPCore (s r) :precision binary32 (* (+ (exp (/ r (- s))) (exp (* -0.3333333333333333 (/ r s)))) (/ 0.125 (* r (* s (PI))))))
\begin{array}{l}
\\
\left(e^{\frac{r}{-s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}\right) \cdot \frac{0.125}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}
\end{array}
Initial program 99.7%
Applied rewrites96.9%
lift-*.f32N/A
lift-/.f32N/A
lift-exp.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
lift-neg.f32N/A
lift-/.f32N/A
lift-exp.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
lift-/.f32N/A
Applied rewrites96.9%
Final simplification96.9%
(FPCore (s r) :precision binary32 (+ (/ (* 0.25 (exp (/ r (- s)))) (* r (* s (* 2.0 (PI))))) (/ 0.125 (* r (* s (PI))))))
\begin{array}{l}
\\
\frac{0.25 \cdot e^{\frac{r}{-s}}}{r \cdot \left(s \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)} + \frac{0.125}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}
\end{array}
Initial program 99.7%
Taylor expanded in r around 0
lower-/.f32N/A
lower-*.f32N/A
lower-*.f32N/A
lower-PI.f328.0
Applied rewrites8.0%
Final simplification8.0%
(FPCore (s r) :precision binary32 (/ (+ (/ (* 0.06944444444444445 (/ r (PI))) (* s s)) (+ (/ 0.25 (* r (PI))) (/ -0.16666666666666666 (* s (PI))))) s))
\begin{array}{l}
\\
\frac{\frac{0.06944444444444445 \cdot \frac{r}{\mathsf{PI}\left(\right)}}{s \cdot s} + \left(\frac{0.25}{r \cdot \mathsf{PI}\left(\right)} + \frac{-0.16666666666666666}{s \cdot \mathsf{PI}\left(\right)}\right)}{s}
\end{array}
Initial program 99.7%
lift-*.f32N/A
lift-neg.f32N/A
lift-/.f32N/A
lift-exp.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
times-fracN/A
associate-*l/N/A
lower-/.f32N/A
Applied rewrites99.7%
Taylor expanded in s around -inf
Applied rewrites8.0%
(FPCore (s r) :precision binary32 (let* ((t_0 (* s (PI)))) (/ (fma -0.16666666666666666 (/ r (* s t_0)) (/ 0.25 t_0)) r)))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := s \cdot \mathsf{PI}\left(\right)\\
\frac{\mathsf{fma}\left(-0.16666666666666666, \frac{r}{s \cdot t\_0}, \frac{0.25}{t\_0}\right)}{r}
\end{array}
\end{array}
Initial program 99.7%
lift-*.f32N/A
lift-neg.f32N/A
lift-/.f32N/A
lift-exp.f32N/A
lift-PI.f32N/A
lift-*.f32N/A
lift-*.f32N/A
times-fracN/A
associate-*l/N/A
lower-/.f32N/A
Applied rewrites99.7%
Taylor expanded in r around 0
lower-/.f32N/A
lower-fma.f32N/A
lower-/.f32N/A
unpow2N/A
associate-*l*N/A
lower-*.f32N/A
lower-*.f32N/A
lower-PI.f32N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f32N/A
lower-*.f32N/A
lower-PI.f327.6
Applied rewrites7.6%
(FPCore (s r) :precision binary32 (/ 1.0 (/ (PI) (/ 0.25 (* r s)))))
\begin{array}{l}
\\
\frac{1}{\frac{\mathsf{PI}\left(\right)}{\frac{0.25}{r \cdot s}}}
\end{array}
Initial program 99.7%
Taylor expanded in r around 0
lower-/.f32N/A
lower-*.f32N/A
lower-*.f32N/A
lower-PI.f327.6
Applied rewrites7.6%
lift-PI.f32N/A
associate-*r*N/A
lift-*.f32N/A
lower-*.f327.6
Applied rewrites7.6%
lift-*.f32N/A
lift-PI.f32N/A
associate-/r*N/A
clear-numN/A
lower-/.f32N/A
lower-/.f32N/A
lower-/.f327.6
lift-*.f32N/A
*-commutativeN/A
lower-*.f327.6
Applied rewrites7.6%
Final simplification7.6%
(FPCore (s r) :precision binary32 (/ 0.25 (* r (* s (PI)))))
\begin{array}{l}
\\
\frac{0.25}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}
\end{array}
Initial program 99.7%
Taylor expanded in r around 0
lower-/.f32N/A
lower-*.f32N/A
lower-*.f32N/A
lower-PI.f327.6
Applied rewrites7.6%
herbie shell --seed 2024216
(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))))