Disney BSSRDF, PDF of scattering profile

Percentage Accurate: 99.6% → 99.6%
Time: 14.1s
Alternatives: 19
Speedup: 0.7×

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 19 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, 0.7× speedup?

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

\\
\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.6666666666666666}\right)}^{\left(\frac{r}{s \cdot 2}\right)}}{r}\right)
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. add-sqr-sqrt99.1%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{\sqrt{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}} \cdot \sqrt{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}}}{r}\right) \]
    2. sqrt-unprod97.9%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{\sqrt{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)} \cdot {\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}}}{r}\right) \]
    3. pow-prod-down97.9%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\sqrt{\color{blue}{{\left(e^{-0.3333333333333333} \cdot e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}}}{r}\right) \]
    4. prod-exp98.1%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\sqrt{{\color{blue}{\left(e^{-0.3333333333333333 + -0.3333333333333333}\right)}}^{\left(\frac{r}{s}\right)}}}{r}\right) \]
    5. metadata-eval98.1%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\sqrt{{\left(e^{\color{blue}{-0.6666666666666666}}\right)}^{\left(\frac{r}{s}\right)}}}{r}\right) \]
  5. Applied egg-rr98.1%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{\sqrt{{\left(e^{-0.6666666666666666}\right)}^{\left(\frac{r}{s}\right)}}}}{r}\right) \]
  6. Step-by-step derivation
    1. sqrt-pow199.5%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{{\left(e^{-0.6666666666666666}\right)}^{\left(\frac{\frac{r}{s}}{2}\right)}}}{r}\right) \]
    2. associate-/l/99.5%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.6666666666666666}\right)}^{\color{blue}{\left(\frac{r}{2 \cdot s}\right)}}}{r}\right) \]
  7. Applied egg-rr99.5%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{{\left(e^{-0.6666666666666666}\right)}^{\left(\frac{r}{2 \cdot s}\right)}}}{r}\right) \]
  8. Final simplification99.5%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.6666666666666666}\right)}^{\left(\frac{r}{s \cdot 2}\right)}}{r}\right) \]
  9. Add Preprocessing

Alternative 2: 99.6% accurate, 0.7× speedup?

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

