Disney BSSRDF, PDF of scattering profile

Percentage Accurate: 99.6% → 99.6%
Time: 17.0s
Alternatives: 25
Speedup: 1.1×

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 25 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, 1.0× speedup?

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

\\
\frac{\frac{0.125}{e^{\frac{r}{s}}}}{r \cdot \left(s \cdot \pi\right)} + \frac{0.75 \cdot e^{\frac{r}{3 \cdot \left(-s\right)}}}{r \cdot \left(s \cdot \left(\pi \cdot 6\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. Add Preprocessing
  3. Taylor expanded in r around inf

    \[\leadsto \mathsf{+.f32}\left(\color{blue}{\left(\frac{1}{8} \cdot \frac{e^{-1 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}\right)}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
  4. Step-by-step derivation
    1. associate-*r/N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot e^{-1 \cdot \frac{r}{s}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\color{blue}{\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right)}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    3. neg-mul-1N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot e^{\mathsf{neg}\left(\frac{r}{s}\right)}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    4. exp-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot \frac{1}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{\frac{1}{8} \cdot 1}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\color{blue}{\frac{3}{4}}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{\frac{1}{8}}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    7. /-lowering-/.f32N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\left(\frac{r}{s}\right)\right)\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    9. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \color{blue}{\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)}\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    12. PI-lowering-PI.f3299.4%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
  5. Simplified99.4%

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

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

Alternative 2: 99.6% accurate, 1.1× speedup?

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

\\
\frac{\frac{\frac{e^{\frac{r}{-s}} + e^{\frac{\frac{r}{s}}{-3}}}{\frac{r}{0.125}}}{s}}{\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.2%

    \[\leadsto \color{blue}{\frac{\frac{0.125}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s \cdot \pi}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-/r*N/A

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

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{\frac{1}{8}}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s}\right), \color{blue}{\mathsf{PI}\left(\right)}\right) \]
  5. Applied egg-rr99.3%

    \[\leadsto \color{blue}{\frac{\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{\frac{r}{0.125}}}{s}}{\pi}} \]
  6. Final simplification99.3%

    \[\leadsto \frac{\frac{\frac{e^{\frac{r}{-s}} + e^{\frac{\frac{r}{s}}{-3}}}{\frac{r}{0.125}}}{s}}{\pi} \]
  7. Add Preprocessing

Alternative 3: 99.5% accurate, 1.1× speedup?

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

\\
\frac{\frac{e^{\frac{r}{-s}} + e^{\frac{\frac{r}{s}}{-3}}}{r} \cdot \frac{0.125}{s}}{\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.2%

    \[\leadsto \color{blue}{\frac{\frac{0.125}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s \cdot \pi}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-/r*N/A

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

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{\frac{1}{8}}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s}\right), \color{blue}{\mathsf{PI}\left(\right)}\right) \]
  5. Applied egg-rr99.3%

    \[\leadsto \color{blue}{\frac{\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{\frac{r}{0.125}}}{s}}{\pi}} \]
  6. Step-by-step derivation
    1. associate-/r/N/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r} \cdot \frac{1}{8}}{s}\right), \mathsf{PI.f32}\left(\right)\right) \]
    2. associate-/l*N/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r} \cdot \frac{\frac{1}{8}}{s}\right), \mathsf{PI.f32}\left(\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r}\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\left(e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(e^{0 - \frac{r}{s}}\right), \left(e^{\frac{\frac{r}{s}}{-3}}\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. exp-lowering-exp.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\left(0 - \frac{r}{s}\right)\right), \left(e^{\frac{\frac{r}{s}}{-3}}\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    7. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \left(\frac{r}{s}\right)\right)\right), \left(e^{\frac{\frac{r}{s}}{-3}}\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    8. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \left(e^{\frac{\frac{r}{s}}{-3}}\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    9. exp-lowering-exp.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\left(\frac{\frac{r}{s}}{-3}\right)\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    10. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(\frac{r}{s}\right), -3\right)\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(r, s\right), -3\right)\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    12. /-lowering-/.f3299.3%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(r, s\right), -3\right)\right)\right), r\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
  7. Applied egg-rr99.3%

    \[\leadsto \frac{\color{blue}{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r} \cdot \frac{0.125}{s}}}{\pi} \]
  8. Final simplification99.3%

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

Alternative 4: 99.5% accurate, 1.1× speedup?

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

\\
\frac{0.125}{s} \cdot \frac{\frac{e^{\frac{r}{-s}} + e^{\frac{\frac{r}{s}}{-3}}}{r}}{\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.2%

    \[\leadsto \color{blue}{\frac{\frac{0.125}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s \cdot \pi}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-/r*N/A

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

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{\frac{1}{8}}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s}\right), \color{blue}{\mathsf{PI}\left(\right)}\right) \]
  5. Applied egg-rr99.3%

    \[\leadsto \color{blue}{\frac{\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{\frac{r}{0.125}}}{s}}{\pi}} \]
  6. Step-by-step derivation
    1. associate-/l/N/A

      \[\leadsto \frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{\frac{r}{\frac{1}{8}}}}{\color{blue}{\mathsf{PI}\left(\right) \cdot s}} \]
    2. associate-/r/N/A

      \[\leadsto \frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r} \cdot \frac{1}{8}}{\color{blue}{\mathsf{PI}\left(\right)} \cdot s} \]
    3. times-fracN/A

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

      \[\leadsto \mathsf{*.f32}\left(\left(\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r}}{\mathsf{PI}\left(\right)}\right), \color{blue}{\left(\frac{\frac{1}{8}}{s}\right)}\right) \]
  7. Applied egg-rr99.3%

    \[\leadsto \color{blue}{\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r}}{\pi} \cdot \frac{0.125}{s}} \]
  8. Final simplification99.3%

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

Alternative 5: 99.5% accurate, 1.1× speedup?

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

\\
\frac{0.125}{s} \cdot \frac{\frac{e^{\frac{r}{-s}} + e^{\frac{r}{s \cdot -3}}}{r}}{\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.2%

    \[\leadsto \color{blue}{\frac{\frac{0.125}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s \cdot \pi}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-/r*N/A

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

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{\frac{1}{8}}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s}\right), \color{blue}{\mathsf{PI}\left(\right)}\right) \]
  5. Applied egg-rr99.3%

    \[\leadsto \color{blue}{\frac{\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{\frac{r}{0.125}}}{s}}{\pi}} \]
  6. Step-by-step derivation
    1. associate-/r/N/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r} \cdot \frac{1}{8}}{s}\right), \mathsf{PI.f32}\left(\right)\right) \]
    2. associate-/l*N/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r} \cdot \frac{\frac{1}{8}}{s}\right), \mathsf{PI.f32}\left(\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r}\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\left(e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(e^{0 - \frac{r}{s}}\right), \left(e^{\frac{\frac{r}{s}}{-3}}\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. exp-lowering-exp.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\left(0 - \frac{r}{s}\right)\right), \left(e^{\frac{\frac{r}{s}}{-3}}\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    7. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \left(\frac{r}{s}\right)\right)\right), \left(e^{\frac{\frac{r}{s}}{-3}}\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    8. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \left(e^{\frac{\frac{r}{s}}{-3}}\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    9. exp-lowering-exp.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\left(\frac{\frac{r}{s}}{-3}\right)\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    10. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(\frac{r}{s}\right), -3\right)\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(r, s\right), -3\right)\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    12. /-lowering-/.f3299.3%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(r, s\right), -3\right)\right)\right), r\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
  7. Applied egg-rr99.3%

    \[\leadsto \frac{\color{blue}{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r} \cdot \frac{0.125}{s}}}{\pi} \]
  8. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \frac{\frac{\frac{1}{8}}{s} \cdot \frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r}}{\mathsf{PI}\left(\right)} \]
    2. associate-/l*N/A

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

      \[\leadsto \mathsf{*.f32}\left(\left(\frac{\frac{1}{8}}{s}\right), \color{blue}{\left(\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r}}{\mathsf{PI}\left(\right)}\right)}\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, s\right), \left(\frac{\color{blue}{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r}}}{\mathsf{PI}\left(\right)}\right)\right) \]
    5. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, s\right), \mathsf{/.f32}\left(\left(\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r}\right), \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \]
  9. Applied egg-rr99.3%

    \[\leadsto \color{blue}{\frac{0.125}{s} \cdot \frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}}{r}}{\pi}} \]
  10. Final simplification99.3%

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

Alternative 6: 99.5% accurate, 1.1× speedup?

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

