Disney BSSRDF, PDF of scattering profile

Percentage Accurate: 99.5% → 99.5%
Time: 14.8s
Alternatives: 14
Speedup: N/A×

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 14 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.5% 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.5% accurate, 1.1× speedup?

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

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

    \[\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. Simplified97.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.5% accurate, 1.1× speedup?

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

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

    \[\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. Simplified97.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.5% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \frac{\frac{0.125}{s} \cdot \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(Float32(0.125) / s) * 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{\frac{0.125}{s} \cdot \frac{e^{\frac{r}{-s}} + e^{\frac{r}{s \cdot -3}}}{r}}{\pi}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\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. Simplified97.3%

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

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

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

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

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

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

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

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

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

Alternative 4: 99.5% accurate, 1.1× speedup?

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

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

    \[\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. Simplified97.3%

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

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

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

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

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

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

Alternative 5: 74.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(r \cdot \pi\right) \cdot \left(\left(\left(r \cdot r\right) \cdot 1.7777777777777777\right) \cdot -0.125\right) + \left(\left(r \cdot r\right) \cdot \left(\pi \cdot 0.5555555555555556\right)\right) \cdot \left(r \cdot 0.25\right)\\ \frac{1}{s \cdot \left(\left(\frac{-2 \cdot \left(r \cdot \left(\pi \cdot \left(r \cdot -1.3333333333333333\right)\right)\right)}{s} + \left(r \cdot \pi\right) \cdot 4\right) + -8 \cdot \left(\frac{t\_0 \cdot \left(\left(r \cdot -1.3333333333333333\right) \cdot -0.5\right) + \left(\left(\left(r \cdot \pi\right) \cdot -0.125\right) \cdot \left(\left(r \cdot r\right) \cdot \left(\left(r \cdot -1.3333333333333333\right) \cdot 0.5555555555555556\right)\right) + \pi \cdot \left(-0.041666666666666664 \cdot {r}^{4}\right)\right)}{s \cdot \left(s \cdot s\right)} + \frac{t\_0}{s \cdot s}\right)\right)} \end{array} \end{array} \]
(FPCore (s r)
 :precision binary32
 (let* ((t_0
         (+
          (* (* r PI) (* (* (* r r) 1.7777777777777777) -0.125))
          (* (* (* r r) (* PI 0.5555555555555556)) (* r 0.25)))))
   (/
    1.0
    (*
     s
     (+
      (+
       (/ (* -2.0 (* r (* PI (* r -1.3333333333333333)))) s)
       (* (* r PI) 4.0))
      (*
       -8.0
       (+
        (/
         (+
          (* t_0 (* (* r -1.3333333333333333) -0.5))
          (+
           (*
            (* (* r PI) -0.125)
            (* (* r r) (* (* r -1.3333333333333333) 0.5555555555555556)))
           (* PI (* -0.041666666666666664 (pow r 4.0)))))
         (* s (* s s)))
        (/ t_0 (* s s)))))))))
float code(float s, float r) {
	float t_0 = ((r * ((float) M_PI)) * (((r * r) * 1.7777777777777777f) * -0.125f)) + (((r * r) * (((float) M_PI) * 0.5555555555555556f)) * (r * 0.25f));
	return 1.0f / (s * ((((-2.0f * (r * (((float) M_PI) * (r * -1.3333333333333333f)))) / s) + ((r * ((float) M_PI)) * 4.0f)) + (-8.0f * ((((t_0 * ((r * -1.3333333333333333f) * -0.5f)) + ((((r * ((float) M_PI)) * -0.125f) * ((r * r) * ((r * -1.3333333333333333f) * 0.5555555555555556f))) + (((float) M_PI) * (-0.041666666666666664f * powf(r, 4.0f))))) / (s * (s * s))) + (t_0 / (s * s))))));
}
function code(s, r)
	t_0 = Float32(Float32(Float32(r * Float32(pi)) * Float32(Float32(Float32(r * r) * Float32(1.7777777777777777)) * Float32(-0.125))) + Float32(Float32(Float32(r * r) * Float32(Float32(pi) * Float32(0.5555555555555556))) * Float32(r * Float32(0.25))))
	return Float32(Float32(1.0) / Float32(s * Float32(Float32(Float32(Float32(Float32(-2.0) * Float32(r * Float32(Float32(pi) * Float32(r * Float32(-1.3333333333333333))))) / s) + Float32(Float32(r * Float32(pi)) * Float32(4.0))) + Float32(Float32(-8.0) * Float32(Float32(Float32(Float32(t_0 * Float32(Float32(r * Float32(-1.3333333333333333)) * Float32(-0.5))) + Float32(Float32(Float32(Float32(r * Float32(pi)) * Float32(-0.125)) * Float32(Float32(r * r) * Float32(Float32(r * Float32(-1.3333333333333333)) * Float32(0.5555555555555556)))) + Float32(Float32(pi) * Float32(Float32(-0.041666666666666664) * (r ^ Float32(4.0)))))) / Float32(s * Float32(s * s))) + Float32(t_0 / Float32(s * s)))))))
end
function tmp = code(s, r)
	t_0 = ((r * single(pi)) * (((r * r) * single(1.7777777777777777)) * single(-0.125))) + (((r * r) * (single(pi) * single(0.5555555555555556))) * (r * single(0.25)));
	tmp = single(1.0) / (s * ((((single(-2.0) * (r * (single(pi) * (r * single(-1.3333333333333333))))) / s) + ((r * single(pi)) * single(4.0))) + (single(-8.0) * ((((t_0 * ((r * single(-1.3333333333333333)) * single(-0.5))) + ((((r * single(pi)) * single(-0.125)) * ((r * r) * ((r * single(-1.3333333333333333)) * single(0.5555555555555556)))) + (single(pi) * (single(-0.041666666666666664) * (r ^ single(4.0)))))) / (s * (s * s))) + (t_0 / (s * s))))));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(r \cdot \pi\right) \cdot \left(\left(\left(r \cdot r\right) \cdot 1.7777777777777777\right) \cdot -0.125\right) + \left(\left(r \cdot r\right) \cdot \left(\pi \cdot 0.5555555555555556\right)\right) \cdot \left(r \cdot 0.25\right)\\
\frac{1}{s \cdot \left(\left(\frac{-2 \cdot \left(r \cdot \left(\pi \cdot \left(r \cdot -1.3333333333333333\right)\right)\right)}{s} + \left(r \cdot \pi\right) \cdot 4\right) + -8 \cdot \left(\frac{t\_0 \cdot \left(\left(r \cdot -1.3333333333333333\right) \cdot -0.5\right) + \left(\left(\left(r \cdot \pi\right) \cdot -0.125\right) \cdot \left(\left(r \cdot r\right) \cdot \left(\left(r \cdot -1.3333333333333333\right) \cdot 0.5555555555555556\right)\right) + \pi \cdot \left(-0.041666666666666664 \cdot {r}^{4}\right)\right)}{s \cdot \left(s \cdot s\right)} + \frac{t\_0}{s \cdot s}\right)\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\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. Simplified97.3%

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

    \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
  5. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    2. unsub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    3. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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}{18} \cdot \frac{{r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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{\frac{-1}{18} \cdot {r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    7. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left(\frac{-1}{18} \cdot {r}^{2}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left({r}^{2} \cdot \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left({r}^{2}\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left(r \cdot r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(r \cdot \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    13. *-lowering-*.f328.8%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \mathsf{*.f32}\left(r, \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
  6. Simplified8.8%

    \[\leadsto \frac{\frac{0.125}{r \cdot s} \cdot \left(e^{0 - \frac{r}{s}} + \color{blue}{\left(1 - \frac{\frac{\left(r \cdot r\right) \cdot -0.05555555555555555}{s} + r \cdot 0.3333333333333333}{s}\right)}\right)}{\pi} \]
  7. Step-by-step derivation
    1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{s \cdot \left(\left(\frac{-2 \cdot \left(r \cdot \left(\pi \cdot \left(r \cdot -1.3333333333333333\right)\right)\right)}{s} + \left(r \cdot \pi\right) \cdot 4\right) + -8 \cdot \left(\frac{\left(\left(r \cdot \pi\right) \cdot \left(\left(\left(r \cdot r\right) \cdot 1.7777777777777777\right) \cdot -0.125\right) + \left(\left(r \cdot r\right) \cdot \left(0.5555555555555556 \cdot \pi\right)\right) \cdot \left(r \cdot 0.25\right)\right) \cdot \left(\left(r \cdot -1.3333333333333333\right) \cdot -0.5\right) + \left(\left(-0.125 \cdot \left(r \cdot \pi\right)\right) \cdot \left(\left(r \cdot r\right) \cdot \left(0.5555555555555556 \cdot \left(r \cdot -1.3333333333333333\right)\right)\right) + \pi \cdot \left(-0.041666666666666664 \cdot {r}^{4}\right)\right)}{s \cdot \left(s \cdot s\right)} + \frac{\left(r \cdot \pi\right) \cdot \left(\left(\left(r \cdot r\right) \cdot 1.7777777777777777\right) \cdot -0.125\right) + \left(\left(r \cdot r\right) \cdot \left(0.5555555555555556 \cdot \pi\right)\right) \cdot \left(r \cdot 0.25\right)}{s \cdot s}\right)\right)}} \]
  11. Final simplification70.3%

    \[\leadsto \frac{1}{s \cdot \left(\left(\frac{-2 \cdot \left(r \cdot \left(\pi \cdot \left(r \cdot -1.3333333333333333\right)\right)\right)}{s} + \left(r \cdot \pi\right) \cdot 4\right) + -8 \cdot \left(\frac{\left(\left(r \cdot \pi\right) \cdot \left(\left(\left(r \cdot r\right) \cdot 1.7777777777777777\right) \cdot -0.125\right) + \left(\left(r \cdot r\right) \cdot \left(\pi \cdot 0.5555555555555556\right)\right) \cdot \left(r \cdot 0.25\right)\right) \cdot \left(\left(r \cdot -1.3333333333333333\right) \cdot -0.5\right) + \left(\left(\left(r \cdot \pi\right) \cdot -0.125\right) \cdot \left(\left(r \cdot r\right) \cdot \left(\left(r \cdot -1.3333333333333333\right) \cdot 0.5555555555555556\right)\right) + \pi \cdot \left(-0.041666666666666664 \cdot {r}^{4}\right)\right)}{s \cdot \left(s \cdot s\right)} + \frac{\left(r \cdot \pi\right) \cdot \left(\left(\left(r \cdot r\right) \cdot 1.7777777777777777\right) \cdot -0.125\right) + \left(\left(r \cdot r\right) \cdot \left(\pi \cdot 0.5555555555555556\right)\right) \cdot \left(r \cdot 0.25\right)}{s \cdot s}\right)\right)} \]
  12. Add Preprocessing

Alternative 6: 71.5% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(r \cdot 1.3333333333333333\right) \cdot \left(r \cdot 1.3333333333333333\right)\\ \frac{1}{s \cdot \left(\frac{\left(r \cdot \pi\right) \cdot \left(\left(r \cdot 1.3333333333333333\right) \cdot 2\right) + \frac{\left(r \cdot \left(\pi \cdot t\_0\right) - 2 \cdot \left(\left(r \cdot \pi\right) \cdot \left(r \cdot \left(r \cdot 0.5555555555555556\right)\right)\right)\right) - \frac{-8 \cdot \left(\left(r \cdot 1.3333333333333333\right) \cdot \left(-0.5 \cdot \left(\left(\left(r \cdot r\right) \cdot \left(\pi \cdot 0.5555555555555556\right)\right) \cdot \left(r \cdot 0.25\right) + \left(r \cdot \pi\right) \cdot \left(-0.125 \cdot t\_0\right)\right)\right) + \left(-0.125 \cdot \left(\left(r \cdot \pi\right) \cdot \left(\left(r \cdot r\right) \cdot \left(0.5555555555555556 \cdot \left(r \cdot 1.3333333333333333\right)\right)\right)\right) + \pi \cdot \left({r}^{4} \cdot 0.041666666666666664\right)\right)\right)}{s}}{s}}{s} - \left(r \cdot \pi\right) \cdot -4\right)} \end{array} \end{array} \]
(FPCore (s r)
 :precision binary32
 (let* ((t_0 (* (* r 1.3333333333333333) (* r 1.3333333333333333))))
   (/
    1.0
    (*
     s
     (-
      (/
       (+
        (* (* r PI) (* (* r 1.3333333333333333) 2.0))
        (/
         (-
          (-
           (* r (* PI t_0))
           (* 2.0 (* (* r PI) (* r (* r 0.5555555555555556)))))
          (/
           (*
            -8.0
            (+
             (*
              (* r 1.3333333333333333)
              (*
               -0.5
               (+
                (* (* (* r r) (* PI 0.5555555555555556)) (* r 0.25))
                (* (* r PI) (* -0.125 t_0)))))
             (+
              (*
               -0.125
               (*
                (* r PI)
                (* (* r r) (* 0.5555555555555556 (* r 1.3333333333333333)))))
              (* PI (* (pow r 4.0) 0.041666666666666664)))))
           s))
         s))
       s)
      (* (* r PI) -4.0))))))
float code(float s, float r) {
	float t_0 = (r * 1.3333333333333333f) * (r * 1.3333333333333333f);
	return 1.0f / (s * (((((r * ((float) M_PI)) * ((r * 1.3333333333333333f) * 2.0f)) + ((((r * (((float) M_PI) * t_0)) - (2.0f * ((r * ((float) M_PI)) * (r * (r * 0.5555555555555556f))))) - ((-8.0f * (((r * 1.3333333333333333f) * (-0.5f * ((((r * r) * (((float) M_PI) * 0.5555555555555556f)) * (r * 0.25f)) + ((r * ((float) M_PI)) * (-0.125f * t_0))))) + ((-0.125f * ((r * ((float) M_PI)) * ((r * r) * (0.5555555555555556f * (r * 1.3333333333333333f))))) + (((float) M_PI) * (powf(r, 4.0f) * 0.041666666666666664f))))) / s)) / s)) / s) - ((r * ((float) M_PI)) * -4.0f)));
}
function code(s, r)
	t_0 = Float32(Float32(r * Float32(1.3333333333333333)) * Float32(r * Float32(1.3333333333333333)))
	return Float32(Float32(1.0) / Float32(s * Float32(Float32(Float32(Float32(Float32(r * Float32(pi)) * Float32(Float32(r * Float32(1.3333333333333333)) * Float32(2.0))) + Float32(Float32(Float32(Float32(r * Float32(Float32(pi) * t_0)) - Float32(Float32(2.0) * Float32(Float32(r * Float32(pi)) * Float32(r * Float32(r * Float32(0.5555555555555556)))))) - Float32(Float32(Float32(-8.0) * Float32(Float32(Float32(r * Float32(1.3333333333333333)) * Float32(Float32(-0.5) * Float32(Float32(Float32(Float32(r * r) * Float32(Float32(pi) * Float32(0.5555555555555556))) * Float32(r * Float32(0.25))) + Float32(Float32(r * Float32(pi)) * Float32(Float32(-0.125) * t_0))))) + Float32(Float32(Float32(-0.125) * Float32(Float32(r * Float32(pi)) * Float32(Float32(r * r) * Float32(Float32(0.5555555555555556) * Float32(r * Float32(1.3333333333333333)))))) + Float32(Float32(pi) * Float32((r ^ Float32(4.0)) * Float32(0.041666666666666664)))))) / s)) / s)) / s) - Float32(Float32(r * Float32(pi)) * Float32(-4.0)))))
end
function tmp = code(s, r)
	t_0 = (r * single(1.3333333333333333)) * (r * single(1.3333333333333333));
	tmp = single(1.0) / (s * (((((r * single(pi)) * ((r * single(1.3333333333333333)) * single(2.0))) + ((((r * (single(pi) * t_0)) - (single(2.0) * ((r * single(pi)) * (r * (r * single(0.5555555555555556)))))) - ((single(-8.0) * (((r * single(1.3333333333333333)) * (single(-0.5) * ((((r * r) * (single(pi) * single(0.5555555555555556))) * (r * single(0.25))) + ((r * single(pi)) * (single(-0.125) * t_0))))) + ((single(-0.125) * ((r * single(pi)) * ((r * r) * (single(0.5555555555555556) * (r * single(1.3333333333333333)))))) + (single(pi) * ((r ^ single(4.0)) * single(0.041666666666666664)))))) / s)) / s)) / s) - ((r * single(pi)) * single(-4.0))));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(r \cdot 1.3333333333333333\right) \cdot \left(r \cdot 1.3333333333333333\right)\\
\frac{1}{s \cdot \left(\frac{\left(r \cdot \pi\right) \cdot \left(\left(r \cdot 1.3333333333333333\right) \cdot 2\right) + \frac{\left(r \cdot \left(\pi \cdot t\_0\right) - 2 \cdot \left(\left(r \cdot \pi\right) \cdot \left(r \cdot \left(r \cdot 0.5555555555555556\right)\right)\right)\right) - \frac{-8 \cdot \left(\left(r \cdot 1.3333333333333333\right) \cdot \left(-0.5 \cdot \left(\left(\left(r \cdot r\right) \cdot \left(\pi \cdot 0.5555555555555556\right)\right) \cdot \left(r \cdot 0.25\right) + \left(r \cdot \pi\right) \cdot \left(-0.125 \cdot t\_0\right)\right)\right) + \left(-0.125 \cdot \left(\left(r \cdot \pi\right) \cdot \left(\left(r \cdot r\right) \cdot \left(0.5555555555555556 \cdot \left(r \cdot 1.3333333333333333\right)\right)\right)\right) + \pi \cdot \left({r}^{4} \cdot 0.041666666666666664\right)\right)\right)}{s}}{s}}{s} - \left(r \cdot \pi\right) \cdot -4\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\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. Simplified97.3%

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

    \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
  5. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    2. unsub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    3. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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}{18} \cdot \frac{{r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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{\frac{-1}{18} \cdot {r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    7. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left(\frac{-1}{18} \cdot {r}^{2}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left({r}^{2} \cdot \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left({r}^{2}\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left(r \cdot r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(r \cdot \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    13. *-lowering-*.f328.8%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \mathsf{*.f32}\left(r, \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
  6. Simplified8.8%

    \[\leadsto \frac{\frac{0.125}{r \cdot s} \cdot \left(e^{0 - \frac{r}{s}} + \color{blue}{\left(1 - \frac{\frac{\left(r \cdot r\right) \cdot -0.05555555555555555}{s} + r \cdot 0.3333333333333333}{s}\right)}\right)}{\pi} \]
  7. Step-by-step derivation
    1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{\left(-s\right) \cdot \left(\left(r \cdot \pi\right) \cdot -4 - \frac{\left(r \cdot \pi\right) \cdot \left(\left(1.3333333333333333 \cdot r\right) \cdot 2\right) - \frac{\frac{-8 \cdot \left(\left(1.3333333333333333 \cdot r\right) \cdot \left(-0.5 \cdot \left(\left(\left(r \cdot r\right) \cdot \left(0.5555555555555556 \cdot \pi\right)\right) \cdot \left(r \cdot 0.25\right) + \left(r \cdot \pi\right) \cdot \left(\left(\left(1.3333333333333333 \cdot r\right) \cdot \left(1.3333333333333333 \cdot r\right)\right) \cdot -0.125\right)\right)\right) + \left(-0.125 \cdot \left(\left(r \cdot \pi\right) \cdot \left(\left(r \cdot r\right) \cdot \left(0.5555555555555556 \cdot \left(1.3333333333333333 \cdot r\right)\right)\right)\right) + \pi \cdot \left(0.041666666666666664 \cdot {r}^{4}\right)\right)\right)}{s} + \left(-1 \cdot \left(r \cdot \left(\pi \cdot \left(\left(1.3333333333333333 \cdot r\right) \cdot \left(1.3333333333333333 \cdot r\right)\right)\right)\right) + 2 \cdot \left(\left(r \cdot \pi\right) \cdot \left(r \cdot \left(r \cdot 0.5555555555555556\right)\right)\right)\right)}{s}}{s}\right)}} \]
  11. Final simplification66.4%

    \[\leadsto \frac{1}{s \cdot \left(\frac{\left(r \cdot \pi\right) \cdot \left(\left(r \cdot 1.3333333333333333\right) \cdot 2\right) + \frac{\left(r \cdot \left(\pi \cdot \left(\left(r \cdot 1.3333333333333333\right) \cdot \left(r \cdot 1.3333333333333333\right)\right)\right) - 2 \cdot \left(\left(r \cdot \pi\right) \cdot \left(r \cdot \left(r \cdot 0.5555555555555556\right)\right)\right)\right) - \frac{-8 \cdot \left(\left(r \cdot 1.3333333333333333\right) \cdot \left(-0.5 \cdot \left(\left(\left(r \cdot r\right) \cdot \left(\pi \cdot 0.5555555555555556\right)\right) \cdot \left(r \cdot 0.25\right) + \left(r \cdot \pi\right) \cdot \left(-0.125 \cdot \left(\left(r \cdot 1.3333333333333333\right) \cdot \left(r \cdot 1.3333333333333333\right)\right)\right)\right)\right) + \left(-0.125 \cdot \left(\left(r \cdot \pi\right) \cdot \left(\left(r \cdot r\right) \cdot \left(0.5555555555555556 \cdot \left(r \cdot 1.3333333333333333\right)\right)\right)\right) + \pi \cdot \left({r}^{4} \cdot 0.041666666666666664\right)\right)\right)}{s}}{s}}{s} - \left(r \cdot \pi\right) \cdot -4\right)} \]
  12. Add Preprocessing

Alternative 7: 62.4% accurate, 4.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;s \leq 1.999999936531045 \cdot 10^{-20}:\\ \;\;\;\;\frac{1}{s \cdot \left(\left(\frac{-2 \cdot \left(r \cdot \left(\pi \cdot \left(r \cdot -1.3333333333333333\right)\right)\right)}{s} + \left(r \cdot \pi\right) \cdot 4\right) + \frac{-8 \cdot \left(\left(r \cdot \pi\right) \cdot \left(\left(\left(r \cdot r\right) \cdot 1.7777777777777777\right) \cdot -0.125\right) + \left(\left(r \cdot r\right) \cdot \left(\pi \cdot 0.5555555555555556\right)\right) \cdot \left(r \cdot 0.25\right)\right)}{s \cdot s}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{r \cdot \left(\pi \cdot \left(r \cdot 2.6666666666666665 + s \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{\frac{\pi \cdot -0.08333333333333333}{s} \cdot 0.6666666666666666}{s} + \frac{\pi}{s \cdot s} \cdot 0.05092592592592592\right) \cdot \left(r \cdot -8\right) + 0.6666666666666666 \cdot \frac{\pi}{s}\right)\right)\right)}\\ \end{array} \end{array} \]
(FPCore (s r)
 :precision binary32
 (if (<= s 1.999999936531045e-20)
   (/
    1.0
    (*
     s
     (+
      (+
       (/ (* -2.0 (* r (* PI (* r -1.3333333333333333)))) s)
       (* (* r PI) 4.0))
      (/
       (*
        -8.0
        (+
         (* (* r PI) (* (* (* r r) 1.7777777777777777) -0.125))
         (* (* (* r r) (* PI 0.5555555555555556)) (* r 0.25))))
       (* s s)))))
   (/
    1.0
    (*
     r
     (+
      (* PI (+ (* r 2.6666666666666665) (* s 4.0)))
      (*
       r
       (*
        r
        (+
         (*
          (+
           (/ (* (/ (* PI -0.08333333333333333) s) 0.6666666666666666) s)
           (* (/ PI (* s s)) 0.05092592592592592))
          (* r -8.0))
         (* 0.6666666666666666 (/ PI s))))))))))
float code(float s, float r) {
	float tmp;
	if (s <= 1.999999936531045e-20f) {
		tmp = 1.0f / (s * ((((-2.0f * (r * (((float) M_PI) * (r * -1.3333333333333333f)))) / s) + ((r * ((float) M_PI)) * 4.0f)) + ((-8.0f * (((r * ((float) M_PI)) * (((r * r) * 1.7777777777777777f) * -0.125f)) + (((r * r) * (((float) M_PI) * 0.5555555555555556f)) * (r * 0.25f)))) / (s * s))));
	} else {
		tmp = 1.0f / (r * ((((float) M_PI) * ((r * 2.6666666666666665f) + (s * 4.0f))) + (r * (r * (((((((((float) M_PI) * -0.08333333333333333f) / s) * 0.6666666666666666f) / s) + ((((float) M_PI) / (s * s)) * 0.05092592592592592f)) * (r * -8.0f)) + (0.6666666666666666f * (((float) M_PI) / s)))))));
	}
	return tmp;
}
function code(s, r)
	tmp = Float32(0.0)
	if (s <= Float32(1.999999936531045e-20))
		tmp = Float32(Float32(1.0) / Float32(s * Float32(Float32(Float32(Float32(Float32(-2.0) * Float32(r * Float32(Float32(pi) * Float32(r * Float32(-1.3333333333333333))))) / s) + Float32(Float32(r * Float32(pi)) * Float32(4.0))) + Float32(Float32(Float32(-8.0) * Float32(Float32(Float32(r * Float32(pi)) * Float32(Float32(Float32(r * r) * Float32(1.7777777777777777)) * Float32(-0.125))) + Float32(Float32(Float32(r * r) * Float32(Float32(pi) * Float32(0.5555555555555556))) * Float32(r * Float32(0.25))))) / Float32(s * s)))));
	else
		tmp = Float32(Float32(1.0) / Float32(r * Float32(Float32(Float32(pi) * Float32(Float32(r * Float32(2.6666666666666665)) + Float32(s * Float32(4.0)))) + Float32(r * Float32(r * Float32(Float32(Float32(Float32(Float32(Float32(Float32(Float32(pi) * Float32(-0.08333333333333333)) / s) * Float32(0.6666666666666666)) / s) + Float32(Float32(Float32(pi) / Float32(s * s)) * Float32(0.05092592592592592))) * Float32(r * Float32(-8.0))) + Float32(Float32(0.6666666666666666) * Float32(Float32(pi) / s))))))));
	end
	return tmp
end
function tmp_2 = code(s, r)
	tmp = single(0.0);
	if (s <= single(1.999999936531045e-20))
		tmp = single(1.0) / (s * ((((single(-2.0) * (r * (single(pi) * (r * single(-1.3333333333333333))))) / s) + ((r * single(pi)) * single(4.0))) + ((single(-8.0) * (((r * single(pi)) * (((r * r) * single(1.7777777777777777)) * single(-0.125))) + (((r * r) * (single(pi) * single(0.5555555555555556))) * (r * single(0.25))))) / (s * s))));
	else
		tmp = single(1.0) / (r * ((single(pi) * ((r * single(2.6666666666666665)) + (s * single(4.0)))) + (r * (r * (((((((single(pi) * single(-0.08333333333333333)) / s) * single(0.6666666666666666)) / s) + ((single(pi) / (s * s)) * single(0.05092592592592592))) * (r * single(-8.0))) + (single(0.6666666666666666) * (single(pi) / s)))))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;s \leq 1.999999936531045 \cdot 10^{-20}:\\
\;\;\;\;\frac{1}{s \cdot \left(\left(\frac{-2 \cdot \left(r \cdot \left(\pi \cdot \left(r \cdot -1.3333333333333333\right)\right)\right)}{s} + \left(r \cdot \pi\right) \cdot 4\right) + \frac{-8 \cdot \left(\left(r \cdot \pi\right) \cdot \left(\left(\left(r \cdot r\right) \cdot 1.7777777777777777\right) \cdot -0.125\right) + \left(\left(r \cdot r\right) \cdot \left(\pi \cdot 0.5555555555555556\right)\right) \cdot \left(r \cdot 0.25\right)\right)}{s \cdot s}\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{r \cdot \left(\pi \cdot \left(r \cdot 2.6666666666666665 + s \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{\frac{\pi \cdot -0.08333333333333333}{s} \cdot 0.6666666666666666}{s} + \frac{\pi}{s \cdot s} \cdot 0.05092592592592592\right) \cdot \left(r \cdot -8\right) + 0.6666666666666666 \cdot \frac{\pi}{s}\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if s < 1.99999994e-20

    1. Initial program 100.0%

      \[\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. Simplified94.5%

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      2. unsub-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      3. --lowering--.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      5. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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}{18} \cdot \frac{{r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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{\frac{-1}{18} \cdot {r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      7. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left(\frac{-1}{18} \cdot {r}^{2}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left({r}^{2} \cdot \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left({r}^{2}\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left(r \cdot r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(r \cdot \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      13. *-lowering-*.f323.1%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \mathsf{*.f32}\left(r, \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. Simplified3.1%

      \[\leadsto \frac{\frac{0.125}{r \cdot s} \cdot \left(e^{0 - \frac{r}{s}} + \color{blue}{\left(1 - \frac{\frac{\left(r \cdot r\right) \cdot -0.05555555555555555}{s} + r \cdot 0.3333333333333333}{s}\right)}\right)}{\pi} \]
    7. Step-by-step derivation
      1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{s \cdot \left(\left(\frac{-2 \cdot \left(r \cdot \left(\pi \cdot \left(r \cdot -1.3333333333333333\right)\right)\right)}{s} + \left(r \cdot \pi\right) \cdot 4\right) + \frac{-8 \cdot \left(\left(r \cdot \pi\right) \cdot \left(\left(\left(r \cdot r\right) \cdot 1.7777777777777777\right) \cdot -0.125\right) + \left(\left(r \cdot r\right) \cdot \left(0.5555555555555556 \cdot \pi\right)\right) \cdot \left(r \cdot 0.25\right)\right)}{s \cdot s}\right)}} \]

    if 1.99999994e-20 < s

    1. Initial program 99.3%

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      2. unsub-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      3. --lowering--.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      5. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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}{18} \cdot \frac{{r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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{\frac{-1}{18} \cdot {r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      7. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left(\frac{-1}{18} \cdot {r}^{2}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left({r}^{2} \cdot \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left({r}^{2}\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left(r \cdot r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(r \cdot \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      13. *-lowering-*.f3213.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \mathsf{*.f32}\left(r, \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. Simplified13.0%

      \[\leadsto \frac{\frac{0.125}{r \cdot s} \cdot \left(e^{0 - \frac{r}{s}} + \color{blue}{\left(1 - \frac{\frac{\left(r \cdot r\right) \cdot -0.05555555555555555}{s} + r \cdot 0.3333333333333333}{s}\right)}\right)}{\pi} \]
    7. Step-by-step derivation
      1. clear-numN/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(r \cdot \left(4 \cdot \left(s \cdot \mathsf{PI}\left(\right)\right) + r \cdot \left(\frac{8}{3} \cdot \mathsf{PI}\left(\right) + r \cdot \left(-8 \cdot \left(r \cdot \left(\frac{-1}{24} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{5}{54} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{2}{3} \cdot \frac{\frac{-2}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{5}{36} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s}\right)\right)\right) + -8 \cdot \left(\frac{-2}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{5}{36} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right)\right)\right)\right)}\right) \]
    10. Simplified32.5%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(\pi \cdot \left(r \cdot 2.6666666666666665 + s \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{\frac{\pi \cdot -0.08333333333333333}{s} \cdot 0.6666666666666666}{s} + \frac{\pi}{s \cdot s} \cdot 0.05092592592592592\right) \cdot \left(r \cdot -8\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right)\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification58.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;s \leq 1.999999936531045 \cdot 10^{-20}:\\ \;\;\;\;\frac{1}{s \cdot \left(\left(\frac{-2 \cdot \left(r \cdot \left(\pi \cdot \left(r \cdot -1.3333333333333333\right)\right)\right)}{s} + \left(r \cdot \pi\right) \cdot 4\right) + \frac{-8 \cdot \left(\left(r \cdot \pi\right) \cdot \left(\left(\left(r \cdot r\right) \cdot 1.7777777777777777\right) \cdot -0.125\right) + \left(\left(r \cdot r\right) \cdot \left(\pi \cdot 0.5555555555555556\right)\right) \cdot \left(r \cdot 0.25\right)\right)}{s \cdot s}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{r \cdot \left(\pi \cdot \left(r \cdot 2.6666666666666665 + s \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{\frac{\pi \cdot -0.08333333333333333}{s} \cdot 0.6666666666666666}{s} + \frac{\pi}{s \cdot s} \cdot 0.05092592592592592\right) \cdot \left(r \cdot -8\right) + 0.6666666666666666 \cdot \frac{\pi}{s}\right)\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 34.4% accurate, 4.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.6666666666666666 \cdot \frac{\pi}{s}\\ \mathbf{if}\;s \leq 1.999999936531045 \cdot 10^{-20}:\\ \;\;\;\;\frac{1}{r \cdot \left(4 \cdot \left(s \cdot \pi\right) + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot t\_0\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{r \cdot \left(\pi \cdot \left(r \cdot 2.6666666666666665 + s \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{\frac{\pi \cdot -0.08333333333333333}{s} \cdot 0.6666666666666666}{s} + \frac{\pi}{s \cdot s} \cdot 0.05092592592592592\right) \cdot \left(r \cdot -8\right) + t\_0\right)\right)\right)}\\ \end{array} \end{array} \]
(FPCore (s r)
 :precision binary32
 (let* ((t_0 (* 0.6666666666666666 (/ PI s))))
   (if (<= s 1.999999936531045e-20)
     (/
      1.0
      (* r (+ (* 4.0 (* s PI)) (* r (+ (* PI 2.6666666666666665) (* r t_0))))))
     (/
      1.0
      (*
       r
       (+
        (* PI (+ (* r 2.6666666666666665) (* s 4.0)))
        (*
         r
         (*
          r
          (+
           (*
            (+
             (/ (* (/ (* PI -0.08333333333333333) s) 0.6666666666666666) s)
             (* (/ PI (* s s)) 0.05092592592592592))
            (* r -8.0))
           t_0)))))))))
float code(float s, float r) {
	float t_0 = 0.6666666666666666f * (((float) M_PI) / s);
	float tmp;
	if (s <= 1.999999936531045e-20f) {
		tmp = 1.0f / (r * ((4.0f * (s * ((float) M_PI))) + (r * ((((float) M_PI) * 2.6666666666666665f) + (r * t_0)))));
	} else {
		tmp = 1.0f / (r * ((((float) M_PI) * ((r * 2.6666666666666665f) + (s * 4.0f))) + (r * (r * (((((((((float) M_PI) * -0.08333333333333333f) / s) * 0.6666666666666666f) / s) + ((((float) M_PI) / (s * s)) * 0.05092592592592592f)) * (r * -8.0f)) + t_0)))));
	}
	return tmp;
}
function code(s, r)
	t_0 = Float32(Float32(0.6666666666666666) * Float32(Float32(pi) / s))
	tmp = Float32(0.0)
	if (s <= Float32(1.999999936531045e-20))
		tmp = Float32(Float32(1.0) / Float32(r * Float32(Float32(Float32(4.0) * Float32(s * Float32(pi))) + Float32(r * Float32(Float32(Float32(pi) * Float32(2.6666666666666665)) + Float32(r * t_0))))));
	else
		tmp = Float32(Float32(1.0) / Float32(r * Float32(Float32(Float32(pi) * Float32(Float32(r * Float32(2.6666666666666665)) + Float32(s * Float32(4.0)))) + Float32(r * Float32(r * Float32(Float32(Float32(Float32(Float32(Float32(Float32(Float32(pi) * Float32(-0.08333333333333333)) / s) * Float32(0.6666666666666666)) / s) + Float32(Float32(Float32(pi) / Float32(s * s)) * Float32(0.05092592592592592))) * Float32(r * Float32(-8.0))) + t_0))))));
	end
	return tmp
end
function tmp_2 = code(s, r)
	t_0 = single(0.6666666666666666) * (single(pi) / s);
	tmp = single(0.0);
	if (s <= single(1.999999936531045e-20))
		tmp = single(1.0) / (r * ((single(4.0) * (s * single(pi))) + (r * ((single(pi) * single(2.6666666666666665)) + (r * t_0)))));
	else
		tmp = single(1.0) / (r * ((single(pi) * ((r * single(2.6666666666666665)) + (s * single(4.0)))) + (r * (r * (((((((single(pi) * single(-0.08333333333333333)) / s) * single(0.6666666666666666)) / s) + ((single(pi) / (s * s)) * single(0.05092592592592592))) * (r * single(-8.0))) + t_0)))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.6666666666666666 \cdot \frac{\pi}{s}\\
\mathbf{if}\;s \leq 1.999999936531045 \cdot 10^{-20}:\\
\;\;\;\;\frac{1}{r \cdot \left(4 \cdot \left(s \cdot \pi\right) + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot t\_0\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{r \cdot \left(\pi \cdot \left(r \cdot 2.6666666666666665 + s \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{\frac{\pi \cdot -0.08333333333333333}{s} \cdot 0.6666666666666666}{s} + \frac{\pi}{s \cdot s} \cdot 0.05092592592592592\right) \cdot \left(r \cdot -8\right) + t\_0\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if s < 1.99999994e-20

    1. Initial program 100.0%

      \[\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. Simplified94.5%

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      2. unsub-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      3. --lowering--.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      5. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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}{18} \cdot \frac{{r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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{\frac{-1}{18} \cdot {r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      7. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left(\frac{-1}{18} \cdot {r}^{2}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left({r}^{2} \cdot \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left({r}^{2}\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left(r \cdot r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(r \cdot \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      13. *-lowering-*.f323.1%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \mathsf{*.f32}\left(r, \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. Simplified3.1%

      \[\leadsto \frac{\frac{0.125}{r \cdot s} \cdot \left(e^{0 - \frac{r}{s}} + \color{blue}{\left(1 - \frac{\frac{\left(r \cdot r\right) \cdot -0.05555555555555555}{s} + r \cdot 0.3333333333333333}{s}\right)}\right)}{\pi} \]
    7. Step-by-step derivation
      1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right), 4\right), \mathsf{*.f32}\left(r, \left(\frac{8}{3} \cdot \mathsf{PI}\left(\right) + r \cdot \color{blue}{\left(\left(\frac{-2}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{5}{36} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot -8\right)}\right)\right)\right)\right)\right) \]
    11. Simplified37.0%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(\left(s \cdot \pi\right) \cdot 4 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(\frac{\pi}{s} \cdot 0.6666666666666666\right)\right)\right)}} \]

    if 1.99999994e-20 < s

    1. Initial program 99.3%

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      2. unsub-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      3. --lowering--.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
      5. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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}{18} \cdot \frac{{r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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{\frac{-1}{18} \cdot {r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      7. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left(\frac{-1}{18} \cdot {r}^{2}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left({r}^{2} \cdot \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left({r}^{2}\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left(r \cdot r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(r \cdot \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
      13. *-lowering-*.f3213.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \mathsf{*.f32}\left(r, \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. Simplified13.0%

      \[\leadsto \frac{\frac{0.125}{r \cdot s} \cdot \left(e^{0 - \frac{r}{s}} + \color{blue}{\left(1 - \frac{\frac{\left(r \cdot r\right) \cdot -0.05555555555555555}{s} + r \cdot 0.3333333333333333}{s}\right)}\right)}{\pi} \]
    7. Step-by-step derivation
      1. clear-numN/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(r \cdot \left(4 \cdot \left(s \cdot \mathsf{PI}\left(\right)\right) + r \cdot \left(\frac{8}{3} \cdot \mathsf{PI}\left(\right) + r \cdot \left(-8 \cdot \left(r \cdot \left(\frac{-1}{24} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{5}{54} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{2}{3} \cdot \frac{\frac{-2}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{5}{36} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s}\right)\right)\right) + -8 \cdot \left(\frac{-2}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{5}{36} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right)\right)\right)\right)}\right) \]
    10. Simplified32.5%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(\pi \cdot \left(r \cdot 2.6666666666666665 + s \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{\frac{\pi \cdot -0.08333333333333333}{s} \cdot 0.6666666666666666}{s} + \frac{\pi}{s \cdot s} \cdot 0.05092592592592592\right) \cdot \left(r \cdot -8\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right)\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification34.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;s \leq 1.999999936531045 \cdot 10^{-20}:\\ \;\;\;\;\frac{1}{r \cdot \left(4 \cdot \left(s \cdot \pi\right) + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(0.6666666666666666 \cdot \frac{\pi}{s}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{r \cdot \left(\pi \cdot \left(r \cdot 2.6666666666666665 + s \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{\frac{\pi \cdot -0.08333333333333333}{s} \cdot 0.6666666666666666}{s} + \frac{\pi}{s \cdot s} \cdot 0.05092592592592592\right) \cdot \left(r \cdot -8\right) + 0.6666666666666666 \cdot \frac{\pi}{s}\right)\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 26.2% accurate, 10.0× speedup?

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

\\
\frac{1}{r \cdot \left(4 \cdot \left(s \cdot \pi\right) + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(0.6666666666666666 \cdot \frac{\pi}{s}\right)\right)\right)}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\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. Simplified97.3%

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

    \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
  5. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    2. unsub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    3. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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}{18} \cdot \frac{{r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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{\frac{-1}{18} \cdot {r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    7. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left(\frac{-1}{18} \cdot {r}^{2}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left({r}^{2} \cdot \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left({r}^{2}\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left(r \cdot r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(r \cdot \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    13. *-lowering-*.f328.8%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \mathsf{*.f32}\left(r, \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
  6. Simplified8.8%

    \[\leadsto \frac{\frac{0.125}{r \cdot s} \cdot \left(e^{0 - \frac{r}{s}} + \color{blue}{\left(1 - \frac{\frac{\left(r \cdot r\right) \cdot -0.05555555555555555}{s} + r \cdot 0.3333333333333333}{s}\right)}\right)}{\pi} \]
  7. Step-by-step derivation
    1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right), 4\right), \mathsf{*.f32}\left(r, \left(\frac{8}{3} \cdot \mathsf{PI}\left(\right) + r \cdot \color{blue}{\left(\left(\frac{-2}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{5}{36} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot -8\right)}\right)\right)\right)\right)\right) \]
  11. Simplified25.5%

    \[\leadsto \frac{1}{\color{blue}{r \cdot \left(\left(s \cdot \pi\right) \cdot 4 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(\frac{\pi}{s} \cdot 0.6666666666666666\right)\right)\right)}} \]
  12. Final simplification25.5%

    \[\leadsto \frac{1}{r \cdot \left(4 \cdot \left(s \cdot \pi\right) + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(0.6666666666666666 \cdot \frac{\pi}{s}\right)\right)\right)} \]
  13. Add Preprocessing

Alternative 10: 19.7% accurate, 11.0× speedup?

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

\\
\frac{1}{s \cdot \left(\frac{-2 \cdot \left(r \cdot \left(\pi \cdot \left(r \cdot -1.3333333333333333\right)\right)\right)}{s} + \left(r \cdot \pi\right) \cdot 4\right)}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\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. Simplified97.3%

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

    \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
  5. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    2. unsub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    3. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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}{18} \cdot \frac{{r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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{\frac{-1}{18} \cdot {r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    7. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left(\frac{-1}{18} \cdot {r}^{2}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left({r}^{2} \cdot \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left({r}^{2}\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left(r \cdot r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(r \cdot \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    13. *-lowering-*.f328.8%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \mathsf{*.f32}\left(r, \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
  6. Simplified8.8%

    \[\leadsto \frac{\frac{0.125}{r \cdot s} \cdot \left(e^{0 - \frac{r}{s}} + \color{blue}{\left(1 - \frac{\frac{\left(r \cdot r\right) \cdot -0.05555555555555555}{s} + r \cdot 0.3333333333333333}{s}\right)}\right)}{\pi} \]
  7. Step-by-step derivation
    1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{s \cdot \left(\frac{-2 \cdot \left(r \cdot \left(\pi \cdot \left(r \cdot -1.3333333333333333\right)\right)\right)}{s} + \left(r \cdot \pi\right) \cdot 4\right)}} \]
  12. Add Preprocessing

Alternative 11: 12.3% accurate, 17.8× speedup?

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

\\
\frac{1}{r \cdot \left(\pi \cdot \left(r \cdot 2.6666666666666665 + s \cdot 4\right)\right)}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\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. Simplified97.3%

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

    \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
  5. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    2. unsub-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    3. --lowering--.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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)\right), \mathsf{PI.f32}\left(\right)\right) \]
    5. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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}{18} \cdot \frac{{r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    6. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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{\frac{-1}{18} \cdot {r}^{2}}{s}\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    7. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left(\frac{-1}{18} \cdot {r}^{2}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\left({r}^{2} \cdot \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left({r}^{2}\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\left(r \cdot r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(\frac{1}{3} \cdot r\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \left(r \cdot \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
    13. *-lowering-*.f328.8%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(r, s\right)\right), \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(\mathsf{*.f32}\left(\mathsf{*.f32}\left(r, r\right), \frac{-1}{18}\right), s\right), \mathsf{*.f32}\left(r, \frac{1}{3}\right)\right), s\right)\right)\right)\right), \mathsf{PI.f32}\left(\right)\right) \]
  6. Simplified8.8%

    \[\leadsto \frac{\frac{0.125}{r \cdot s} \cdot \left(e^{0 - \frac{r}{s}} + \color{blue}{\left(1 - \frac{\frac{\left(r \cdot r\right) \cdot -0.05555555555555555}{s} + r \cdot 0.3333333333333333}{s}\right)}\right)}{\pi} \]
  7. Step-by-step derivation
    1. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \frac{8}{3}\right), \mathsf{*.f32}\left(s, \color{blue}{4}\right)\right)\right)\right)\right) \]
  11. Simplified10.8%

    \[\leadsto \frac{1}{\color{blue}{r \cdot \left(\pi \cdot \left(r \cdot 2.6666666666666665 + s \cdot 4\right)\right)}} \]
  12. Add Preprocessing

Alternative 12: 9.0% accurate, 25.7× speedup?

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

\\
\frac{1}{s} \cdot \frac{0.25}{r \cdot \pi}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\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 0

    \[\leadsto \color{blue}{\frac{\frac{1}{4}}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}} \]
  4. Step-by-step derivation
    1. /-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) \]
    2. *-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) \]
    3. *-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) \]
    4. PI-lowering-PI.f328.0%

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

    \[\leadsto \color{blue}{\frac{0.25}{r \cdot \left(s \cdot \pi\right)}} \]
  6. 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.f328.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(s \cdot \frac{\mathsf{PI}\left(\right) \cdot r}{\frac{1}{4}}\right)}^{-1} \]
    5. unpow-prod-downN/A

      \[\leadsto {s}^{-1} \cdot \color{blue}{{\left(\frac{\mathsf{PI}\left(\right) \cdot r}{\frac{1}{4}}\right)}^{-1}} \]
    6. inv-powN/A

      \[\leadsto \frac{1}{s} \cdot {\color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot r}{\frac{1}{4}}\right)}}^{-1} \]
    7. inv-powN/A

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

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

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

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

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

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

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

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

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

Alternative 13: 9.0% accurate, 33.0× speedup?

\[\begin{array}{l} \\ \frac{\frac{0.25}{r}}{s \cdot \pi} \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(Float32(0.25) / r) / Float32(s * Float32(pi)))
end
function tmp = code(s, r)
	tmp = (single(0.25) / r) / (s * single(pi));
end
\begin{array}{l}

\\
\frac{\frac{0.25}{r}}{s \cdot \pi}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\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 0

    \[\leadsto \color{blue}{\frac{\frac{1}{4}}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}} \]
  4. Step-by-step derivation
    1. /-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) \]
    2. *-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) \]
    3. *-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) \]
    4. PI-lowering-PI.f328.0%

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

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

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

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

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

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

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

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

Alternative 14: 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.6%

    \[\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 0

    \[\leadsto \color{blue}{\frac{\frac{1}{4}}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}} \]
  4. Step-by-step derivation
    1. /-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) \]
    2. *-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) \]
    3. *-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) \]
    4. PI-lowering-PI.f328.0%

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

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

Reproduce

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