\\
0.125 \cdot \frac{e^{\frac{r}{-s}} + {\left(e^{-0.6666666666666666}\right)}^{\left(\frac{\frac{r}{s}}{2}\right)}}{\left(s \cdot \pi\right) \cdot r}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in r around inf 99.3%

    \[\leadsto \color{blue}{0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)}} \]
  5. Step-by-step derivation
    1. mul-1-neg99.3%

      \[\leadsto 0.125 \cdot \frac{e^{\color{blue}{-\frac{r}{s}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    2. distribute-frac-neg299.3%

      \[\leadsto 0.125 \cdot \frac{e^{\color{blue}{\frac{r}{-s}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    3. expm1-log1p-u99.3%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(e^{\frac{r}{-s}}\right)\right)} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    4. expm1-undefine99.3%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{\left(e^{\mathsf{log1p}\left(e^{\frac{r}{-s}}\right)} - 1\right)} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  6. Applied egg-rr99.3%

    \[\leadsto 0.125 \cdot \frac{\color{blue}{\left(e^{\mathsf{log1p}\left(e^{\frac{r}{-s}}\right)} - 1\right)} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  7. Step-by-step derivation
    1. log1p-undefine99.3%

      \[\leadsto 0.125 \cdot \frac{\left(e^{\color{blue}{\log \left(1 + e^{\frac{r}{-s}}\right)}} - 1\right) + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    2. rem-exp-log99.3%

      \[\leadsto 0.125 \cdot \frac{\left(\color{blue}{\left(1 + e^{\frac{r}{-s}}\right)} - 1\right) + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    3. associate-+r-99.3%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{\left(1 + \left(e^{\frac{r}{-s}} - 1\right)\right)} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    4. expm1-undefine99.3%

      \[\leadsto 0.125 \cdot \frac{\left(1 + \color{blue}{\mathsf{expm1}\left(\frac{r}{-s}\right)}\right) + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    5. rem-exp-log99.3%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{e^{\log \left(1 + \mathsf{expm1}\left(\frac{r}{-s}\right)\right)}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    6. log1p-define99.3%

      \[\leadsto 0.125 \cdot \frac{e^{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{r}{-s}\right)\right)}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    7. log1p-expm199.3%

      \[\leadsto 0.125 \cdot \frac{e^{\color{blue}{\frac{r}{-s}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  8. Simplified99.3%

    \[\leadsto 0.125 \cdot \frac{\color{blue}{e^{\frac{r}{-s}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  9. Step-by-step derivation
    1. pow-exp99.1%

      \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + \color{blue}{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}}{r \cdot \left(s \cdot \pi\right)} \]
    2. sqr-pow99.1%

      \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + \color{blue}{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{\frac{r}{s}}{2}\right)} \cdot {\left(e^{-0.3333333333333333}\right)}^{\left(\frac{\frac{r}{s}}{2}\right)}}}{r \cdot \left(s \cdot \pi\right)} \]
    3. pow-prod-down99.0%

      \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + \color{blue}{{\left(e^{-0.3333333333333333} \cdot e^{-0.3333333333333333}\right)}^{\left(\frac{\frac{r}{s}}{2}\right)}}}{r \cdot \left(s \cdot \pi\right)} \]
    4. prod-exp99.5%

      \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + {\color{blue}{\left(e^{-0.3333333333333333 + -0.3333333333333333}\right)}}^{\left(\frac{\frac{r}{s}}{2}\right)}}{r \cdot \left(s \cdot \pi\right)} \]
    5. metadata-eval99.5%

      \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + {\left(e^{\color{blue}{-0.6666666666666666}}\right)}^{\left(\frac{\frac{r}{s}}{2}\right)}}{r \cdot \left(s \cdot \pi\right)} \]
  10. Applied egg-rr99.5%

    \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + \color{blue}{{\left(e^{-0.6666666666666666}\right)}^{\left(\frac{\frac{r}{s}}{2}\right)}}}{r \cdot \left(s \cdot \pi\right)} \]
  11. Final simplification99.5%

    \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + {\left(e^{-0.6666666666666666}\right)}^{\left(\frac{\frac{r}{s}}{2}\right)}}{\left(s \cdot \pi\right) \cdot r} \]
  12. Add Preprocessing

Alternative 3: 99.6% accurate, 1.0× speedup?

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

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

    \[\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. Step-by-step derivation
    1. times-frac99.4%

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

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

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

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

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

      \[\leadsto \frac{0.25}{s \cdot \left(2 \cdot \pi\right)} \cdot \frac{e^{-\frac{r}{s}}}{r} + 0.75 \cdot \frac{e^{\frac{-r}{s \cdot 3}}}{\color{blue}{r \cdot \left(\left(6 \cdot \pi\right) \cdot s\right)}} \]
    7. associate-*l*99.4%

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

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

    \[\leadsto \color{blue}{0.125 \cdot \frac{e^{-\frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)}} + 0.75 \cdot \frac{e^{\frac{-r}{s \cdot 3}}}{r \cdot \left(6 \cdot \left(\pi \cdot s\right)\right)} \]
  6. Step-by-step derivation
    1. associate-*r/99.4%

      \[\leadsto \color{blue}{\frac{0.125 \cdot e^{-\frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)}} + 0.75 \cdot \frac{e^{\frac{-r}{s \cdot 3}}}{r \cdot \left(6 \cdot \left(\pi \cdot s\right)\right)} \]
    2. rec-exp99.5%

      \[\leadsto \frac{0.125 \cdot \color{blue}{\frac{1}{e^{\frac{r}{s}}}}}{r \cdot \left(s \cdot \pi\right)} + 0.75 \cdot \frac{e^{\frac{-r}{s \cdot 3}}}{r \cdot \left(6 \cdot \left(\pi \cdot s\right)\right)} \]
    3. associate-*r/99.5%

      \[\leadsto \frac{\color{blue}{\frac{0.125 \cdot 1}{e^{\frac{r}{s}}}}}{r \cdot \left(s \cdot \pi\right)} + 0.75 \cdot \frac{e^{\frac{-r}{s \cdot 3}}}{r \cdot \left(6 \cdot \left(\pi \cdot s\right)\right)} \]
    4. metadata-eval99.5%

      \[\leadsto \frac{\frac{\color{blue}{0.125}}{e^{\frac{r}{s}}}}{r \cdot \left(s \cdot \pi\right)} + 0.75 \cdot \frac{e^{\frac{-r}{s \cdot 3}}}{r \cdot \left(6 \cdot \left(\pi \cdot s\right)\right)} \]
    5. *-commutative99.5%

      \[\leadsto \frac{\frac{0.125}{e^{\frac{r}{s}}}}{\color{blue}{\left(s \cdot \pi\right) \cdot r}} + 0.75 \cdot \frac{e^{\frac{-r}{s \cdot 3}}}{r \cdot \left(6 \cdot \left(\pi \cdot s\right)\right)} \]
    6. associate-*l*99.4%

      \[\leadsto \frac{\frac{0.125}{e^{\frac{r}{s}}}}{\color{blue}{s \cdot \left(\pi \cdot r\right)}} + 0.75 \cdot \frac{e^{\frac{-r}{s \cdot 3}}}{r \cdot \left(6 \cdot \left(\pi \cdot s\right)\right)} \]
    7. *-commutative99.4%

      \[\leadsto \frac{\frac{0.125}{e^{\frac{r}{s}}}}{s \cdot \color{blue}{\left(r \cdot \pi\right)}} + 0.75 \cdot \frac{e^{\frac{-r}{s \cdot 3}}}{r \cdot \left(6 \cdot \left(\pi \cdot s\right)\right)} \]
  7. Simplified99.4%

    \[\leadsto \color{blue}{\frac{\frac{0.125}{e^{\frac{r}{s}}}}{s \cdot \left(r \cdot \pi\right)}} + 0.75 \cdot \frac{e^{\frac{-r}{s \cdot 3}}}{r \cdot \left(6 \cdot \left(\pi \cdot s\right)\right)} \]
  8. Final simplification99.4%

    \[\leadsto \frac{\frac{0.125}{e^{\frac{r}{s}}}}{s \cdot \left(\pi \cdot r\right)} + 0.75 \cdot \frac{e^{\frac{r}{s \cdot \left(-3\right)}}}{r \cdot \left(\left(s \cdot \pi\right) \cdot 6\right)} \]
  9. Add Preprocessing

Alternative 4: 99.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{e}^{\left(r \cdot \frac{-0.3333333333333333}{s}\right)}}{r}\right) \end{array} \]
(FPCore (s r)
 :precision binary32
 (*
  (/ 0.125 (* s PI))
  (+ (/ (exp (/ r (- s))) r) (/ (pow E (* r (/ -0.3333333333333333 s))) r))))
float code(float s, float r) {
	return (0.125f / (s * ((float) M_PI))) * ((expf((r / -s)) / r) + (powf(((float) M_E), (r * (-0.3333333333333333f / s))) / r));
}
function code(s, r)
	return Float32(Float32(Float32(0.125) / Float32(s * Float32(pi))) * Float32(Float32(exp(Float32(r / Float32(-s))) / r) + Float32((Float32(exp(1)) ^ Float32(r * Float32(Float32(-0.3333333333333333) / s))) / r)))
end
function tmp = code(s, r)
	tmp = (single(0.125) / (s * single(pi))) * ((exp((r / -s)) / r) + ((single(2.71828182845904523536) ^ (r * (single(-0.3333333333333333) / s))) / r));
end
\begin{array}{l}

\\
\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{e}^{\left(r \cdot \frac{-0.3333333333333333}{s}\right)}}{r}\right)
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. pow-exp99.3%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{e^{-0.3333333333333333 \cdot \frac{r}{s}}}}{r}\right) \]
    2. *-commutative99.3%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\color{blue}{\frac{r}{s} \cdot -0.3333333333333333}}}{r}\right) \]
  5. Applied egg-rr99.3%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{e^{\frac{r}{s} \cdot -0.3333333333333333}}}{r}\right) \]
  6. Step-by-step derivation
    1. *-commutative99.3%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\color{blue}{-0.3333333333333333 \cdot \frac{r}{s}}}}{r}\right) \]
    2. *-un-lft-identity99.3%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\color{blue}{1 \cdot \left(-0.3333333333333333 \cdot \frac{r}{s}\right)}}}{r}\right) \]
    3. exp-prod99.4%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{{\left(e^{1}\right)}^{\left(-0.3333333333333333 \cdot \frac{r}{s}\right)}}}{r}\right) \]
    4. clear-num99.4%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{1}\right)}^{\left(-0.3333333333333333 \cdot \color{blue}{\frac{1}{\frac{s}{r}}}\right)}}{r}\right) \]
    5. un-div-inv99.4%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{1}\right)}^{\color{blue}{\left(\frac{-0.3333333333333333}{\frac{s}{r}}\right)}}}{r}\right) \]
  7. Applied egg-rr99.4%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{{\left(e^{1}\right)}^{\left(\frac{-0.3333333333333333}{\frac{s}{r}}\right)}}}{r}\right) \]
  8. Step-by-step derivation
    1. exp-1-e99.4%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\color{blue}{e}}^{\left(\frac{-0.3333333333333333}{\frac{s}{r}}\right)}}{r}\right) \]
    2. associate-/r/99.4%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{e}^{\color{blue}{\left(\frac{-0.3333333333333333}{s} \cdot r\right)}}}{r}\right) \]
  9. Simplified99.4%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{{e}^{\left(\frac{-0.3333333333333333}{s} \cdot r\right)}}}{r}\right) \]
  10. Final simplification99.4%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{e}^{\left(r \cdot \frac{-0.3333333333333333}{s}\right)}}{r}\right) \]
  11. Add Preprocessing