\\
\frac{\frac{\frac{e^{\frac{r}{-s}} + e^{\frac{r \cdot -0.3333333333333333}{s}}}{\frac{r}{0.125}}}{s}}{\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.2%

    \[\leadsto \color{blue}{\frac{\frac{0.125}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s \cdot \pi}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-/r*N/A

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

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{\frac{1}{8}}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s}\right), \color{blue}{\mathsf{PI}\left(\right)}\right) \]
  5. Applied egg-rr99.3%

    \[\leadsto \color{blue}{\frac{\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{\frac{r}{0.125}}}{s}}{\pi}} \]
  6. Taylor expanded in r around inf

    \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\color{blue}{\left(e^{\mathsf{neg}\left(\frac{r}{s}\right)} + e^{\frac{-1}{3} \cdot \frac{r}{s}}\right)}, \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(e^{\frac{-1}{3} \cdot \frac{r}{s}} + e^{\mathsf{neg}\left(\frac{r}{s}\right)}\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    2. neg-mul-1N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(e^{\frac{-1}{3} \cdot \frac{r}{s}} + e^{-1 \cdot \frac{r}{s}}\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(e^{\frac{-1}{3} \cdot \frac{r}{s}}\right), \left(e^{-1 \cdot \frac{r}{s}}\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    4. exp-lowering-exp.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\left(\frac{-1}{3} \cdot \frac{r}{s}\right)\right), \left(e^{-1 \cdot \frac{r}{s}}\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\left(\frac{\frac{-1}{3} \cdot r}{s}\right)\right), \left(e^{-1 \cdot \frac{r}{s}}\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(\frac{-1}{3} \cdot r\right), s\right)\right), \left(e^{-1 \cdot \frac{r}{s}}\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(r \cdot \frac{-1}{3}\right), s\right)\right), \left(e^{-1 \cdot \frac{r}{s}}\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{-1}{3}\right), s\right)\right), \left(e^{-1 \cdot \frac{r}{s}}\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    9. exp-lowering-exp.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{-1}{3}\right), s\right)\right), \mathsf{exp.f32}\left(\left(-1 \cdot \frac{r}{s}\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    10. neg-mul-1N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{-1}{3}\right), s\right)\right), \mathsf{exp.f32}\left(\left(\mathsf{neg}\left(\frac{r}{s}\right)\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    11. distribute-neg-frac2N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{-1}{3}\right), s\right)\right), \mathsf{exp.f32}\left(\left(\frac{r}{\mathsf{neg}\left(s\right)}\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    12. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{-1}{3}\right), s\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, \left(\mathsf{neg}\left(s\right)\right)\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    13. neg-lowering-neg.f3299.3%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{-1}{3}\right), s\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, \mathsf{neg.f32}\left(s\right)\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
  8. Simplified99.3%

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

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

Alternative 7: 99.5% accurate, 1.1× speedup?

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

\\
\frac{\frac{0.125}{r}}{\pi} \cdot \frac{e^{\frac{r}{-s}} + e^{\frac{r \cdot -0.3333333333333333}{s}}}{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.2%

    \[\leadsto \color{blue}{\frac{\frac{0.125}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s \cdot \pi}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \frac{\frac{\frac{1}{8}}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{\mathsf{PI}\left(\right) \cdot \color{blue}{s}} \]
    2. times-fracN/A

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

      \[\leadsto \mathsf{*.f32}\left(\left(\frac{\frac{\frac{1}{8}}{r}}{\mathsf{PI}\left(\right)}\right), \color{blue}{\left(\frac{e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}}{s}\right)}\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\left(\frac{\frac{1}{8}}{r}\right), \mathsf{PI}\left(\right)\right), \left(\frac{\color{blue}{e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}}}{s}\right)\right) \]
    5. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI}\left(\right)\right), \left(\frac{\color{blue}{e^{0 - \frac{r}{s}}} + e^{\frac{r}{s \cdot -3}}}{s}\right)\right) \]
    6. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI.f32}\left(\right)\right), \left(\frac{e^{0 - \frac{r}{s}} + \color{blue}{e^{\frac{r}{s \cdot -3}}}}{s}\right)\right) \]
    7. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI.f32}\left(\right)\right), \mathsf{/.f32}\left(\left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right), \color{blue}{s}\right)\right) \]
    8. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI.f32}\left(\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(e^{0 - \frac{r}{s}}\right), \left(e^{\frac{r}{s \cdot -3}}\right)\right), s\right)\right) \]
    9. exp-lowering-exp.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI.f32}\left(\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\left(0 - \frac{r}{s}\right)\right), \left(e^{\frac{r}{s \cdot -3}}\right)\right), s\right)\right) \]
    10. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI.f32}\left(\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \left(\frac{r}{s}\right)\right)\right), \left(e^{\frac{r}{s \cdot -3}}\right)\right), s\right)\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI.f32}\left(\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \left(e^{\frac{r}{s \cdot -3}}\right)\right), s\right)\right) \]
    12. exp-lowering-exp.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI.f32}\left(\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\left(\frac{r}{s \cdot -3}\right)\right)\right), s\right)\right) \]
    13. associate-/r*N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI.f32}\left(\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\left(\frac{\frac{r}{s}}{-3}\right)\right)\right), s\right)\right) \]
    14. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI.f32}\left(\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(\frac{r}{s}\right), -3\right)\right)\right), s\right)\right) \]
    15. /-lowering-/.f3299.2%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI.f32}\left(\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(r, s\right), -3\right)\right)\right), s\right)\right) \]
  5. Applied egg-rr99.2%

    \[\leadsto \color{blue}{\frac{\frac{0.125}{r}}{\pi} \cdot \frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{s}} \]
  6. Taylor expanded in r around inf

    \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI.f32}\left(\right)\right), \color{blue}{\left(\frac{e^{\mathsf{neg}\left(\frac{r}{s}\right)} + e^{\frac{-1}{3} \cdot \frac{r}{s}}}{s}\right)}\right) \]
  7. Step-by-step derivation
    1. neg-mul-1N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI.f32}\left(\right)\right), \left(\frac{e^{-1 \cdot \frac{r}{s}} + e^{\frac{-1}{3} \cdot \frac{r}{s}}}{s}\right)\right) \]
    2. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, r\right), \mathsf{PI.f32}\left(\right)\right), \mathsf{/.f32}\left(\left(e^{-1 \cdot \frac{r}{s}} + e^{\frac{-1}{3} \cdot \frac{r}{s}}\right), \color{blue}{s}\right)\right) \]
  8. Simplified99.2%

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

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

Alternative 8: 10.6% accurate, 1.6× speedup?

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

\\
\frac{e^{\frac{r}{-s}} \cdot 0.25}{r \cdot \left(s \cdot \left(\pi \cdot 2\right)\right)} + \frac{\frac{\frac{-0.041666666666666664}{\pi} - \frac{\frac{0.0007716049382716049 \cdot \frac{r \cdot r}{s}}{\pi} + \frac{r \cdot -0.006944444444444444}{\pi}}{s}}{s} + \frac{0.125}{r \cdot \pi}}{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. Add Preprocessing
  3. Taylor expanded in s around -inf

    \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \color{blue}{\left(-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{-1}{144} \cdot \frac{r}{\mathsf{PI}\left(\right)} + \frac{1}{1296} \cdot \frac{{r}^{2}}{s \cdot \mathsf{PI}\left(\right)}}{s} - \frac{1}{24} \cdot \frac{1}{\mathsf{PI}\left(\right)}}{s} - \frac{1}{8} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)}}{s}\right)}\right) \]
  4. Simplified11.4%

    \[\leadsto \frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \color{blue}{\frac{\frac{\frac{-0.041666666666666664}{\pi} - \frac{\frac{r \cdot -0.006944444444444444}{\pi} + \frac{0.0007716049382716049 \cdot \frac{r \cdot r}{s}}{\pi}}{s}}{s} + \frac{0.125}{r \cdot \pi}}{s}} \]
  5. Final simplification11.4%

    \[\leadsto \frac{e^{\frac{r}{-s}} \cdot 0.25}{r \cdot \left(s \cdot \left(\pi \cdot 2\right)\right)} + \frac{\frac{\frac{-0.041666666666666664}{\pi} - \frac{\frac{0.0007716049382716049 \cdot \frac{r \cdot r}{s}}{\pi} + \frac{r \cdot -0.006944444444444444}{\pi}}{s}}{s} + \frac{0.125}{r \cdot \pi}}{s} \]
  6. Add Preprocessing

Alternative 9: 10.6% accurate, 1.6× speedup?

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

\\
\frac{\frac{0.125}{e^{\frac{r}{s}}}}{r \cdot \left(s \cdot \pi\right)} + \frac{\frac{\frac{-0.041666666666666664}{\pi} - \frac{\frac{r}{\pi} \cdot -0.006944444444444444 + \frac{0.0007716049382716049 \cdot \frac{r \cdot r}{s}}{\pi}}{s}}{s} - \frac{-0.125}{r \cdot \pi}}{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. Add Preprocessing
  3. Taylor expanded in r around inf

    \[\leadsto \mathsf{+.f32}\left(\color{blue}{\left(\frac{1}{8} \cdot \frac{e^{-1 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}\right)}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
  4. Step-by-step derivation
    1. associate-*r/N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot e^{-1 \cdot \frac{r}{s}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\color{blue}{\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right)}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    3. neg-mul-1N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot e^{\mathsf{neg}\left(\frac{r}{s}\right)}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    4. exp-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot \frac{1}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{\frac{1}{8} \cdot 1}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\color{blue}{\frac{3}{4}}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{\frac{1}{8}}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    7. /-lowering-/.f32N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\left(\frac{r}{s}\right)\right)\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    9. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \color{blue}{\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)}\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    12. PI-lowering-PI.f3299.4%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
  5. Simplified99.4%

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

    \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \color{blue}{\left(-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{-1}{144} \cdot \frac{r}{\mathsf{PI}\left(\right)} + \frac{1}{1296} \cdot \frac{{r}^{2}}{s \cdot \mathsf{PI}\left(\right)}}{s} - \frac{1}{24} \cdot \frac{1}{\mathsf{PI}\left(\right)}}{s} - \frac{1}{8} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)}}{s}\right)}\right) \]
  7. Simplified11.4%

    \[\leadsto \frac{\frac{0.125}{e^{\frac{r}{s}}}}{r \cdot \left(s \cdot \pi\right)} + \color{blue}{\frac{\left(-\frac{\frac{\frac{r}{\pi} \cdot -0.006944444444444444 + \frac{0.0007716049382716049 \cdot \frac{r \cdot r}{s}}{\pi}}{-s} + \frac{-0.041666666666666664}{\pi}}{s}\right) + \frac{-0.125}{r \cdot \pi}}{-s}} \]
  8. Final simplification11.4%

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

Alternative 10: 10.7% accurate, 1.8× speedup?

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

\\
\frac{\frac{\frac{e^{\frac{r}{-s}} + \left(1 - \frac{r \cdot 0.3333333333333333 + \frac{r \cdot r}{s} \cdot -0.05555555555555555}{s}\right)}{\frac{r}{0.125}}}{s}}{\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.2%

    \[\leadsto \color{blue}{\frac{\frac{0.125}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s \cdot \pi}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-/r*N/A

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

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{\frac{1}{8}}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s}\right), \color{blue}{\mathsf{PI}\left(\right)}\right) \]
  5. Applied egg-rr99.3%

    \[\leadsto \color{blue}{\frac{\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{\frac{r}{0.125}}}{s}}{\pi}} \]
  6. Taylor expanded in s around -inf

    \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \color{blue}{\left(1 + -1 \cdot \frac{\frac{-1}{18} \cdot \frac{{r}^{2}}{s} + \frac{1}{3} \cdot r}{s}\right)}\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
  7. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \left(1 + \left(\mathsf{neg}\left(\frac{\frac{-1}{18} \cdot \frac{{r}^{2}}{s} + \frac{1}{3} \cdot r}{s}\right)\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    2. unsub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \left(1 - \frac{\frac{-1}{18} \cdot \frac{{r}^{2}}{s} + \frac{1}{3} \cdot r}{s}\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    3. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{\_.f32}\left(1, \left(\frac{\frac{-1}{18} \cdot \frac{{r}^{2}}{s} + \frac{1}{3} \cdot r}{s}\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(\frac{-1}{18} \cdot \frac{{r}^{2}}{s} + \frac{1}{3} \cdot r\right), s\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(\frac{1}{3} \cdot r + \frac{-1}{18} \cdot \frac{{r}^{2}}{s}\right), s\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{1}{3} \cdot r\right), \left(\frac{-1}{18} \cdot \frac{{r}^{2}}{s}\right)\right), s\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(r \cdot \frac{1}{3}\right), \left(\frac{-1}{18} \cdot \frac{{r}^{2}}{s}\right)\right), s\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    8. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{3}\right), \left(\frac{-1}{18} \cdot \frac{{r}^{2}}{s}\right)\right), s\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    9. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{3}\right), \left(\frac{{r}^{2}}{s} \cdot \frac{-1}{18}\right)\right), s\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{3}\right), \mathsf{*.f32}\left(\left(\frac{{r}^{2}}{s}\right), \frac{-1}{18}\right)\right), s\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{3}\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\left({r}^{2}\right), s\right), \frac{-1}{18}\right)\right), s\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    12. unpow2N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{3}\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\left(r \cdot r\right), s\right), \frac{-1}{18}\right)\right), s\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    13. *-lowering-*.f3211.3%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{3}\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, r\right), s\right), \frac{-1}{18}\right)\right), s\right)\right)\right), \mathsf{/.f32}\left(r, \frac{1}{8}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
  8. Simplified11.3%

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

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

Alternative 11: 10.6% accurate, 4.4× speedup?

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

\\
\frac{\frac{0.125}{\frac{r + \frac{r \cdot \left(r \cdot 0.5\right) + \frac{r \cdot \left(r \cdot \left(r \cdot 0.16666666666666666\right)\right)}{s}}{s}}{s} + 1}}{r \cdot \left(s \cdot \pi\right)} + \frac{\frac{0.125}{r \cdot \pi} + \frac{\frac{-0.041666666666666664}{\pi} + \frac{\frac{r \cdot 0.006944444444444444}{\pi}}{s}}{s}}{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. Add Preprocessing
  3. Taylor expanded in r around inf

    \[\leadsto \mathsf{+.f32}\left(\color{blue}{\left(\frac{1}{8} \cdot \frac{e^{-1 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}\right)}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
  4. Step-by-step derivation
    1. associate-*r/N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot e^{-1 \cdot \frac{r}{s}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\color{blue}{\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right)}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    3. neg-mul-1N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot e^{\mathsf{neg}\left(\frac{r}{s}\right)}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    4. exp-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot \frac{1}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{\frac{1}{8} \cdot 1}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\color{blue}{\frac{3}{4}}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{\frac{1}{8}}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    7. /-lowering-/.f32N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\left(\frac{r}{s}\right)\right)\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    9. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \color{blue}{\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)}\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    12. PI-lowering-PI.f3299.4%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
  5. Simplified99.4%

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

    \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \color{blue}{\left(\frac{r \cdot \left(\frac{1}{144} \cdot \frac{r}{{s}^{3} \cdot \mathsf{PI}\left(\right)} - \frac{1}{24} \cdot \frac{1}{{s}^{2} \cdot \mathsf{PI}\left(\right)}\right) + \frac{1}{8} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}}{r}\right)}\right) \]
  7. Step-by-step derivation
    1. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\left(r \cdot \left(\frac{1}{144} \cdot \frac{r}{{s}^{3} \cdot \mathsf{PI}\left(\right)} - \frac{1}{24} \cdot \frac{1}{{s}^{2} \cdot \mathsf{PI}\left(\right)}\right) + \frac{1}{8} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}\right), \color{blue}{r}\right)\right) \]
  8. Simplified9.8%

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

    \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \color{blue}{\left(\frac{\left(\frac{1}{144} \cdot \frac{r}{{s}^{2} \cdot \mathsf{PI}\left(\right)} + \frac{1}{8} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)}\right) - \frac{\frac{1}{24}}{s \cdot \mathsf{PI}\left(\right)}}{s}\right)}\right) \]
  10. Simplified11.3%

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

    \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \color{blue}{\left(1 + -1 \cdot \frac{-1 \cdot r + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{r}^{3}}{s} + \frac{1}{2} \cdot {r}^{2}}{s}}{s}\right)}\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
  12. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \left(1 + \left(\mathsf{neg}\left(\frac{-1 \cdot r + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{r}^{3}}{s} + \frac{1}{2} \cdot {r}^{2}}{s}}{s}\right)\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \color{blue}{\mathsf{PI.f32}\left(\right)}\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    2. unsub-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \left(1 - \frac{-1 \cdot r + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{r}^{3}}{s} + \frac{1}{2} \cdot {r}^{2}}{s}}{s}\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \color{blue}{\mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)}\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    3. --lowering--.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{\_.f32}\left(1, \left(\frac{-1 \cdot r + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{r}^{3}}{s} + \frac{1}{2} \cdot {r}^{2}}{s}}{s}\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \color{blue}{\mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)}\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(-1 \cdot r + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{r}^{3}}{s} + \frac{1}{2} \cdot {r}^{2}}{s}\right), s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \color{blue}{\mathsf{PI.f32}\left(\right)}\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
  13. Simplified11.2%

    \[\leadsto \frac{\frac{0.125}{\color{blue}{1 - \frac{\frac{r \cdot \left(r \cdot 0.5\right) + \frac{r \cdot \left(r \cdot \left(r \cdot 0.16666666666666666\right)\right)}{s}}{-s} - r}{s}}}}{r \cdot \left(s \cdot \pi\right)} + \frac{\frac{0.125}{r \cdot \pi} + \frac{\frac{\frac{r \cdot 0.006944444444444444}{\pi}}{s} + \frac{-0.041666666666666664}{\pi}}{s}}{s} \]
  14. Final simplification11.2%

    \[\leadsto \frac{\frac{0.125}{\frac{r + \frac{r \cdot \left(r \cdot 0.5\right) + \frac{r \cdot \left(r \cdot \left(r \cdot 0.16666666666666666\right)\right)}{s}}{s}}{s} + 1}}{r \cdot \left(s \cdot \pi\right)} + \frac{\frac{0.125}{r \cdot \pi} + \frac{\frac{-0.041666666666666664}{\pi} + \frac{\frac{r \cdot 0.006944444444444444}{\pi}}{s}}{s}}{s} \]
  15. Add Preprocessing