Alternative 5: 99.6% accurate, 1.1× speedup?

\[\begin{array}{l} \\ 0.125 \cdot \frac{\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{r}}{s \cdot \pi} \end{array} \]
(FPCore (s r)
 :precision binary32
 (*
  0.125
  (/
   (+ (/ (exp (/ r (- s))) r) (/ (exp (* (/ r s) -0.3333333333333333)) r))
   (* s PI))))
float code(float s, float r) {
	return 0.125f * (((expf((r / -s)) / r) + (expf(((r / s) * -0.3333333333333333f)) / r)) / (s * ((float) M_PI)));
}
function code(s, r)
	return Float32(Float32(0.125) * Float32(Float32(Float32(exp(Float32(r / Float32(-s))) / r) + Float32(exp(Float32(Float32(r / s) * Float32(-0.3333333333333333))) / r)) / Float32(s * Float32(pi))))
end
function tmp = code(s, r)
	tmp = single(0.125) * (((exp((r / -s)) / r) + (exp(((r / s) * single(-0.3333333333333333))) / r)) / (s * single(pi)));
end
\begin{array}{l}

\\
0.125 \cdot \frac{\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{r}}{s \cdot \pi}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in s around 0 99.4%

    \[\leadsto \color{blue}{0.125 \cdot \frac{\frac{e^{-1 \cdot \frac{r}{s}}}{r} + \frac{e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r}}{s \cdot \pi}} \]
  5. Final simplification99.4%

    \[\leadsto 0.125 \cdot \frac{\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{r}}{s \cdot \pi} \]
  6. Add Preprocessing

Alternative 6: 99.5% accurate, 1.1× speedup?

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

\\
\frac{\frac{0.125}{s}}{\pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{r}\right)
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. pow-exp99.3%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{e^{-0.3333333333333333 \cdot \frac{r}{s}}}}{r}\right) \]
    2. *-commutative99.3%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\color{blue}{\frac{r}{s} \cdot -0.3333333333333333}}}{r}\right) \]
  5. Applied egg-rr99.3%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{e^{\frac{r}{s} \cdot -0.3333333333333333}}}{r}\right) \]
  6. Step-by-step derivation
    1. add-cbrt-cube35.3%

      \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{0.125}{s \cdot \pi} \cdot \frac{0.125}{s \cdot \pi}\right) \cdot \frac{0.125}{s \cdot \pi}}} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{r}\right) \]
    2. pow1/335.0%

      \[\leadsto \color{blue}{{\left(\left(\frac{0.125}{s \cdot \pi} \cdot \frac{0.125}{s \cdot \pi}\right) \cdot \frac{0.125}{s \cdot \pi}\right)}^{0.3333333333333333}} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{r}\right) \]
    3. pow335.0%

      \[\leadsto {\color{blue}{\left({\left(\frac{0.125}{s \cdot \pi}\right)}^{3}\right)}}^{0.3333333333333333} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{r}\right) \]
  7. Applied egg-rr35.0%

    \[\leadsto \color{blue}{{\left({\left(\frac{0.125}{s \cdot \pi}\right)}^{3}\right)}^{0.3333333333333333}} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{r}\right) \]
  8. Step-by-step derivation
    1. unpow1/335.3%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{0.125}{s \cdot \pi}\right)}^{3}}} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{r}\right) \]
    2. rem-cbrt-cube99.3%

      \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi}} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{r}\right) \]
    3. associate-/r*99.4%

      \[\leadsto \color{blue}{\frac{\frac{0.125}{s}}{\pi}} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{r}\right) \]
  9. Applied egg-rr99.4%

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

Alternative 7: 99.5% accurate, 1.1× speedup?

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

\\
\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{r \cdot -0.3333333333333333}{s}}}{r}\right)
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. pow-exp99.3%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{e^{-0.3333333333333333 \cdot \frac{r}{s}}}}{r}\right) \]
    2. *-commutative99.3%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\color{blue}{\frac{r}{s} \cdot -0.3333333333333333}}}{r}\right) \]
  5. Applied egg-rr99.3%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{e^{\frac{r}{s} \cdot -0.3333333333333333}}}{r}\right) \]
  6. Step-by-step derivation
    1. associate-*l/99.4%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\color{blue}{\frac{r \cdot -0.3333333333333333}{s}}}}{r}\right) \]
  7. Applied egg-rr99.4%

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

Alternative 8: 99.6% accurate, 1.1× speedup?

\[\begin{array}{l} \\ 0.125 \cdot \frac{e^{\frac{r}{s} \cdot -0.3333333333333333} + \frac{1}{e^{\frac{r}{s}}}}{\left(s \cdot \pi\right) \cdot r} \end{array} \]
(FPCore (s r)
 :precision binary32
 (*
  0.125
  (/
   (+ (exp (* (/ r s) -0.3333333333333333)) (/ 1.0 (exp (/ r s))))
   (* (* s PI) r))))