Alternative 12: 10.3% accurate, 5.1× speedup?

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

\\
\frac{\frac{0.125}{r \cdot \pi} + \frac{\frac{-0.041666666666666664}{\pi} + \frac{\frac{r \cdot 0.006944444444444444}{\pi}}{s}}{s}}{s} + \frac{\frac{0.125}{r \cdot \left(\frac{1}{s} + \frac{r \cdot 0.5}{s \cdot s}\right) + 1}}{r \cdot \left(s \cdot \pi\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. Add Preprocessing
  3. Taylor expanded in r around inf

    \[\leadsto \mathsf{+.f32}\left(\color{blue}{\left(\frac{1}{8} \cdot \frac{e^{-1 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}\right)}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
  4. Step-by-step derivation
    1. associate-*r/N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot e^{-1 \cdot \frac{r}{s}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\color{blue}{\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right)}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    3. neg-mul-1N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot e^{\mathsf{neg}\left(\frac{r}{s}\right)}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    4. exp-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot \frac{1}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{\frac{1}{8} \cdot 1}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\color{blue}{\frac{3}{4}}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{\frac{1}{8}}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    7. /-lowering-/.f32N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\left(\frac{r}{s}\right)\right)\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    9. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \color{blue}{\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)}\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    12. PI-lowering-PI.f3299.4%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
  5. Simplified99.4%

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

    \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \color{blue}{\left(\frac{r \cdot \left(\frac{1}{144} \cdot \frac{r}{{s}^{3} \cdot \mathsf{PI}\left(\right)} - \frac{1}{24} \cdot \frac{1}{{s}^{2} \cdot \mathsf{PI}\left(\right)}\right) + \frac{1}{8} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}}{r}\right)}\right) \]
  7. Step-by-step derivation
    1. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\left(r \cdot \left(\frac{1}{144} \cdot \frac{r}{{s}^{3} \cdot \mathsf{PI}\left(\right)} - \frac{1}{24} \cdot \frac{1}{{s}^{2} \cdot \mathsf{PI}\left(\right)}\right) + \frac{1}{8} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}\right), \color{blue}{r}\right)\right) \]
  8. Simplified9.8%

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

    \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \color{blue}{\left(\frac{\left(\frac{1}{144} \cdot \frac{r}{{s}^{2} \cdot \mathsf{PI}\left(\right)} + \frac{1}{8} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)}\right) - \frac{\frac{1}{24}}{s \cdot \mathsf{PI}\left(\right)}}{s}\right)}\right) \]
  10. Simplified11.3%

    \[\leadsto \frac{\frac{0.125}{e^{\frac{r}{s}}}}{r \cdot \left(s \cdot \pi\right)} + \color{blue}{\frac{\frac{0.125}{r \cdot \pi} + \frac{\frac{\frac{r \cdot 0.006944444444444444}{\pi}}{s} + \frac{-0.041666666666666664}{\pi}}{s}}{s}} \]
  11. Taylor expanded in r around 0

    \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \color{blue}{\left(1 + r \cdot \left(\frac{1}{2} \cdot \frac{r}{{s}^{2}} + \frac{1}{s}\right)\right)}\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
  12. Step-by-step derivation
    1. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{+.f32}\left(1, \left(r \cdot \left(\frac{1}{2} \cdot \frac{r}{{s}^{2}} + \frac{1}{s}\right)\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \color{blue}{\mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)}\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    2. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(r, \left(\frac{1}{2} \cdot \frac{r}{{s}^{2}} + \frac{1}{s}\right)\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \color{blue}{\mathsf{PI.f32}\left(\right)}\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    3. +-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(r, \left(\frac{1}{s} + \frac{1}{2} \cdot \frac{r}{{s}^{2}}\right)\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    4. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\left(\frac{1}{s}\right), \left(\frac{1}{2} \cdot \frac{r}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    5. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{1}{2} \cdot \frac{r}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    6. associate-*r/N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{\frac{1}{2} \cdot r}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    7. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{/.f32}\left(\left(\frac{1}{2} \cdot r\right), \left({s}^{2}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{/.f32}\left(\left(r \cdot \frac{1}{2}\right), \left({s}^{2}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{2}\right), \left({s}^{2}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{2}\right), \left(s \cdot s\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    11. *-lowering-*.f3210.9%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{2}\right), \mathsf{*.f32}\left(s, s\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
  13. Simplified10.9%

    \[\leadsto \frac{\frac{0.125}{\color{blue}{1 + r \cdot \left(\frac{1}{s} + \frac{r \cdot 0.5}{s \cdot s}\right)}}}{r \cdot \left(s \cdot \pi\right)} + \frac{\frac{0.125}{r \cdot \pi} + \frac{\frac{\frac{r \cdot 0.006944444444444444}{\pi}}{s} + \frac{-0.041666666666666664}{\pi}}{s}}{s} \]
  14. Final simplification10.9%

    \[\leadsto \frac{\frac{0.125}{r \cdot \pi} + \frac{\frac{-0.041666666666666664}{\pi} + \frac{\frac{r \cdot 0.006944444444444444}{\pi}}{s}}{s}}{s} + \frac{\frac{0.125}{r \cdot \left(\frac{1}{s} + \frac{r \cdot 0.5}{s \cdot s}\right) + 1}}{r \cdot \left(s \cdot \pi\right)} \]
  15. Add Preprocessing

Alternative 13: 10.3% accurate, 5.4× speedup?

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

\\
\frac{\frac{0.125}{r \cdot \pi} + \frac{\frac{-0.041666666666666664}{\pi} + \frac{\frac{r \cdot 0.006944444444444444}{\pi}}{s}}{s}}{s} + \frac{\frac{0.125}{\frac{r - \frac{r \cdot r}{s} \cdot -0.5}{s} + 1}}{r \cdot \left(s \cdot \pi\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. Add Preprocessing
  3. Taylor expanded in r around inf

    \[\leadsto \mathsf{+.f32}\left(\color{blue}{\left(\frac{1}{8} \cdot \frac{e^{-1 \cdot \frac{r}{s}}}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}\right)}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
  4. Step-by-step derivation
    1. associate-*r/N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot e^{-1 \cdot \frac{r}{s}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\color{blue}{\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right)}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    3. neg-mul-1N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot e^{\mathsf{neg}\left(\frac{r}{s}\right)}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    4. exp-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{8} \cdot \frac{1}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{\frac{1}{8} \cdot 1}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\color{blue}{\frac{3}{4}}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\frac{\frac{1}{8}}{e^{\frac{r}{s}}}\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    7. /-lowering-/.f32N/A

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

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\left(\frac{r}{s}\right)\right)\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    9. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    10. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \color{blue}{\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)}\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
    12. PI-lowering-PI.f3299.4%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{3}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), \mathsf{*.f32}\left(3, s\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(6, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right)\right) \]
  5. Simplified99.4%

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

    \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \color{blue}{\left(\frac{r \cdot \left(\frac{1}{144} \cdot \frac{r}{{s}^{3} \cdot \mathsf{PI}\left(\right)} - \frac{1}{24} \cdot \frac{1}{{s}^{2} \cdot \mathsf{PI}\left(\right)}\right) + \frac{1}{8} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}}{r}\right)}\right) \]
  7. Step-by-step derivation
    1. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\left(r \cdot \left(\frac{1}{144} \cdot \frac{r}{{s}^{3} \cdot \mathsf{PI}\left(\right)} - \frac{1}{24} \cdot \frac{1}{{s}^{2} \cdot \mathsf{PI}\left(\right)}\right) + \frac{1}{8} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}\right), \color{blue}{r}\right)\right) \]
  8. Simplified9.8%

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

    \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \color{blue}{\left(\frac{\left(\frac{1}{144} \cdot \frac{r}{{s}^{2} \cdot \mathsf{PI}\left(\right)} + \frac{1}{8} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)}\right) - \frac{\frac{1}{24}}{s \cdot \mathsf{PI}\left(\right)}}{s}\right)}\right) \]
  10. Simplified11.3%

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

    \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \color{blue}{\left(1 + -1 \cdot \frac{-1 \cdot r + \frac{-1}{2} \cdot \frac{{r}^{2}}{s}}{s}\right)}\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
  12. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \left(1 + \left(\mathsf{neg}\left(\frac{-1 \cdot r + \frac{-1}{2} \cdot \frac{{r}^{2}}{s}}{s}\right)\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \color{blue}{\mathsf{PI.f32}\left(\right)}\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    2. unsub-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \left(1 - \frac{-1 \cdot r + \frac{-1}{2} \cdot \frac{{r}^{2}}{s}}{s}\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \color{blue}{\mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)}\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    3. --lowering--.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{\_.f32}\left(1, \left(\frac{-1 \cdot r + \frac{-1}{2} \cdot \frac{{r}^{2}}{s}}{s}\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \color{blue}{\mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)}\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(-1 \cdot r + \frac{-1}{2} \cdot \frac{{r}^{2}}{s}\right), s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \color{blue}{\mathsf{PI.f32}\left(\right)}\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(\frac{-1}{2} \cdot \frac{{r}^{2}}{s} + -1 \cdot r\right), s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    6. mul-1-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(\frac{-1}{2} \cdot \frac{{r}^{2}}{s} + \left(\mathsf{neg}\left(r\right)\right)\right), s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    7. unsub-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(\frac{-1}{2} \cdot \frac{{r}^{2}}{s} - r\right), s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    8. --lowering--.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\left(\frac{-1}{2} \cdot \frac{{r}^{2}}{s}\right), r\right), s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \left(\frac{{r}^{2}}{s}\right)\right), r\right), s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    10. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\left({r}^{2}\right), s\right)\right), r\right), s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\left(r \cdot r\right), s\right)\right), r\right), s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
    12. *-lowering-*.f3210.9%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(r, r\right), s\right)\right), r\right), s\right)\right)\right), \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{1}{144}\right), \mathsf{PI.f32}\left(\right)\right), s\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{PI.f32}\left(\right)\right)\right), s\right)\right), s\right)\right) \]
  13. Simplified10.9%

    \[\leadsto \frac{\frac{0.125}{\color{blue}{1 - \frac{-0.5 \cdot \frac{r \cdot r}{s} - r}{s}}}}{r \cdot \left(s \cdot \pi\right)} + \frac{\frac{0.125}{r \cdot \pi} + \frac{\frac{\frac{r \cdot 0.006944444444444444}{\pi}}{s} + \frac{-0.041666666666666664}{\pi}}{s}}{s} \]
  14. Final simplification10.9%

    \[\leadsto \frac{\frac{0.125}{r \cdot \pi} + \frac{\frac{-0.041666666666666664}{\pi} + \frac{\frac{r \cdot 0.006944444444444444}{\pi}}{s}}{s}}{s} + \frac{\frac{0.125}{\frac{r - \frac{r \cdot r}{s} \cdot -0.5}{s} + 1}}{r \cdot \left(s \cdot \pi\right)} \]
  15. Add Preprocessing

Alternative 14: 10.0% accurate, 11.0× speedup?

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

\\
\frac{\frac{0.25}{r \cdot \pi} + \frac{\frac{\frac{r}{s} \cdot 0.0625}{\pi} + \frac{-0.16666666666666666}{\pi}}{s}}{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. Add Preprocessing
  3. Taylor expanded in s around inf

    \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \color{blue}{\left(\frac{\frac{1}{8} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)} - \frac{1}{24} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}}{s}\right)}\right) \]
  4. Step-by-step derivation
    1. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\left(\frac{1}{8} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)} - \frac{1}{24} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}\right), \color{blue}{s}\right)\right) \]
    2. sub-negN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\left(\frac{1}{8} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)} + \left(\mathsf{neg}\left(\frac{1}{24} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right)\right) \]
    3. +-lowering-+.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{1}{8} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)}\right), \left(\mathsf{neg}\left(\frac{1}{24} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right)\right) \]
    4. associate-*r/N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{\frac{1}{8} \cdot 1}{r \cdot \mathsf{PI}\left(\right)}\right), \left(\mathsf{neg}\left(\frac{1}{24} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{\frac{1}{8}}{r \cdot \mathsf{PI}\left(\right)}\right), \left(\mathsf{neg}\left(\frac{1}{24} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right)\right) \]
    6. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \left(r \cdot \mathsf{PI}\left(\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right)\right) \]
    7. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI}\left(\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right)\right) \]
    8. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \left(\mathsf{neg}\left(\frac{1}{24} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right)\right) \]
    9. associate-*r/N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \left(\mathsf{neg}\left(\frac{\frac{1}{24} \cdot 1}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right)\right) \]
    10. metadata-evalN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \left(\mathsf{neg}\left(\frac{\frac{1}{24}}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right)\right) \]
    11. distribute-neg-fracN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \left(\frac{\mathsf{neg}\left(\frac{1}{24}\right)}{s \cdot \mathsf{PI}\left(\right)}\right)\right), s\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \left(\frac{\frac{-1}{24}}{s \cdot \mathsf{PI}\left(\right)}\right)\right), s\right)\right) \]
    13. /-lowering-/.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\frac{-1}{24}, \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), s\right)\right) \]
    14. *-lowering-*.f32N/A

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{*.f32}\left(s, \mathsf{PI}\left(\right)\right)\right)\right), s\right)\right) \]
    15. PI-lowering-PI.f3210.6%

      \[\leadsto \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(r\right), s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(2, \mathsf{PI.f32}\left(\right)\right), s\right), r\right)\right), \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\frac{-1}{24}, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), s\right)\right) \]
  5. Simplified10.6%

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

    \[\leadsto \color{blue}{\frac{\left(\frac{1}{16} \cdot \frac{r}{{s}^{2} \cdot \mathsf{PI}\left(\right)} + \frac{1}{4} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)}\right) - \frac{\frac{1}{6}}{s \cdot \mathsf{PI}\left(\right)}}{s}} \]
  7. Step-by-step derivation
    1. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\left(\left(\frac{1}{16} \cdot \frac{r}{{s}^{2} \cdot \mathsf{PI}\left(\right)} + \frac{1}{4} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)}\right) - \frac{\frac{1}{6}}{s \cdot \mathsf{PI}\left(\right)}\right), \color{blue}{s}\right) \]
  8. Simplified10.7%

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

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

Alternative 15: 10.1% accurate, 12.2× speedup?

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