float code(float s, float r) {
	return 0.125f * ((expf(((r / s) * -0.3333333333333333f)) + (1.0f / expf((r / s)))) / ((s * ((float) M_PI)) * r));
}
function code(s, r)
	return Float32(Float32(0.125) * Float32(Float32(exp(Float32(Float32(r / s) * Float32(-0.3333333333333333))) + Float32(Float32(1.0) / exp(Float32(r / s)))) / Float32(Float32(s * Float32(pi)) * r)))
end
function tmp = code(s, r)
	tmp = single(0.125) * ((exp(((r / s) * single(-0.3333333333333333))) + (single(1.0) / exp((r / s)))) / ((s * single(pi)) * r));
end
\begin{array}{l}

\\
0.125 \cdot \frac{e^{\frac{r}{s} \cdot -0.3333333333333333} + \frac{1}{e^{\frac{r}{s}}}}{\left(s \cdot \pi\right) \cdot r}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in r around inf 99.3%

    \[\leadsto \color{blue}{0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)}} \]
  5. Step-by-step derivation
    1. mul-1-neg99.3%

      \[\leadsto 0.125 \cdot \frac{e^{\color{blue}{-\frac{r}{s}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    2. exp-neg99.3%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{\frac{1}{e^{\frac{r}{s}}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  6. Applied egg-rr99.3%

    \[\leadsto 0.125 \cdot \frac{\color{blue}{\frac{1}{e^{\frac{r}{s}}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  7. Final simplification99.3%

    \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{s} \cdot -0.3333333333333333} + \frac{1}{e^{\frac{r}{s}}}}{\left(s \cdot \pi\right) \cdot r} \]
  8. Add Preprocessing

Alternative 9: 99.6% accurate, 1.1× speedup?

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

\\
0.125 \cdot \frac{e^{\frac{r}{-s}} + e^{r \cdot \frac{-0.3333333333333333}{s}}}{\left(s \cdot \pi\right) \cdot r}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in r around inf 99.3%

    \[\leadsto \color{blue}{0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)}} \]
  5. Step-by-step derivation
    1. pow-exp99.1%

      \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + \color{blue}{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}}{r \cdot \left(s \cdot \pi\right)} \]
    2. sqr-pow99.1%

      \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + \color{blue}{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{\frac{r}{s}}{2}\right)} \cdot {\left(e^{-0.3333333333333333}\right)}^{\left(\frac{\frac{r}{s}}{2}\right)}}}{r \cdot \left(s \cdot \pi\right)} \]
    3. pow-prod-down99.0%

      \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + \color{blue}{{\left(e^{-0.3333333333333333} \cdot e^{-0.3333333333333333}\right)}^{\left(\frac{\frac{r}{s}}{2}\right)}}}{r \cdot \left(s \cdot \pi\right)} \]
    4. prod-exp99.5%

      \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + {\color{blue}{\left(e^{-0.3333333333333333 + -0.3333333333333333}\right)}}^{\left(\frac{\frac{r}{s}}{2}\right)}}{r \cdot \left(s \cdot \pi\right)} \]
    5. metadata-eval99.5%

      \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + {\left(e^{\color{blue}{-0.6666666666666666}}\right)}^{\left(\frac{\frac{r}{s}}{2}\right)}}{r \cdot \left(s \cdot \pi\right)} \]
  6. Applied egg-rr99.5%

    \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + \color{blue}{{\left(e^{-0.6666666666666666}\right)}^{\left(\frac{\frac{r}{s}}{2}\right)}}}{r \cdot \left(s \cdot \pi\right)} \]
  7. Step-by-step derivation
    1. sqrt-pow198.1%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + \color{blue}{\sqrt{{\left(e^{-0.6666666666666666}\right)}^{\left(\frac{r}{s}\right)}}}}{r \cdot \left(s \cdot \pi\right)} \]
    2. pow1/298.1%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + \color{blue}{{\left({\left(e^{-0.6666666666666666}\right)}^{\left(\frac{r}{s}\right)}\right)}^{0.5}}}{r \cdot \left(s \cdot \pi\right)} \]
    3. pow-to-exp98.1%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + \color{blue}{e^{\log \left({\left(e^{-0.6666666666666666}\right)}^{\left(\frac{r}{s}\right)}\right) \cdot 0.5}}}{r \cdot \left(s \cdot \pi\right)} \]
    4. pow-to-exp98.0%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{\log \color{blue}{\left(e^{\log \left(e^{-0.6666666666666666}\right) \cdot \frac{r}{s}}\right)} \cdot 0.5}}{r \cdot \left(s \cdot \pi\right)} \]
    5. rem-log-exp99.2%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{\color{blue}{\left(\log \left(e^{-0.6666666666666666}\right) \cdot \frac{r}{s}\right)} \cdot 0.5}}{r \cdot \left(s \cdot \pi\right)} \]
    6. clear-num99.3%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{\left(\log \left(e^{-0.6666666666666666}\right) \cdot \color{blue}{\frac{1}{\frac{s}{r}}}\right) \cdot 0.5}}{r \cdot \left(s \cdot \pi\right)} \]
    7. un-div-inv99.4%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{\color{blue}{\frac{\log \left(e^{-0.6666666666666666}\right)}{\frac{s}{r}}} \cdot 0.5}}{r \cdot \left(s \cdot \pi\right)} \]
    8. rem-log-exp99.3%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{\frac{\color{blue}{-0.6666666666666666}}{\frac{s}{r}} \cdot 0.5}}{r \cdot \left(s \cdot \pi\right)} \]
  8. Applied egg-rr99.3%

    \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + \color{blue}{e^{\frac{-0.6666666666666666}{\frac{s}{r}} \cdot 0.5}}}{r \cdot \left(s \cdot \pi\right)} \]
  9. Step-by-step derivation
    1. associate-*l/99.3%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{\color{blue}{\frac{-0.6666666666666666 \cdot 0.5}{\frac{s}{r}}}}}{r \cdot \left(s \cdot \pi\right)} \]
    2. metadata-eval99.3%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{\frac{\color{blue}{-0.3333333333333333}}{\frac{s}{r}}}}{r \cdot \left(s \cdot \pi\right)} \]
    3. associate-/r/99.3%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{\color{blue}{\frac{-0.3333333333333333}{s} \cdot r}}}{r \cdot \left(s \cdot \pi\right)} \]
  10. Simplified99.3%

    \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + \color{blue}{e^{\frac{-0.3333333333333333}{s} \cdot r}}}{r \cdot \left(s \cdot \pi\right)} \]
  11. Final simplification99.3%

    \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + e^{r \cdot \frac{-0.3333333333333333}{s}}}{\left(s \cdot \pi\right) \cdot r} \]
  12. Add Preprocessing