\\
\frac{\frac{0.25 + r \cdot \frac{-0.16666666666666666 + \frac{r \cdot 0.06944444444444445}{s}}{s}}{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.2%

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

    \[\leadsto \mathsf{/.f32}\left(\color{blue}{\left(-1 \cdot \frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s} + \frac{1}{4} \cdot \frac{1}{r}\right)}, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  5. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} + -1 \cdot \frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
    2. mul-1-negN/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} + \left(\mathsf{neg}\left(\frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right)\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    3. unsub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} - \frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
    4. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r}\right), \left(\frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right)\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\left(\frac{\frac{1}{4} \cdot 1}{r}\right), \left(\frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\left(\frac{\frac{1}{4}}{r}\right), \left(\frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    7. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \left(\frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    8. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \mathsf{/.f32}\left(\left(\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}\right), s\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  6. Simplified10.4%

    \[\leadsto \frac{\color{blue}{\frac{0.25}{r} - \frac{0.16666666666666666 - \frac{-0.125 \cdot \frac{r \cdot \left(r \cdot 0.1728395061728395\right)}{s} + r \cdot 0.06944444444444445}{s}}{s}}}{s \cdot \pi} \]
  7. Taylor expanded in r around 0

    \[\leadsto \mathsf{/.f32}\left(\color{blue}{\left(\frac{\frac{1}{4} + r \cdot \left(\frac{5}{72} \cdot \frac{r}{{s}^{2}} - \frac{1}{6} \cdot \frac{1}{s}\right)}{r}\right)}, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  8. Step-by-step derivation
    1. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{4} + r \cdot \left(\frac{5}{72} \cdot \frac{r}{{s}^{2}} - \frac{1}{6} \cdot \frac{1}{s}\right)\right), r\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
  9. Simplified10.7%

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

Alternative 16: 10.1% accurate, 12.2× speedup?

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

\\
\frac{\frac{0.125}{s} \cdot \left(\frac{2}{r} + \frac{r \cdot \frac{0.5555555555555556}{s} - 1.3333333333333333}{s}\right)}{\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.2%

    \[\leadsto \color{blue}{\frac{\frac{0.125}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s \cdot \pi}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-/r*N/A

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

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{\frac{1}{8}}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s}\right), \color{blue}{\mathsf{PI}\left(\right)}\right) \]
  5. Applied egg-rr99.3%

    \[\leadsto \color{blue}{\frac{\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{\frac{r}{0.125}}}{s}}{\pi}} \]
  6. Step-by-step derivation
    1. associate-/r/N/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r} \cdot \frac{1}{8}}{s}\right), \mathsf{PI.f32}\left(\right)\right) \]
    2. associate-/l*N/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r} \cdot \frac{\frac{1}{8}}{s}\right), \mathsf{PI.f32}\left(\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r}\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\left(e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(e^{0 - \frac{r}{s}}\right), \left(e^{\frac{\frac{r}{s}}{-3}}\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. exp-lowering-exp.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\left(0 - \frac{r}{s}\right)\right), \left(e^{\frac{\frac{r}{s}}{-3}}\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    7. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \left(\frac{r}{s}\right)\right)\right), \left(e^{\frac{\frac{r}{s}}{-3}}\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    8. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \left(e^{\frac{\frac{r}{s}}{-3}}\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    9. exp-lowering-exp.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\left(\frac{\frac{r}{s}}{-3}\right)\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    10. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(\frac{r}{s}\right), -3\right)\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    11. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(r, s\right), -3\right)\right)\right), r\right), \left(\frac{\frac{1}{8}}{s}\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    12. /-lowering-/.f3299.3%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(r, s\right), -3\right)\right)\right), r\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
  7. Applied egg-rr99.3%

    \[\leadsto \frac{\color{blue}{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{r} \cdot \frac{0.125}{s}}}{\pi} \]
  8. Taylor expanded in s around -inf

    \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\color{blue}{\left(-1 \cdot \frac{\frac{4}{3} + -1 \cdot \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}}{s} + 2 \cdot \frac{1}{r}\right)}, \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
  9. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(2 \cdot \frac{1}{r} + -1 \cdot \frac{\frac{4}{3} + -1 \cdot \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}}{s}\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    2. mul-1-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(2 \cdot \frac{1}{r} + \left(\mathsf{neg}\left(\frac{\frac{4}{3} + -1 \cdot \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}}{s}\right)\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    3. unsub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(2 \cdot \frac{1}{r} - \frac{\frac{4}{3} + -1 \cdot \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}}{s}\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    4. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(\left(2 \cdot \frac{1}{r}\right), \left(\frac{\frac{4}{3} + -1 \cdot \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}}{s}\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(\left(\frac{2 \cdot 1}{r}\right), \left(\frac{\frac{4}{3} + -1 \cdot \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}}{s}\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(\left(\frac{2}{r}\right), \left(\frac{\frac{4}{3} + -1 \cdot \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}}{s}\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    7. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(2, r\right), \left(\frac{\frac{4}{3} + -1 \cdot \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}}{s}\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    8. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(2, r\right), \mathsf{/.f32}\left(\left(\frac{4}{3} + -1 \cdot \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}\right), s\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    9. mul-1-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(2, r\right), \mathsf{/.f32}\left(\left(\frac{4}{3} + \left(\mathsf{neg}\left(\frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}\right)\right)\right), s\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    10. unsub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(2, r\right), \mathsf{/.f32}\left(\left(\frac{4}{3} - \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}\right), s\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    11. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(2, r\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\frac{4}{3}, \left(\frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}\right)\right), s\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    12. distribute-rgt-outN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(2, r\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\frac{4}{3}, \left(\frac{r \cdot \left(\frac{1}{18} + \frac{1}{2}\right)}{s}\right)\right), s\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(2, r\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\frac{4}{3}, \left(\frac{r \cdot \frac{5}{9}}{s}\right)\right), s\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    14. associate-/l*N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(2, r\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\frac{4}{3}, \left(r \cdot \frac{\frac{5}{9}}{s}\right)\right), s\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    15. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(2, r\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\frac{4}{3}, \mathsf{*.f32}\left(r, \left(\frac{\frac{5}{9}}{s}\right)\right)\right), s\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    16. /-lowering-/.f3210.7%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(2, r\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\frac{4}{3}, \mathsf{*.f32}\left(r, \mathsf{/.f32}\left(\frac{5}{9}, s\right)\right)\right), s\right)\right), \mathsf{/.f32}\left(\frac{1}{8}, s\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
  10. Simplified10.7%

    \[\leadsto \frac{\color{blue}{\left(\frac{2}{r} - \frac{1.3333333333333333 - r \cdot \frac{0.5555555555555556}{s}}{s}\right)} \cdot \frac{0.125}{s}}{\pi} \]
  11. Final simplification10.7%

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

Alternative 17: 10.1% accurate, 13.6× speedup?

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

\\
\frac{\frac{\frac{0.25}{r} - \frac{\frac{r \cdot -0.06944444444444445}{s} + 0.16666666666666666}{s}}{s}}{\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.2%

    \[\leadsto \color{blue}{\frac{\frac{0.125}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s \cdot \pi}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-/r*N/A

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

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{\frac{1}{8}}{r} \cdot \left(e^{0 - \frac{r}{s}} + e^{\frac{r}{s \cdot -3}}\right)}{s}\right), \color{blue}{\mathsf{PI}\left(\right)}\right) \]
  5. Applied egg-rr99.3%

    \[\leadsto \color{blue}{\frac{\frac{\frac{e^{0 - \frac{r}{s}} + e^{\frac{\frac{r}{s}}{-3}}}{\frac{r}{0.125}}}{s}}{\pi}} \]
  6. Taylor expanded in s around -inf

    \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\color{blue}{\left(-1 \cdot \frac{\frac{1}{6} + \frac{-1}{8} \cdot \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}}{s} + \frac{1}{4} \cdot \frac{1}{r}\right)}, s\right), \mathsf{PI.f32}\left(\right)\right) \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} + -1 \cdot \frac{\frac{1}{6} + \frac{-1}{8} \cdot \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}}{s}\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    2. mul-1-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} + \left(\mathsf{neg}\left(\frac{\frac{1}{6} + \frac{-1}{8} \cdot \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}}{s}\right)\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    3. unsub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} - \frac{\frac{1}{6} + \frac{-1}{8} \cdot \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s}}{s}\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    4. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} - \frac{\frac{1}{6} + \frac{\frac{1}{18} \cdot r + \frac{1}{2} \cdot r}{s} \cdot \frac{-1}{8}}{s}\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. associate-*l/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} - \frac{\frac{1}{6} + \frac{\left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right) \cdot \frac{-1}{8}}{s}}{s}\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. distribute-rgt-outN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} - \frac{\frac{1}{6} + \frac{\left(r \cdot \left(\frac{1}{18} + \frac{1}{2}\right)\right) \cdot \frac{-1}{8}}{s}}{s}\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} - \frac{\frac{1}{6} + \frac{\left(r \cdot \frac{5}{9}\right) \cdot \frac{-1}{8}}{s}}{s}\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    8. associate-*l*N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} - \frac{\frac{1}{6} + \frac{r \cdot \left(\frac{5}{9} \cdot \frac{-1}{8}\right)}{s}}{s}\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    9. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} - \frac{\frac{1}{6} + \frac{r \cdot \frac{-5}{72}}{s}}{s}\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    10. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} - \frac{\frac{1}{6} + \frac{\frac{-5}{72} \cdot r}{s}}{s}\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    11. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} - \frac{\frac{1}{6} + \frac{-5}{72} \cdot \frac{r}{s}}{s}\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
    12. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{\_.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r}\right), \left(\frac{\frac{1}{6} + \frac{-5}{72} \cdot \frac{r}{s}}{s}\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
  8. Simplified10.7%

    \[\leadsto \frac{\frac{\color{blue}{\frac{0.25}{r} - \frac{0.16666666666666666 + \frac{r \cdot -0.06944444444444445}{s}}{s}}}{s}}{\pi} \]
  9. Final simplification10.7%

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

Alternative 18: 10.1% accurate, 13.6× speedup?

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

\\
\frac{\frac{0.25}{r} + \frac{\frac{r \cdot 0.06944444444444445}{s} - 0.16666666666666666}{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.2%

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

    \[\leadsto \mathsf{/.f32}\left(\color{blue}{\left(-1 \cdot \frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s} + \frac{1}{4} \cdot \frac{1}{r}\right)}, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  5. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} + -1 \cdot \frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
    2. mul-1-negN/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} + \left(\mathsf{neg}\left(\frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right)\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    3. unsub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} - \frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
    4. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r}\right), \left(\frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right)\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\left(\frac{\frac{1}{4} \cdot 1}{r}\right), \left(\frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\left(\frac{\frac{1}{4}}{r}\right), \left(\frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    7. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \left(\frac{\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}}{s}\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    8. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \mathsf{/.f32}\left(\left(\frac{1}{6} + -1 \cdot \frac{\frac{-1}{8} \cdot \frac{\frac{1}{162} \cdot {r}^{2} + \frac{1}{6} \cdot {r}^{2}}{s} + \frac{1}{8} \cdot \left(\frac{1}{18} \cdot r + \frac{1}{2} \cdot r\right)}{s}\right), s\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  6. Simplified10.4%

    \[\leadsto \frac{\color{blue}{\frac{0.25}{r} - \frac{0.16666666666666666 - \frac{-0.125 \cdot \frac{r \cdot \left(r \cdot 0.1728395061728395\right)}{s} + r \cdot 0.06944444444444445}{s}}{s}}}{s \cdot \pi} \]
  7. Taylor expanded in r around 0

    \[\leadsto \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\frac{1}{6}, \mathsf{/.f32}\left(\color{blue}{\left(\frac{5}{72} \cdot r\right)}, s\right)\right), s\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  8. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\frac{1}{6}, \mathsf{/.f32}\left(\left(r \cdot \frac{5}{72}\right), s\right)\right), s\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    2. *-lowering-*.f3210.7%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\frac{1}{6}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{5}{72}\right), s\right)\right), s\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  9. Simplified10.7%

    \[\leadsto \frac{\frac{0.25}{r} - \frac{0.16666666666666666 - \frac{\color{blue}{r \cdot 0.06944444444444445}}{s}}{s}}{s \cdot \pi} \]
  10. Final simplification10.7%

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

Alternative 19: 9.2% accurate, 17.8× speedup?

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

\\
\frac{\frac{0.25 + \frac{r \cdot -0.16666666666666666}{s}}{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.2%

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

    \[\leadsto \mathsf{/.f32}\left(\color{blue}{\left(\frac{\frac{1}{4} + \frac{-1}{6} \cdot \frac{r}{s}}{r}\right)}, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  5. Step-by-step derivation
    1. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{1}{4} + \frac{-1}{6} \cdot \frac{r}{s}\right), r\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
    2. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\frac{1}{4}, \left(\frac{-1}{6} \cdot \frac{r}{s}\right)\right), r\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    3. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\frac{1}{4}, \left(\frac{\frac{-1}{6} \cdot r}{s}\right)\right), r\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\frac{1}{4}, \mathsf{/.f32}\left(\left(\frac{-1}{6} \cdot r\right), s\right)\right), r\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    5. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\frac{1}{4}, \mathsf{/.f32}\left(\left(r \cdot \frac{-1}{6}\right), s\right)\right), r\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    6. *-lowering-*.f3210.1%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\frac{1}{4}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(r, \frac{-1}{6}\right), s\right)\right), r\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  6. Simplified10.1%

    \[\leadsto \frac{\color{blue}{\frac{0.25 + \frac{r \cdot -0.16666666666666666}{s}}{r}}}{s \cdot \pi} \]
  7. Add Preprocessing

Alternative 20: 9.2% accurate, 17.8× speedup?

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

\\
\frac{\frac{0.25}{r \cdot \pi} + \frac{-0.16666666666666666}{s \cdot \pi}}{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. Add Preprocessing
  3. Taylor expanded in s around inf

    \[\leadsto \color{blue}{\frac{\frac{1}{4} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)} - \frac{1}{6} \cdot \frac{1}{s \cdot \mathsf{PI}\left(\right)}}{s}} \]
  4. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \frac{\frac{1}{4} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)} - \frac{\frac{1}{6} \cdot 1}{s \cdot \mathsf{PI}\left(\right)}}{s} \]
    2. metadata-evalN/A

      \[\leadsto \frac{\frac{1}{4} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)} - \frac{\frac{1}{6}}{s \cdot \mathsf{PI}\left(\right)}}{s} \]
    3. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)} - \frac{\frac{1}{6}}{s \cdot \mathsf{PI}\left(\right)}\right), \color{blue}{s}\right) \]
    4. sub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)} + \left(\mathsf{neg}\left(\frac{\frac{1}{6}}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right) \]
    5. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r \cdot \mathsf{PI}\left(\right)}\right), \left(\mathsf{neg}\left(\frac{\frac{1}{6}}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right) \]
    6. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{\frac{1}{4} \cdot 1}{r \cdot \mathsf{PI}\left(\right)}\right), \left(\mathsf{neg}\left(\frac{\frac{1}{6}}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{\frac{1}{4}}{r \cdot \mathsf{PI}\left(\right)}\right), \left(\mathsf{neg}\left(\frac{\frac{1}{6}}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right) \]
    8. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \left(r \cdot \mathsf{PI}\left(\right)\right)\right), \left(\mathsf{neg}\left(\frac{\frac{1}{6}}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \mathsf{PI}\left(\right)\right)\right), \left(\mathsf{neg}\left(\frac{\frac{1}{6}}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right) \]
    10. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \left(\mathsf{neg}\left(\frac{\frac{1}{6}}{s \cdot \mathsf{PI}\left(\right)}\right)\right)\right), s\right) \]
    11. distribute-neg-fracN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \left(\frac{\mathsf{neg}\left(\frac{1}{6}\right)}{s \cdot \mathsf{PI}\left(\right)}\right)\right), s\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \left(\frac{\frac{-1}{6}}{s \cdot \mathsf{PI}\left(\right)}\right)\right), s\right) \]
    13. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\frac{-1}{6}, \left(s \cdot \mathsf{PI}\left(\right)\right)\right)\right), s\right) \]
    14. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\frac{-1}{6}, \mathsf{*.f32}\left(s, \mathsf{PI}\left(\right)\right)\right)\right), s\right) \]
    15. PI-lowering-PI.f3210.1%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{/.f32}\left(\frac{-1}{6}, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right), s\right) \]
  5. Simplified10.1%

    \[\leadsto \color{blue}{\frac{\frac{0.25}{r \cdot \pi} + \frac{-0.16666666666666666}{s \cdot \pi}}{s}} \]
  6. Add Preprocessing

Alternative 21: 9.2% accurate, 21.0× speedup?

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