Alternative 10: 99.6% accurate, 1.1× speedup?

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

\\
0.125 \cdot \frac{e^{\frac{r}{-s}} + e^{\frac{r}{s} \cdot -0.3333333333333333}}{s \cdot \left(\pi \cdot r\right)}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in r around inf 99.3%

    \[\leadsto \color{blue}{0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)}} \]
  5. Step-by-step derivation
    1. add-cube-cbrt99.3%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{\color{blue}{\left(\sqrt[3]{r \cdot \left(s \cdot \pi\right)} \cdot \sqrt[3]{r \cdot \left(s \cdot \pi\right)}\right) \cdot \sqrt[3]{r \cdot \left(s \cdot \pi\right)}}} \]
    2. pow399.3%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{\color{blue}{{\left(\sqrt[3]{r \cdot \left(s \cdot \pi\right)}\right)}^{3}}} \]
  6. Applied egg-rr99.3%

    \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{\color{blue}{{\left(\sqrt[3]{r \cdot \left(s \cdot \pi\right)}\right)}^{3}}} \]
  7. Taylor expanded in r around 0 99.3%

    \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{\color{blue}{r \cdot \left(s \cdot \pi\right)}} \]
  8. Step-by-step derivation
    1. *-commutative99.3%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{\color{blue}{\left(s \cdot \pi\right) \cdot r}} \]
    2. associate-*l*99.3%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{\color{blue}{s \cdot \left(\pi \cdot r\right)}} \]
    3. *-commutative99.3%

      \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{s \cdot \color{blue}{\left(r \cdot \pi\right)}} \]
  9. Simplified99.3%

    \[\leadsto 0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{\color{blue}{s \cdot \left(r \cdot \pi\right)}} \]
  10. Final simplification99.3%

    \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + e^{\frac{r}{s} \cdot -0.3333333333333333}}{s \cdot \left(\pi \cdot r\right)} \]
  11. Add Preprocessing

Alternative 11: 99.6% accurate, 1.1× speedup?

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