\\
\frac{\frac{\frac{0.25}{r} + \frac{-0.16666666666666666}{s}}{s}}{\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.2%

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

    \[\leadsto \mathsf{/.f32}\left(\color{blue}{\left(\frac{1}{4} \cdot \frac{1}{r} - \frac{1}{6} \cdot \frac{1}{s}\right)}, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  5. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} + \left(\mathsf{neg}\left(\frac{1}{6} \cdot \frac{1}{s}\right)\right)\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
    2. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r}\right), \left(\mathsf{neg}\left(\frac{1}{6} \cdot \frac{1}{s}\right)\right)\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
    3. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{\frac{1}{4} \cdot 1}{r}\right), \left(\mathsf{neg}\left(\frac{1}{6} \cdot \frac{1}{s}\right)\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{\frac{1}{4}}{r}\right), \left(\mathsf{neg}\left(\frac{1}{6} \cdot \frac{1}{s}\right)\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    5. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \left(\mathsf{neg}\left(\frac{1}{6} \cdot \frac{1}{s}\right)\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    6. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \left(\mathsf{neg}\left(\frac{\frac{1}{6} \cdot 1}{s}\right)\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \left(\mathsf{neg}\left(\frac{\frac{1}{6}}{s}\right)\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    8. distribute-neg-fracN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \left(\frac{\mathsf{neg}\left(\frac{1}{6}\right)}{s}\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    9. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \left(\frac{\frac{-1}{6}}{s}\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    10. /-lowering-/.f3210.0%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \mathsf{/.f32}\left(\frac{-1}{6}, s\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  6. Simplified10.0%

    \[\leadsto \frac{\color{blue}{\frac{0.25}{r} + \frac{-0.16666666666666666}{s}}}{s \cdot \pi} \]
  7. Step-by-step derivation
    1. associate-/r*N/A

      \[\leadsto \frac{\frac{\frac{\frac{1}{4}}{r} + \frac{\frac{-1}{6}}{s}}{s}}{\color{blue}{\mathsf{PI}\left(\right)}} \]
    2. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{\frac{1}{4}}{r} + \frac{\frac{-1}{6}}{s}}{s}\right), \color{blue}{\mathsf{PI}\left(\right)}\right) \]
    3. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{\frac{1}{4}}{r} + \frac{\frac{-1}{6}}{s}\right), s\right), \mathsf{PI}\left(\right)\right) \]
    4. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{\frac{1}{4}}{r}\right), \left(\frac{\frac{-1}{6}}{s}\right)\right), s\right), \mathsf{PI}\left(\right)\right) \]
    5. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \left(\frac{\frac{-1}{6}}{s}\right)\right), s\right), \mathsf{PI}\left(\right)\right) \]
    6. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \mathsf{/.f32}\left(\frac{-1}{6}, s\right)\right), s\right), \mathsf{PI}\left(\right)\right) \]
    7. PI-lowering-PI.f3210.0%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \mathsf{/.f32}\left(\frac{-1}{6}, s\right)\right), s\right), \mathsf{PI.f32}\left(\right)\right) \]
  8. Applied egg-rr10.0%

    \[\leadsto \color{blue}{\frac{\frac{\frac{0.25}{r} + \frac{-0.16666666666666666}{s}}{s}}{\pi}} \]
  9. Add Preprocessing

Alternative 22: 9.2% accurate, 21.0× speedup?

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

\\
\frac{\frac{0.25}{r} + \frac{-0.16666666666666666}{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.2%

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

    \[\leadsto \mathsf{/.f32}\left(\color{blue}{\left(\frac{1}{4} \cdot \frac{1}{r} - \frac{1}{6} \cdot \frac{1}{s}\right)}, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  5. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r} + \left(\mathsf{neg}\left(\frac{1}{6} \cdot \frac{1}{s}\right)\right)\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
    2. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{r}\right), \left(\mathsf{neg}\left(\frac{1}{6} \cdot \frac{1}{s}\right)\right)\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
    3. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{\frac{1}{4} \cdot 1}{r}\right), \left(\mathsf{neg}\left(\frac{1}{6} \cdot \frac{1}{s}\right)\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\left(\frac{\frac{1}{4}}{r}\right), \left(\mathsf{neg}\left(\frac{1}{6} \cdot \frac{1}{s}\right)\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    5. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \left(\mathsf{neg}\left(\frac{1}{6} \cdot \frac{1}{s}\right)\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    6. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \left(\mathsf{neg}\left(\frac{\frac{1}{6} \cdot 1}{s}\right)\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \left(\mathsf{neg}\left(\frac{\frac{1}{6}}{s}\right)\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    8. distribute-neg-fracN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \left(\frac{\mathsf{neg}\left(\frac{1}{6}\right)}{s}\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    9. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \left(\frac{\frac{-1}{6}}{s}\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
    10. /-lowering-/.f3210.0%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \mathsf{/.f32}\left(\frac{-1}{6}, s\right)\right), \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  6. Simplified10.0%

    \[\leadsto \frac{\color{blue}{\frac{0.25}{r} + \frac{-0.16666666666666666}{s}}}{s \cdot \pi} \]
  7. Add Preprocessing

Alternative 23: 9.0% accurate, 33.0× speedup?

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

\\
\frac{\frac{0.25}{\pi}}{r \cdot 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.2%

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

    \[\leadsto \mathsf{/.f32}\left(\color{blue}{\left(\frac{\frac{1}{4}}{r}\right)}, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  5. Step-by-step derivation
    1. /-lowering-/.f329.6%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
  6. Simplified9.6%

    \[\leadsto \frac{\color{blue}{\frac{0.25}{r}}}{s \cdot \pi} \]
  7. Step-by-step derivation
    1. associate-/r*N/A

      \[\leadsto \frac{\frac{1}{4}}{\color{blue}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}} \]
    2. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \color{blue}{\left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \color{blue}{\left(s \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
    4. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right) \]
    5. PI-lowering-PI.f329.6%

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
  8. Applied egg-rr9.6%

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

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \left(\left(r \cdot s\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \]
    2. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(\left(r \cdot s\right), \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(r, s\right), \mathsf{PI}\left(\right)\right)\right) \]
    4. PI-lowering-PI.f329.6%

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(r, s\right), \mathsf{PI.f32}\left(\right)\right)\right) \]
  10. Applied egg-rr9.6%

    \[\leadsto \frac{0.25}{\color{blue}{\left(r \cdot s\right) \cdot \pi}} \]
  11. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \frac{\frac{1}{4}}{\mathsf{PI}\left(\right) \cdot \color{blue}{\left(r \cdot s\right)}} \]
    2. associate-/r*N/A

      \[\leadsto \frac{\frac{\frac{1}{4}}{\mathsf{PI}\left(\right)}}{\color{blue}{r \cdot s}} \]
    3. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{1}{4}}{\mathsf{PI}\left(\right)}\right), \color{blue}{\left(r \cdot s\right)}\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \mathsf{PI}\left(\right)\right), \left(\color{blue}{r} \cdot s\right)\right) \]
    5. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \mathsf{PI.f32}\left(\right)\right), \left(r \cdot s\right)\right) \]
    6. *-lowering-*.f329.6%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(r, \color{blue}{s}\right)\right) \]
  12. Applied egg-rr9.6%

    \[\leadsto \color{blue}{\frac{\frac{0.25}{\pi}}{r \cdot s}} \]
  13. Add Preprocessing

Alternative 24: 9.0% accurate, 33.0× speedup?

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

\\
\frac{0.25}{\pi \cdot \left(r \cdot s\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.2%

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

    \[\leadsto \mathsf{/.f32}\left(\color{blue}{\left(\frac{\frac{1}{4}}{r}\right)}, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  5. Step-by-step derivation
    1. /-lowering-/.f329.6%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
  6. Simplified9.6%

    \[\leadsto \frac{\color{blue}{\frac{0.25}{r}}}{s \cdot \pi} \]
  7. Step-by-step derivation
    1. associate-/r*N/A

      \[\leadsto \frac{\frac{1}{4}}{\color{blue}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}} \]
    2. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \color{blue}{\left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \color{blue}{\left(s \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
    4. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right) \]
    5. PI-lowering-PI.f329.6%

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
  8. Applied egg-rr9.6%

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

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \left(\left(r \cdot s\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \]
    2. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(\left(r \cdot s\right), \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(r, s\right), \mathsf{PI}\left(\right)\right)\right) \]
    4. PI-lowering-PI.f329.6%

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(\mathsf{*.f32}\left(r, s\right), \mathsf{PI.f32}\left(\right)\right)\right) \]
  10. Applied egg-rr9.6%

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

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

Alternative 25: 9.0% accurate, 33.0× speedup?

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

\\
\frac{0.25}{r \cdot \left(s \cdot \pi\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.2%

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

    \[\leadsto \mathsf{/.f32}\left(\color{blue}{\left(\frac{\frac{1}{4}}{r}\right)}, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
  5. Step-by-step derivation
    1. /-lowering-/.f329.6%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, r\right), \mathsf{*.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
  6. Simplified9.6%

    \[\leadsto \frac{\color{blue}{\frac{0.25}{r}}}{s \cdot \pi} \]
  7. Step-by-step derivation
    1. associate-/r*N/A

      \[\leadsto \frac{\frac{1}{4}}{\color{blue}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}} \]
    2. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \color{blue}{\left(r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
    3. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \color{blue}{\left(s \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
    4. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right) \]
    5. PI-lowering-PI.f329.6%

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right)\right) \]
  8. Applied egg-rr9.6%

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

Reproduce

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