\\
0.125 \cdot \frac{e^{\frac{r}{-s}} + e^{\frac{r \cdot -0.3333333333333333}{s}}}{\left(s \cdot \pi\right) \cdot r}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in r around inf 99.3%

    \[\leadsto \color{blue}{0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)}} \]
  5. Step-by-step derivation
    1. mul-1-neg99.3%

      \[\leadsto 0.125 \cdot \frac{e^{\color{blue}{-\frac{r}{s}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    2. distribute-frac-neg299.3%

      \[\leadsto 0.125 \cdot \frac{e^{\color{blue}{\frac{r}{-s}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    3. expm1-log1p-u99.3%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(e^{\frac{r}{-s}}\right)\right)} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    4. expm1-undefine99.3%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{\left(e^{\mathsf{log1p}\left(e^{\frac{r}{-s}}\right)} - 1\right)} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  6. Applied egg-rr99.3%

    \[\leadsto 0.125 \cdot \frac{\color{blue}{\left(e^{\mathsf{log1p}\left(e^{\frac{r}{-s}}\right)} - 1\right)} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  7. Step-by-step derivation
    1. log1p-undefine99.3%

      \[\leadsto 0.125 \cdot \frac{\left(e^{\color{blue}{\log \left(1 + e^{\frac{r}{-s}}\right)}} - 1\right) + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    2. rem-exp-log99.3%

      \[\leadsto 0.125 \cdot \frac{\left(\color{blue}{\left(1 + e^{\frac{r}{-s}}\right)} - 1\right) + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    3. associate-+r-99.3%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{\left(1 + \left(e^{\frac{r}{-s}} - 1\right)\right)} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    4. expm1-undefine99.3%

      \[\leadsto 0.125 \cdot \frac{\left(1 + \color{blue}{\mathsf{expm1}\left(\frac{r}{-s}\right)}\right) + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    5. rem-exp-log99.3%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{e^{\log \left(1 + \mathsf{expm1}\left(\frac{r}{-s}\right)\right)}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    6. log1p-define99.3%

      \[\leadsto 0.125 \cdot \frac{e^{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{r}{-s}\right)\right)}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    7. log1p-expm199.3%

      \[\leadsto 0.125 \cdot \frac{e^{\color{blue}{\frac{r}{-s}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  8. Simplified99.3%

    \[\leadsto 0.125 \cdot \frac{\color{blue}{e^{\frac{r}{-s}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  9. Step-by-step derivation
    1. associate-*r/99.3%

      \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + e^{\color{blue}{\frac{-0.3333333333333333 \cdot r}{s}}}}{r \cdot \left(s \cdot \pi\right)} \]
  10. Applied egg-rr99.3%

    \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + e^{\color{blue}{\frac{-0.3333333333333333 \cdot r}{s}}}}{r \cdot \left(s \cdot \pi\right)} \]
  11. Final simplification99.3%

    \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + e^{\frac{r \cdot -0.3333333333333333}{s}}}{\left(s \cdot \pi\right) \cdot r} \]
  12. Add Preprocessing

Alternative 12: 99.6% accurate, 1.1× speedup?

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

\\
0.125 \cdot \frac{e^{\frac{r}{-s}} + e^{\frac{r}{s} \cdot -0.3333333333333333}}{\left(s \cdot \pi\right) \cdot r}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in r around inf 99.3%

    \[\leadsto \color{blue}{0.125 \cdot \frac{e^{-1 \cdot \frac{r}{s}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)}} \]
  5. Step-by-step derivation
    1. mul-1-neg99.3%

      \[\leadsto 0.125 \cdot \frac{e^{\color{blue}{-\frac{r}{s}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    2. distribute-frac-neg299.3%

      \[\leadsto 0.125 \cdot \frac{e^{\color{blue}{\frac{r}{-s}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    3. expm1-log1p-u99.3%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(e^{\frac{r}{-s}}\right)\right)} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    4. expm1-undefine99.3%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{\left(e^{\mathsf{log1p}\left(e^{\frac{r}{-s}}\right)} - 1\right)} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  6. Applied egg-rr99.3%

    \[\leadsto 0.125 \cdot \frac{\color{blue}{\left(e^{\mathsf{log1p}\left(e^{\frac{r}{-s}}\right)} - 1\right)} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  7. Step-by-step derivation
    1. log1p-undefine99.3%

      \[\leadsto 0.125 \cdot \frac{\left(e^{\color{blue}{\log \left(1 + e^{\frac{r}{-s}}\right)}} - 1\right) + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    2. rem-exp-log99.3%

      \[\leadsto 0.125 \cdot \frac{\left(\color{blue}{\left(1 + e^{\frac{r}{-s}}\right)} - 1\right) + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    3. associate-+r-99.3%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{\left(1 + \left(e^{\frac{r}{-s}} - 1\right)\right)} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    4. expm1-undefine99.3%

      \[\leadsto 0.125 \cdot \frac{\left(1 + \color{blue}{\mathsf{expm1}\left(\frac{r}{-s}\right)}\right) + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    5. rem-exp-log99.3%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{e^{\log \left(1 + \mathsf{expm1}\left(\frac{r}{-s}\right)\right)}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    6. log1p-define99.3%

      \[\leadsto 0.125 \cdot \frac{e^{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{r}{-s}\right)\right)}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
    7. log1p-expm199.3%

      \[\leadsto 0.125 \cdot \frac{e^{\color{blue}{\frac{r}{-s}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  8. Simplified99.3%

    \[\leadsto 0.125 \cdot \frac{\color{blue}{e^{\frac{r}{-s}}} + e^{-0.3333333333333333 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \pi\right)} \]
  9. Final simplification99.3%

    \[\leadsto 0.125 \cdot \frac{e^{\frac{r}{-s}} + e^{\frac{r}{s} \cdot -0.3333333333333333}}{\left(s \cdot \pi\right) \cdot r} \]
  10. Add Preprocessing

Alternative 13: 44.2% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \frac{0.25}{s \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\pi \cdot r\right)\right)} \end{array} \]
(FPCore (s r) :precision binary32 (/ 0.25 (* s (log1p (expm1 (* PI r))))))
float code(float s, float r) {
	return 0.25f / (s * log1pf(expm1f((((float) M_PI) * r))));
}
function code(s, r)
	return Float32(Float32(0.25) / Float32(s * log1p(expm1(Float32(Float32(pi) * r)))))
end
\begin{array}{l}

\\
\frac{0.25}{s \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\pi \cdot r\right)\right)}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in s around inf 8.1%

    \[\leadsto \color{blue}{\frac{0.25}{r \cdot \left(s \cdot \pi\right)}} \]
  5. Step-by-step derivation
    1. *-commutative8.1%

      \[\leadsto \frac{0.25}{\color{blue}{\left(s \cdot \pi\right) \cdot r}} \]
    2. associate-*l*8.1%

      \[\leadsto \frac{0.25}{\color{blue}{s \cdot \left(\pi \cdot r\right)}} \]
    3. *-commutative8.1%

      \[\leadsto \frac{0.25}{s \cdot \color{blue}{\left(r \cdot \pi\right)}} \]
  6. Simplified8.1%

    \[\leadsto \color{blue}{\frac{0.25}{s \cdot \left(r \cdot \pi\right)}} \]
  7. Step-by-step derivation
    1. log1p-expm1-u41.3%

      \[\leadsto \frac{0.25}{s \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(r \cdot \pi\right)\right)}} \]
  8. Applied egg-rr41.3%

    \[\leadsto \frac{0.25}{s \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(r \cdot \pi\right)\right)}} \]
  9. Final simplification41.3%

    \[\leadsto \frac{0.25}{s \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\pi \cdot r\right)\right)} \]
  10. Add Preprocessing

Alternative 14: 11.5% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \frac{0.25}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(s \cdot \pi\right) \cdot r\right)\right)} \end{array} \]
(FPCore (s r) :precision binary32 (/ 0.25 (log1p (expm1 (* (* s PI) r)))))
float code(float s, float r) {
	return 0.25f / log1pf(expm1f(((s * ((float) M_PI)) * r)));
}
function code(s, r)
	return Float32(Float32(0.25) / log1p(expm1(Float32(Float32(s * Float32(pi)) * r))))
end
\begin{array}{l}

\\
\frac{0.25}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(s \cdot \pi\right) \cdot r\right)\right)}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in s around inf 8.1%

    \[\leadsto \color{blue}{\frac{0.25}{r \cdot \left(s \cdot \pi\right)}} \]
  5. Step-by-step derivation
    1. log1p-expm1-u9.7%

      \[\leadsto \frac{0.25}{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(r \cdot \left(s \cdot \pi\right)\right)\right)}} \]
  6. Applied egg-rr9.7%

    \[\leadsto \frac{0.25}{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(r \cdot \left(s \cdot \pi\right)\right)\right)}} \]
  7. Final simplification9.7%

    \[\leadsto \frac{0.25}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(s \cdot \pi\right) \cdot r\right)\right)} \]
  8. Add Preprocessing

Alternative 15: 10.1% accurate, 11.0× speedup?

\[\begin{array}{l} \\ \frac{\frac{0.0625 \cdot \frac{r}{s \cdot \pi} - \frac{0.16666666666666666}{\pi}}{s} + \frac{0.25}{\pi \cdot r}}{s} \end{array} \]
(FPCore (s r)
 :precision binary32
 (/
  (+
   (/ (- (* 0.0625 (/ r (* s PI))) (/ 0.16666666666666666 PI)) s)
   (/ 0.25 (* PI r)))
  s))
float code(float s, float r) {
	return ((((0.0625f * (r / (s * ((float) M_PI)))) - (0.16666666666666666f / ((float) M_PI))) / s) + (0.25f / (((float) M_PI) * r))) / s;
}
function code(s, r)
	return Float32(Float32(Float32(Float32(Float32(Float32(0.0625) * Float32(r / Float32(s * Float32(pi)))) - Float32(Float32(0.16666666666666666) / Float32(pi))) / s) + Float32(Float32(0.25) / Float32(Float32(pi) * r))) / s)
end
function tmp = code(s, r)
	tmp = ((((single(0.0625) * (r / (s * single(pi)))) - (single(0.16666666666666666) / single(pi))) / s) + (single(0.25) / (single(pi) * r))) / s;
end
\begin{array}{l}

\\
\frac{\frac{0.0625 \cdot \frac{r}{s \cdot \pi} - \frac{0.16666666666666666}{\pi}}{s} + \frac{0.25}{\pi \cdot r}}{s}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in r around 0 8.6%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{1 + -0.3333333333333333 \cdot \frac{r}{s}}}{r}\right) \]
  5. Taylor expanded in s around 0 8.6%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \color{blue}{\frac{\frac{s}{r} - 0.3333333333333333}{s}}\right) \]
  6. Taylor expanded in s around -inf 8.8%

    \[\leadsto \color{blue}{-1 \cdot \frac{-1 \cdot \frac{0.0625 \cdot \frac{r}{s \cdot \pi} - 0.16666666666666666 \cdot \frac{1}{\pi}}{s} - 0.25 \cdot \frac{1}{r \cdot \pi}}{s}} \]
  7. Step-by-step derivation
    1. mul-1-neg8.8%

      \[\leadsto \color{blue}{-\frac{-1 \cdot \frac{0.0625 \cdot \frac{r}{s \cdot \pi} - 0.16666666666666666 \cdot \frac{1}{\pi}}{s} - 0.25 \cdot \frac{1}{r \cdot \pi}}{s}} \]
    2. mul-1-neg8.8%

      \[\leadsto -\frac{\color{blue}{\left(-\frac{0.0625 \cdot \frac{r}{s \cdot \pi} - 0.16666666666666666 \cdot \frac{1}{\pi}}{s}\right)} - 0.25 \cdot \frac{1}{r \cdot \pi}}{s} \]
    3. associate-*r/8.8%

      \[\leadsto -\frac{\left(-\frac{0.0625 \cdot \frac{r}{s \cdot \pi} - \color{blue}{\frac{0.16666666666666666 \cdot 1}{\pi}}}{s}\right) - 0.25 \cdot \frac{1}{r \cdot \pi}}{s} \]
    4. metadata-eval8.8%

      \[\leadsto -\frac{\left(-\frac{0.0625 \cdot \frac{r}{s \cdot \pi} - \frac{\color{blue}{0.16666666666666666}}{\pi}}{s}\right) - 0.25 \cdot \frac{1}{r \cdot \pi}}{s} \]
    5. associate-*r/8.8%

      \[\leadsto -\frac{\left(-\frac{0.0625 \cdot \frac{r}{s \cdot \pi} - \frac{0.16666666666666666}{\pi}}{s}\right) - \color{blue}{\frac{0.25 \cdot 1}{r \cdot \pi}}}{s} \]
    6. metadata-eval8.8%

      \[\leadsto -\frac{\left(-\frac{0.0625 \cdot \frac{r}{s \cdot \pi} - \frac{0.16666666666666666}{\pi}}{s}\right) - \frac{\color{blue}{0.25}}{r \cdot \pi}}{s} \]
  8. Simplified8.8%

    \[\leadsto \color{blue}{-\frac{\left(-\frac{0.0625 \cdot \frac{r}{s \cdot \pi} - \frac{0.16666666666666666}{\pi}}{s}\right) - \frac{0.25}{r \cdot \pi}}{s}} \]
  9. Final simplification8.8%

    \[\leadsto \frac{\frac{0.0625 \cdot \frac{r}{s \cdot \pi} - \frac{0.16666666666666666}{\pi}}{s} + \frac{0.25}{\pi \cdot r}}{s} \]
  10. Add Preprocessing

Alternative 16: 10.1% accurate, 12.2× speedup?

\[\begin{array}{l} \\ \frac{0.25 \cdot \frac{1}{r} - \frac{0.16666666666666666 + \frac{r}{s} \cdot -0.0625}{s}}{s \cdot \pi} \end{array} \]
(FPCore (s r)
 :precision binary32
 (/
  (- (* 0.25 (/ 1.0 r)) (/ (+ 0.16666666666666666 (* (/ r s) -0.0625)) s))
  (* s PI)))
float code(float s, float r) {
	return ((0.25f * (1.0f / r)) - ((0.16666666666666666f + ((r / s) * -0.0625f)) / s)) / (s * ((float) M_PI));
}
function code(s, r)
	return Float32(Float32(Float32(Float32(0.25) * Float32(Float32(1.0) / r)) - Float32(Float32(Float32(0.16666666666666666) + Float32(Float32(r / s) * Float32(-0.0625))) / s)) / Float32(s * Float32(pi)))
end
function tmp = code(s, r)
	tmp = ((single(0.25) * (single(1.0) / r)) - ((single(0.16666666666666666) + ((r / s) * single(-0.0625))) / s)) / (s * single(pi));
end
\begin{array}{l}

\\
\frac{0.25 \cdot \frac{1}{r} - \frac{0.16666666666666666 + \frac{r}{s} \cdot -0.0625}{s}}{s \cdot \pi}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in r around 0 8.6%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{1 + -0.3333333333333333 \cdot \frac{r}{s}}}{r}\right) \]
  5. Taylor expanded in s around 0 8.6%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \color{blue}{\frac{\frac{s}{r} - 0.3333333333333333}{s}}\right) \]
  6. Step-by-step derivation
    1. associate-*l/8.6%

      \[\leadsto \color{blue}{\frac{0.125 \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\frac{s}{r} - 0.3333333333333333}{s}\right)}{s \cdot \pi}} \]
    2. sub-neg8.6%

      \[\leadsto \frac{0.125 \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{\frac{s}{r} + \left(-0.3333333333333333\right)}}{s}\right)}{s \cdot \pi} \]
    3. metadata-eval8.6%

      \[\leadsto \frac{0.125 \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\frac{s}{r} + \color{blue}{-0.3333333333333333}}{s}\right)}{s \cdot \pi} \]
  7. Applied egg-rr8.6%

    \[\leadsto \color{blue}{\frac{0.125 \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\frac{s}{r} + -0.3333333333333333}{s}\right)}{s \cdot \pi}} \]
  8. Taylor expanded in s around -inf 8.8%

    \[\leadsto \frac{\color{blue}{-1 \cdot \frac{0.16666666666666666 + -0.0625 \cdot \frac{r}{s}}{s} + 0.25 \cdot \frac{1}{r}}}{s \cdot \pi} \]
  9. Final simplification8.8%

    \[\leadsto \frac{0.25 \cdot \frac{1}{r} - \frac{0.16666666666666666 + \frac{r}{s} \cdot -0.0625}{s}}{s \cdot \pi} \]
  10. Add Preprocessing

Alternative 17: 9.1% accurate, 33.0× speedup?

\[\begin{array}{l} \\ \frac{0.25}{\pi \cdot \left(s \cdot r\right)} \end{array} \]
(FPCore (s r) :precision binary32 (/ 0.25 (* PI (* s r))))
float code(float s, float r) {
	return 0.25f / (((float) M_PI) * (s * r));
}
function code(s, r)
	return Float32(Float32(0.25) / Float32(Float32(pi) * Float32(s * r)))
end
function tmp = code(s, r)
	tmp = single(0.25) / (single(pi) * (s * r));
end
\begin{array}{l}

\\
\frac{0.25}{\pi \cdot \left(s \cdot r\right)}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. add-sqr-sqrt99.1%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{\sqrt{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}} \cdot \sqrt{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}}}{r}\right) \]
    2. sqrt-unprod97.9%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{\sqrt{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)} \cdot {\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}}}{r}\right) \]
    3. pow-prod-down97.9%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\sqrt{\color{blue}{{\left(e^{-0.3333333333333333} \cdot e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}}}{r}\right) \]
    4. prod-exp98.1%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\sqrt{{\color{blue}{\left(e^{-0.3333333333333333 + -0.3333333333333333}\right)}}^{\left(\frac{r}{s}\right)}}}{r}\right) \]
    5. metadata-eval98.1%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\sqrt{{\left(e^{\color{blue}{-0.6666666666666666}}\right)}^{\left(\frac{r}{s}\right)}}}{r}\right) \]
  5. Applied egg-rr98.1%

    \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{\color{blue}{\sqrt{{\left(e^{-0.6666666666666666}\right)}^{\left(\frac{r}{s}\right)}}}}{r}\right) \]
  6. Taylor expanded in s around inf 8.1%

    \[\leadsto \color{blue}{\frac{0.25}{r \cdot \left(s \cdot \pi\right)}} \]
  7. Step-by-step derivation
    1. associate-/r*8.1%

      \[\leadsto \color{blue}{\frac{\frac{0.25}{r}}{s \cdot \pi}} \]
  8. Simplified8.1%

    \[\leadsto \color{blue}{\frac{\frac{0.25}{r}}{s \cdot \pi}} \]
  9. Step-by-step derivation
    1. *-un-lft-identity8.1%

      \[\leadsto \color{blue}{1 \cdot \frac{\frac{0.25}{r}}{s \cdot \pi}} \]
    2. associate-/l/8.1%

      \[\leadsto 1 \cdot \color{blue}{\frac{0.25}{\left(s \cdot \pi\right) \cdot r}} \]
    3. *-commutative8.1%

      \[\leadsto 1 \cdot \frac{0.25}{\color{blue}{r \cdot \left(s \cdot \pi\right)}} \]
    4. associate-*r*8.1%

      \[\leadsto 1 \cdot \frac{0.25}{\color{blue}{\left(r \cdot s\right) \cdot \pi}} \]
  10. Applied egg-rr8.1%

    \[\leadsto \color{blue}{1 \cdot \frac{0.25}{\left(r \cdot s\right) \cdot \pi}} \]
  11. Final simplification8.1%

    \[\leadsto \frac{0.25}{\pi \cdot \left(s \cdot r\right)} \]
  12. Add Preprocessing

Alternative 18: 9.1% accurate, 33.0× speedup?

\[\begin{array}{l} \\ \frac{0.25}{s \cdot \left(\pi \cdot r\right)} \end{array} \]
(FPCore (s r) :precision binary32 (/ 0.25 (* s (* PI r))))
float code(float s, float r) {
	return 0.25f / (s * (((float) M_PI) * r));
}
function code(s, r)
	return Float32(Float32(0.25) / Float32(s * Float32(Float32(pi) * r)))
end
function tmp = code(s, r)
	tmp = single(0.25) / (s * (single(pi) * r));
end
\begin{array}{l}

\\
\frac{0.25}{s \cdot \left(\pi \cdot r\right)}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in s around inf 8.1%

    \[\leadsto \color{blue}{\frac{0.25}{r \cdot \left(s \cdot \pi\right)}} \]
  5. Step-by-step derivation
    1. *-commutative8.1%

      \[\leadsto \frac{0.25}{\color{blue}{\left(s \cdot \pi\right) \cdot r}} \]
    2. associate-*l*8.1%

      \[\leadsto \frac{0.25}{\color{blue}{s \cdot \left(\pi \cdot r\right)}} \]
    3. *-commutative8.1%

      \[\leadsto \frac{0.25}{s \cdot \color{blue}{\left(r \cdot \pi\right)}} \]
  6. Simplified8.1%

    \[\leadsto \color{blue}{\frac{0.25}{s \cdot \left(r \cdot \pi\right)}} \]
  7. Final simplification8.1%

    \[\leadsto \frac{0.25}{s \cdot \left(\pi \cdot r\right)} \]
  8. Add Preprocessing

Alternative 19: 9.1% accurate, 33.0× speedup?

\[\begin{array}{l} \\ \frac{0.25}{\left(s \cdot \pi\right) \cdot r} \end{array} \]
(FPCore (s r) :precision binary32 (/ 0.25 (* (* s PI) r)))
float code(float s, float r) {
	return 0.25f / ((s * ((float) M_PI)) * r);
}
function code(s, r)
	return Float32(Float32(0.25) / Float32(Float32(s * Float32(pi)) * r))
end
function tmp = code(s, r)
	tmp = single(0.25) / ((s * single(pi)) * r);
end
\begin{array}{l}

\\
\frac{0.25}{\left(s \cdot \pi\right) \cdot r}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\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. Simplified99.1%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{{\left(e^{-0.3333333333333333}\right)}^{\left(\frac{r}{s}\right)}}{r}\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in s around inf 8.1%

    \[\leadsto \color{blue}{\frac{0.25}{r \cdot \left(s \cdot \pi\right)}} \]
  5. Final simplification8.1%

    \[\leadsto \frac{0.25}{\left(s \cdot \pi\right) \cdot r} \]
  6. Add Preprocessing

Reproduce

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