Disney BSSRDF, PDF of scattering profile

Percentage Accurate: 99.6% → 99.6%
Time: 16.3s
Alternatives: 22
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 22 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.6% accurate, 1.0× speedup?

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

\\
\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r}
\end{array}

Alternative 1: 99.6% accurate, 0.7× speedup?

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

\\
\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \left(\pi \cdot \log e\right)} \cdot e^{\frac{\frac{r}{s}}{-3}}}}
\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. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
  4. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
  5. Step-by-step derivation
    1. add-log-expN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(r, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(r, s\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{8}, \mathsf{*.f32}\left(s, \log \left(e^{\mathsf{PI}\left(\right)}\right)\right)\right), \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(r, s\right), -3\right)\right)\right)\right)\right)\right) \]
    2. *-un-lft-identityN/A

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

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

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

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

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

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

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

Alternative 2: 99.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{0.125}{s \cdot \pi}\\
\frac{1}{\frac{r}{\frac{t\_0}{e^{\frac{r}{s}}} + t\_0 \cdot e^{\frac{\frac{r}{s}}{-3}}}}
\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. Add Preprocessing
  3. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
  4. Applied egg-rr99.7%

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

Alternative 3: 99.6% accurate, 1.0× speedup?

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

\\
\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} + \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{r \cdot \pi} \cdot \frac{0.125}{s}
\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. Step-by-step derivation
    1. times-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.6% accurate, 1.0× speedup?

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

\\
\frac{\frac{0.125}{\left(s \cdot \pi\right) \cdot e^{\frac{r}{s}}} + 0.125 \cdot \frac{e^{\frac{r}{s} \cdot -0.3333333333333333}}{s \cdot \pi}}{r}
\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. Applied egg-rr99.6%

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

    \[\leadsto \color{blue}{\frac{\frac{1}{8} \cdot \frac{1}{r \cdot \left(\mathsf{PI}\left(\right) \cdot e^{\frac{r}{s}}\right)} - \frac{-1}{8} \cdot \frac{e^{\frac{-1}{3} \cdot \frac{r}{s}}}{r \cdot \mathsf{PI}\left(\right)}}{s}} \]
  5. Simplified99.6%

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

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

Alternative 5: 99.5% accurate, 1.0× speedup?

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

\\
\frac{1}{\frac{r}{\frac{0.125}{s \cdot \pi} \cdot \left(e^{\frac{\frac{r}{s}}{-3}} + e^{0 - \frac{r}{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. Add Preprocessing
  3. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
  4. Applied egg-rr99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.6% accurate, 1.1× speedup?

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

\\
\frac{\frac{0.125}{s \cdot \pi} \cdot \left(e^{\frac{\frac{r}{s}}{-3}} + e^{0 - \frac{r}{s}}\right)}{r}
\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. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
  4. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
  5. Step-by-step derivation
    1. clear-numN/A

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

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

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

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

Alternative 7: 79.8% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\pi \cdot 0.7407407407407407}{s}\\ t_1 := \frac{\pi}{s} \cdot 0.6666666666666666\\ t_2 := \frac{\pi}{s} \cdot -0.4444444444444444\\ t_3 := s \cdot \left(\pi \cdot 4\right)\\ \mathbf{if}\;s \leq 4.9999998413276127 \cdot 10^{-20}:\\ \;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(r \cdot \left(r \cdot \left(\frac{\pi}{s \cdot s} \cdot 0.04938271604938271\right) + t\_1\right) + \pi \cdot 2.6666666666666665\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_1 + r \cdot \left(\left(\left(\frac{t\_2}{s} + \frac{0.7407407407407407}{s \cdot \frac{s}{\pi}}\right) \cdot \frac{t\_2 - t\_0}{s}\right) \cdot \frac{1}{\frac{t\_0 - t\_2}{s}} - \frac{\pi \cdot -0.345679012345679}{s \cdot s}\right)\right)\right)\right)}\\ \end{array} \end{array} \]
(FPCore (s r)
 :precision binary32
 (let* ((t_0 (/ (* PI 0.7407407407407407) s))
        (t_1 (* (/ PI s) 0.6666666666666666))
        (t_2 (* (/ PI s) -0.4444444444444444))
        (t_3 (* s (* PI 4.0))))
   (if (<= s 4.9999998413276127e-20)
     (/
      1.0
      (*
       r
       (+
        t_3
        (*
         r
         (+
          (* r (+ (* r (* (/ PI (* s s)) 0.04938271604938271)) t_1))
          (* PI 2.6666666666666665))))))
     (/
      1.0
      (*
       r
       (+
        t_3
        (*
         r
         (+
          (* PI 2.6666666666666665)
          (*
           r
           (+
            t_1
            (*
             r
             (-
              (*
               (*
                (+ (/ t_2 s) (/ 0.7407407407407407 (* s (/ s PI))))
                (/ (- t_2 t_0) s))
               (/ 1.0 (/ (- t_0 t_2) s)))
              (/ (* PI -0.345679012345679) (* s s))))))))))))))
float code(float s, float r) {
	float t_0 = (((float) M_PI) * 0.7407407407407407f) / s;
	float t_1 = (((float) M_PI) / s) * 0.6666666666666666f;
	float t_2 = (((float) M_PI) / s) * -0.4444444444444444f;
	float t_3 = s * (((float) M_PI) * 4.0f);
	float tmp;
	if (s <= 4.9999998413276127e-20f) {
		tmp = 1.0f / (r * (t_3 + (r * ((r * ((r * ((((float) M_PI) / (s * s)) * 0.04938271604938271f)) + t_1)) + (((float) M_PI) * 2.6666666666666665f)))));
	} else {
		tmp = 1.0f / (r * (t_3 + (r * ((((float) M_PI) * 2.6666666666666665f) + (r * (t_1 + (r * (((((t_2 / s) + (0.7407407407407407f / (s * (s / ((float) M_PI))))) * ((t_2 - t_0) / s)) * (1.0f / ((t_0 - t_2) / s))) - ((((float) M_PI) * -0.345679012345679f) / (s * s))))))))));
	}
	return tmp;
}
function code(s, r)
	t_0 = Float32(Float32(Float32(pi) * Float32(0.7407407407407407)) / s)
	t_1 = Float32(Float32(Float32(pi) / s) * Float32(0.6666666666666666))
	t_2 = Float32(Float32(Float32(pi) / s) * Float32(-0.4444444444444444))
	t_3 = Float32(s * Float32(Float32(pi) * Float32(4.0)))
	tmp = Float32(0.0)
	if (s <= Float32(4.9999998413276127e-20))
		tmp = Float32(Float32(1.0) / Float32(r * Float32(t_3 + Float32(r * Float32(Float32(r * Float32(Float32(r * Float32(Float32(Float32(pi) / Float32(s * s)) * Float32(0.04938271604938271))) + t_1)) + Float32(Float32(pi) * Float32(2.6666666666666665)))))));
	else
		tmp = Float32(Float32(1.0) / Float32(r * Float32(t_3 + Float32(r * Float32(Float32(Float32(pi) * Float32(2.6666666666666665)) + Float32(r * Float32(t_1 + Float32(r * Float32(Float32(Float32(Float32(Float32(t_2 / s) + Float32(Float32(0.7407407407407407) / Float32(s * Float32(s / Float32(pi))))) * Float32(Float32(t_2 - t_0) / s)) * Float32(Float32(1.0) / Float32(Float32(t_0 - t_2) / s))) - Float32(Float32(Float32(pi) * Float32(-0.345679012345679)) / Float32(s * s)))))))))));
	end
	return tmp
end
function tmp_2 = code(s, r)
	t_0 = (single(pi) * single(0.7407407407407407)) / s;
	t_1 = (single(pi) / s) * single(0.6666666666666666);
	t_2 = (single(pi) / s) * single(-0.4444444444444444);
	t_3 = s * (single(pi) * single(4.0));
	tmp = single(0.0);
	if (s <= single(4.9999998413276127e-20))
		tmp = single(1.0) / (r * (t_3 + (r * ((r * ((r * ((single(pi) / (s * s)) * single(0.04938271604938271))) + t_1)) + (single(pi) * single(2.6666666666666665))))));
	else
		tmp = single(1.0) / (r * (t_3 + (r * ((single(pi) * single(2.6666666666666665)) + (r * (t_1 + (r * (((((t_2 / s) + (single(0.7407407407407407) / (s * (s / single(pi))))) * ((t_2 - t_0) / s)) * (single(1.0) / ((t_0 - t_2) / s))) - ((single(pi) * single(-0.345679012345679)) / (s * s))))))))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\pi \cdot 0.7407407407407407}{s}\\
t_1 := \frac{\pi}{s} \cdot 0.6666666666666666\\
t_2 := \frac{\pi}{s} \cdot -0.4444444444444444\\
t_3 := s \cdot \left(\pi \cdot 4\right)\\
\mathbf{if}\;s \leq 4.9999998413276127 \cdot 10^{-20}:\\
\;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(r \cdot \left(r \cdot \left(\frac{\pi}{s \cdot s} \cdot 0.04938271604938271\right) + t\_1\right) + \pi \cdot 2.6666666666666665\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_1 + r \cdot \left(\left(\left(\frac{t\_2}{s} + \frac{0.7407407407407407}{s \cdot \frac{s}{\pi}}\right) \cdot \frac{t\_2 - t\_0}{s}\right) \cdot \frac{1}{\frac{t\_0 - t\_2}{s}} - \frac{\pi \cdot -0.345679012345679}{s \cdot s}\right)\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if s < 4.99999984e-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. Add Preprocessing
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified-0.0%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Taylor expanded in r around 0

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\left(\mathsf{neg}\left(r \cdot \left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      2. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      5. distribute-rgt-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      6. distribute-lft-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      7. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      10. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      11. unpow2N/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      13. metadata-evalN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\frac{-4}{81}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    9. Simplified100.0%

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

    if 4.99999984e-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. Add Preprocessing
    3. Applied egg-rr99.3%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr99.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified33.5%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Step-by-step derivation
      1. flip-+N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\frac{\frac{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}{s} \cdot \frac{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}{s} - \frac{\frac{20}{27} \cdot \mathsf{PI}\left(\right)}{s \cdot s} \cdot \frac{\frac{20}{27} \cdot \mathsf{PI}\left(\right)}{s \cdot s}}{\frac{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}{s} - \frac{\frac{20}{27} \cdot \mathsf{PI}\left(\right)}{s \cdot s}}\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      2. div-invN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \mathsf{*.f32}\left(\left(\frac{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}{s} \cdot \frac{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}{s} - \frac{\frac{20}{27} \cdot \mathsf{PI}\left(\right)}{s \cdot s} \cdot \frac{\frac{20}{27} \cdot \mathsf{PI}\left(\right)}{s \cdot s}\right), \left(\frac{1}{\frac{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}{s} - \frac{\frac{20}{27} \cdot \mathsf{PI}\left(\right)}{s \cdot s}}\right)\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr60.8%

      \[\leadsto \frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \color{blue}{\left(\left(\frac{\frac{\pi}{s} \cdot -0.4444444444444444}{s} + \frac{0.7407407407407407}{s \cdot \frac{s}{\pi}}\right) \cdot \frac{\frac{\pi}{s} \cdot -0.4444444444444444 - \frac{\pi \cdot 0.7407407407407407}{s}}{s}\right) \cdot \frac{1}{\frac{\frac{\pi}{s} \cdot -0.4444444444444444 - \frac{\pi \cdot 0.7407407407407407}{s}}{s}}}\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.0%

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

Alternative 8: 79.8% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\pi \cdot 0.7407407407407407}{s}\\ t_1 := \frac{\pi}{s} \cdot 0.6666666666666666\\ t_2 := \frac{\pi}{s} \cdot -0.4444444444444444\\ t_3 := s \cdot \left(\pi \cdot 4\right)\\ \mathbf{if}\;s \leq 4.9999998413276127 \cdot 10^{-20}:\\ \;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(r \cdot \left(r \cdot \left(\frac{\pi}{s \cdot s} \cdot 0.04938271604938271\right) + t\_1\right) + \pi \cdot 2.6666666666666665\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_1 + r \cdot \left(\frac{\left(\frac{t\_2}{s} + \frac{0.7407407407407407}{s \cdot \frac{s}{\pi}}\right) \cdot \frac{t\_2 - t\_0}{s}}{\frac{t\_0 - t\_2}{s}} - \frac{\pi \cdot -0.345679012345679}{s \cdot s}\right)\right)\right)\right)}\\ \end{array} \end{array} \]
(FPCore (s r)
 :precision binary32
 (let* ((t_0 (/ (* PI 0.7407407407407407) s))
        (t_1 (* (/ PI s) 0.6666666666666666))
        (t_2 (* (/ PI s) -0.4444444444444444))
        (t_3 (* s (* PI 4.0))))
   (if (<= s 4.9999998413276127e-20)
     (/
      1.0
      (*
       r
       (+
        t_3
        (*
         r
         (+
          (* r (+ (* r (* (/ PI (* s s)) 0.04938271604938271)) t_1))
          (* PI 2.6666666666666665))))))
     (/
      1.0
      (*
       r
       (+
        t_3
        (*
         r
         (+
          (* PI 2.6666666666666665)
          (*
           r
           (+
            t_1
            (*
             r
             (-
              (/
               (*
                (+ (/ t_2 s) (/ 0.7407407407407407 (* s (/ s PI))))
                (/ (- t_2 t_0) s))
               (/ (- t_0 t_2) s))
              (/ (* PI -0.345679012345679) (* s s))))))))))))))
float code(float s, float r) {
	float t_0 = (((float) M_PI) * 0.7407407407407407f) / s;
	float t_1 = (((float) M_PI) / s) * 0.6666666666666666f;
	float t_2 = (((float) M_PI) / s) * -0.4444444444444444f;
	float t_3 = s * (((float) M_PI) * 4.0f);
	float tmp;
	if (s <= 4.9999998413276127e-20f) {
		tmp = 1.0f / (r * (t_3 + (r * ((r * ((r * ((((float) M_PI) / (s * s)) * 0.04938271604938271f)) + t_1)) + (((float) M_PI) * 2.6666666666666665f)))));
	} else {
		tmp = 1.0f / (r * (t_3 + (r * ((((float) M_PI) * 2.6666666666666665f) + (r * (t_1 + (r * (((((t_2 / s) + (0.7407407407407407f / (s * (s / ((float) M_PI))))) * ((t_2 - t_0) / s)) / ((t_0 - t_2) / s)) - ((((float) M_PI) * -0.345679012345679f) / (s * s))))))))));
	}
	return tmp;
}
function code(s, r)
	t_0 = Float32(Float32(Float32(pi) * Float32(0.7407407407407407)) / s)
	t_1 = Float32(Float32(Float32(pi) / s) * Float32(0.6666666666666666))
	t_2 = Float32(Float32(Float32(pi) / s) * Float32(-0.4444444444444444))
	t_3 = Float32(s * Float32(Float32(pi) * Float32(4.0)))
	tmp = Float32(0.0)
	if (s <= Float32(4.9999998413276127e-20))
		tmp = Float32(Float32(1.0) / Float32(r * Float32(t_3 + Float32(r * Float32(Float32(r * Float32(Float32(r * Float32(Float32(Float32(pi) / Float32(s * s)) * Float32(0.04938271604938271))) + t_1)) + Float32(Float32(pi) * Float32(2.6666666666666665)))))));
	else
		tmp = Float32(Float32(1.0) / Float32(r * Float32(t_3 + Float32(r * Float32(Float32(Float32(pi) * Float32(2.6666666666666665)) + Float32(r * Float32(t_1 + Float32(r * Float32(Float32(Float32(Float32(Float32(t_2 / s) + Float32(Float32(0.7407407407407407) / Float32(s * Float32(s / Float32(pi))))) * Float32(Float32(t_2 - t_0) / s)) / Float32(Float32(t_0 - t_2) / s)) - Float32(Float32(Float32(pi) * Float32(-0.345679012345679)) / Float32(s * s)))))))))));
	end
	return tmp
end
function tmp_2 = code(s, r)
	t_0 = (single(pi) * single(0.7407407407407407)) / s;
	t_1 = (single(pi) / s) * single(0.6666666666666666);
	t_2 = (single(pi) / s) * single(-0.4444444444444444);
	t_3 = s * (single(pi) * single(4.0));
	tmp = single(0.0);
	if (s <= single(4.9999998413276127e-20))
		tmp = single(1.0) / (r * (t_3 + (r * ((r * ((r * ((single(pi) / (s * s)) * single(0.04938271604938271))) + t_1)) + (single(pi) * single(2.6666666666666665))))));
	else
		tmp = single(1.0) / (r * (t_3 + (r * ((single(pi) * single(2.6666666666666665)) + (r * (t_1 + (r * (((((t_2 / s) + (single(0.7407407407407407) / (s * (s / single(pi))))) * ((t_2 - t_0) / s)) / ((t_0 - t_2) / s)) - ((single(pi) * single(-0.345679012345679)) / (s * s))))))))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\pi \cdot 0.7407407407407407}{s}\\
t_1 := \frac{\pi}{s} \cdot 0.6666666666666666\\
t_2 := \frac{\pi}{s} \cdot -0.4444444444444444\\
t_3 := s \cdot \left(\pi \cdot 4\right)\\
\mathbf{if}\;s \leq 4.9999998413276127 \cdot 10^{-20}:\\
\;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(r \cdot \left(r \cdot \left(\frac{\pi}{s \cdot s} \cdot 0.04938271604938271\right) + t\_1\right) + \pi \cdot 2.6666666666666665\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_1 + r \cdot \left(\frac{\left(\frac{t\_2}{s} + \frac{0.7407407407407407}{s \cdot \frac{s}{\pi}}\right) \cdot \frac{t\_2 - t\_0}{s}}{\frac{t\_0 - t\_2}{s}} - \frac{\pi \cdot -0.345679012345679}{s \cdot s}\right)\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if s < 4.99999984e-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. Add Preprocessing
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified-0.0%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Taylor expanded in r around 0

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\left(\mathsf{neg}\left(r \cdot \left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      2. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      5. distribute-rgt-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      6. distribute-lft-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      7. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      10. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      11. unpow2N/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      13. metadata-evalN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\frac{-4}{81}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    9. Simplified100.0%

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

    if 4.99999984e-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. Add Preprocessing
    3. Applied egg-rr99.3%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr99.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified33.5%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Step-by-step derivation
      1. flip-+N/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \mathsf{/.f32}\left(\left(\frac{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}{s} \cdot \frac{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}{s} - \frac{\frac{20}{27} \cdot \mathsf{PI}\left(\right)}{s \cdot s} \cdot \frac{\frac{20}{27} \cdot \mathsf{PI}\left(\right)}{s \cdot s}\right), \left(\frac{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}{s} - \frac{\frac{20}{27} \cdot \mathsf{PI}\left(\right)}{s \cdot s}\right)\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr60.8%

      \[\leadsto \frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \color{blue}{\frac{\left(\frac{\frac{\pi}{s} \cdot -0.4444444444444444}{s} + \frac{0.7407407407407407}{s \cdot \frac{s}{\pi}}\right) \cdot \frac{\frac{\pi}{s} \cdot -0.4444444444444444 - \frac{\pi \cdot 0.7407407407407407}{s}}{s}}{\frac{\frac{\pi}{s} \cdot -0.4444444444444444 - \frac{\pi \cdot 0.7407407407407407}{s}}{s}}}\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.0%

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

Alternative 9: 80.7% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{s \cdot s}{\pi \cdot -0.345679012345679}\\ t_1 := s \cdot \left(s \cdot s\right)\\ t_2 := \frac{\pi}{s} \cdot 0.6666666666666666\\ t_3 := s \cdot \left(\pi \cdot 4\right)\\ t_4 := \left(s \cdot s\right) \cdot \left(\frac{\pi}{s} \cdot -0.4444444444444444\right) + \left(s \cdot \pi\right) \cdot 0.7407407407407407\\ \mathbf{if}\;s \leq 4.9999998413276127 \cdot 10^{-20}:\\ \;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(r \cdot \left(r \cdot \left(\frac{\pi}{s \cdot s} \cdot 0.04938271604938271\right) + t\_2\right) + \pi \cdot 2.6666666666666665\right)\right)}\\ \mathbf{elif}\;s \leq 1.0000000036274937 \cdot 10^{-15}:\\ \;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_2 - r \cdot \left(\frac{\pi \cdot -0.345679012345679}{s \cdot s} + \frac{t\_4}{t\_1}\right)\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_2 - r \cdot \frac{t\_1 + t\_4 \cdot t\_0}{t\_1 \cdot t\_0}\right)\right)\right)}\\ \end{array} \end{array} \]
(FPCore (s r)
 :precision binary32
 (let* ((t_0 (/ (* s s) (* PI -0.345679012345679)))
        (t_1 (* s (* s s)))
        (t_2 (* (/ PI s) 0.6666666666666666))
        (t_3 (* s (* PI 4.0)))
        (t_4
         (+
          (* (* s s) (* (/ PI s) -0.4444444444444444))
          (* (* s PI) 0.7407407407407407))))
   (if (<= s 4.9999998413276127e-20)
     (/
      1.0
      (*
       r
       (+
        t_3
        (*
         r
         (+
          (* r (+ (* r (* (/ PI (* s s)) 0.04938271604938271)) t_2))
          (* PI 2.6666666666666665))))))
     (if (<= s 1.0000000036274937e-15)
       (/
        1.0
        (*
         r
         (+
          t_3
          (*
           r
           (+
            (* PI 2.6666666666666665)
            (*
             r
             (-
              t_2
              (*
               r
               (+ (/ (* PI -0.345679012345679) (* s s)) (/ t_4 t_1))))))))))
       (/
        1.0
        (*
         r
         (+
          t_3
          (*
           r
           (+
            (* PI 2.6666666666666665)
            (* r (- t_2 (* r (/ (+ t_1 (* t_4 t_0)) (* t_1 t_0))))))))))))))
float code(float s, float r) {
	float t_0 = (s * s) / (((float) M_PI) * -0.345679012345679f);
	float t_1 = s * (s * s);
	float t_2 = (((float) M_PI) / s) * 0.6666666666666666f;
	float t_3 = s * (((float) M_PI) * 4.0f);
	float t_4 = ((s * s) * ((((float) M_PI) / s) * -0.4444444444444444f)) + ((s * ((float) M_PI)) * 0.7407407407407407f);
	float tmp;
	if (s <= 4.9999998413276127e-20f) {
		tmp = 1.0f / (r * (t_3 + (r * ((r * ((r * ((((float) M_PI) / (s * s)) * 0.04938271604938271f)) + t_2)) + (((float) M_PI) * 2.6666666666666665f)))));
	} else if (s <= 1.0000000036274937e-15f) {
		tmp = 1.0f / (r * (t_3 + (r * ((((float) M_PI) * 2.6666666666666665f) + (r * (t_2 - (r * (((((float) M_PI) * -0.345679012345679f) / (s * s)) + (t_4 / t_1)))))))));
	} else {
		tmp = 1.0f / (r * (t_3 + (r * ((((float) M_PI) * 2.6666666666666665f) + (r * (t_2 - (r * ((t_1 + (t_4 * t_0)) / (t_1 * t_0)))))))));
	}
	return tmp;
}
function code(s, r)
	t_0 = Float32(Float32(s * s) / Float32(Float32(pi) * Float32(-0.345679012345679)))
	t_1 = Float32(s * Float32(s * s))
	t_2 = Float32(Float32(Float32(pi) / s) * Float32(0.6666666666666666))
	t_3 = Float32(s * Float32(Float32(pi) * Float32(4.0)))
	t_4 = Float32(Float32(Float32(s * s) * Float32(Float32(Float32(pi) / s) * Float32(-0.4444444444444444))) + Float32(Float32(s * Float32(pi)) * Float32(0.7407407407407407)))
	tmp = Float32(0.0)
	if (s <= Float32(4.9999998413276127e-20))
		tmp = Float32(Float32(1.0) / Float32(r * Float32(t_3 + Float32(r * Float32(Float32(r * Float32(Float32(r * Float32(Float32(Float32(pi) / Float32(s * s)) * Float32(0.04938271604938271))) + t_2)) + Float32(Float32(pi) * Float32(2.6666666666666665)))))));
	elseif (s <= Float32(1.0000000036274937e-15))
		tmp = Float32(Float32(1.0) / Float32(r * Float32(t_3 + Float32(r * Float32(Float32(Float32(pi) * Float32(2.6666666666666665)) + Float32(r * Float32(t_2 - Float32(r * Float32(Float32(Float32(Float32(pi) * Float32(-0.345679012345679)) / Float32(s * s)) + Float32(t_4 / t_1))))))))));
	else
		tmp = Float32(Float32(1.0) / Float32(r * Float32(t_3 + Float32(r * Float32(Float32(Float32(pi) * Float32(2.6666666666666665)) + Float32(r * Float32(t_2 - Float32(r * Float32(Float32(t_1 + Float32(t_4 * t_0)) / Float32(t_1 * t_0))))))))));
	end
	return tmp
end
function tmp_2 = code(s, r)
	t_0 = (s * s) / (single(pi) * single(-0.345679012345679));
	t_1 = s * (s * s);
	t_2 = (single(pi) / s) * single(0.6666666666666666);
	t_3 = s * (single(pi) * single(4.0));
	t_4 = ((s * s) * ((single(pi) / s) * single(-0.4444444444444444))) + ((s * single(pi)) * single(0.7407407407407407));
	tmp = single(0.0);
	if (s <= single(4.9999998413276127e-20))
		tmp = single(1.0) / (r * (t_3 + (r * ((r * ((r * ((single(pi) / (s * s)) * single(0.04938271604938271))) + t_2)) + (single(pi) * single(2.6666666666666665))))));
	elseif (s <= single(1.0000000036274937e-15))
		tmp = single(1.0) / (r * (t_3 + (r * ((single(pi) * single(2.6666666666666665)) + (r * (t_2 - (r * (((single(pi) * single(-0.345679012345679)) / (s * s)) + (t_4 / t_1)))))))));
	else
		tmp = single(1.0) / (r * (t_3 + (r * ((single(pi) * single(2.6666666666666665)) + (r * (t_2 - (r * ((t_1 + (t_4 * t_0)) / (t_1 * t_0)))))))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{s \cdot s}{\pi \cdot -0.345679012345679}\\
t_1 := s \cdot \left(s \cdot s\right)\\
t_2 := \frac{\pi}{s} \cdot 0.6666666666666666\\
t_3 := s \cdot \left(\pi \cdot 4\right)\\
t_4 := \left(s \cdot s\right) \cdot \left(\frac{\pi}{s} \cdot -0.4444444444444444\right) + \left(s \cdot \pi\right) \cdot 0.7407407407407407\\
\mathbf{if}\;s \leq 4.9999998413276127 \cdot 10^{-20}:\\
\;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(r \cdot \left(r \cdot \left(\frac{\pi}{s \cdot s} \cdot 0.04938271604938271\right) + t\_2\right) + \pi \cdot 2.6666666666666665\right)\right)}\\

\mathbf{elif}\;s \leq 1.0000000036274937 \cdot 10^{-15}:\\
\;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_2 - r \cdot \left(\frac{\pi \cdot -0.345679012345679}{s \cdot s} + \frac{t\_4}{t\_1}\right)\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{r \cdot \left(t\_3 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_2 - r \cdot \frac{t\_1 + t\_4 \cdot t\_0}{t\_1 \cdot t\_0}\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if s < 4.99999984e-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. Add Preprocessing
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified-0.0%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Taylor expanded in r around 0

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\left(\mathsf{neg}\left(r \cdot \left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      2. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      5. distribute-rgt-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      6. distribute-lft-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      7. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      10. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      11. unpow2N/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      13. metadata-evalN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\frac{-4}{81}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    9. Simplified100.0%

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

    if 4.99999984e-20 < s < 1e-15

    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. Add Preprocessing
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified50.3%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Step-by-step derivation
      1. frac-addN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \mathsf{/.f32}\left(\left(\left(\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}\right) \cdot \left(s \cdot s\right) + s \cdot \left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)\right), \left(s \cdot \left(s \cdot s\right)\right)\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr100.0%

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

    if 1e-15 < s

    1. Initial program 99.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. Add Preprocessing
    3. Applied egg-rr99.1%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr99.2%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified28.4%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left(\left(\frac{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}{s} + \frac{\frac{20}{27} \cdot \mathsf{PI}\left(\right)}{s \cdot s}\right) + \frac{\frac{-28}{81} \cdot \mathsf{PI}\left(\right)}{s \cdot s}\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      2. frac-addN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left(\frac{\left(\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}\right) \cdot \left(s \cdot s\right) + s \cdot \left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)}{s \cdot \left(s \cdot s\right)} + \frac{\frac{-28}{81} \cdot \mathsf{PI}\left(\right)}{s \cdot s}\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      3. clear-numN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left(\frac{\left(\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}\right) \cdot \left(s \cdot s\right) + s \cdot \left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)}{s \cdot \left(s \cdot s\right)} + \frac{1}{\frac{s \cdot s}{\frac{-28}{81} \cdot \mathsf{PI}\left(\right)}}\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      4. frac-addN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\left(\frac{\left(\left(\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}\right) \cdot \left(s \cdot s\right) + s \cdot \left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \frac{s \cdot s}{\frac{-28}{81} \cdot \mathsf{PI}\left(\right)} + \left(s \cdot \left(s \cdot s\right)\right) \cdot 1}{\left(s \cdot \left(s \cdot s\right)\right) \cdot \frac{s \cdot s}{\frac{-28}{81} \cdot \mathsf{PI}\left(\right)}}\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\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(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\left(\left(\left(\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}\right) \cdot \left(s \cdot s\right) + s \cdot \left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \frac{s \cdot s}{\frac{-28}{81} \cdot \mathsf{PI}\left(\right)} + \left(s \cdot \left(s \cdot s\right)\right) \cdot 1\right), \left(\left(s \cdot \left(s \cdot s\right)\right) \cdot \frac{s \cdot s}{\frac{-28}{81} \cdot \mathsf{PI}\left(\right)}\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr52.4%

      \[\leadsto \frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\color{blue}{\frac{\left(\left(s \cdot s\right) \cdot \left(\frac{\pi}{s} \cdot -0.4444444444444444\right) + \left(s \cdot \pi\right) \cdot 0.7407407407407407\right) \cdot \frac{s \cdot s}{\pi \cdot -0.345679012345679} + \left(s \cdot \left(s \cdot s\right)\right) \cdot 1}{\left(s \cdot \left(s \cdot s\right)\right) \cdot \frac{s \cdot s}{\pi \cdot -0.345679012345679}}} \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;s \leq 4.9999998413276127 \cdot 10^{-20}:\\ \;\;\;\;\frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(r \cdot \left(\frac{\pi}{s \cdot s} \cdot 0.04938271604938271\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}\\ \mathbf{elif}\;s \leq 1.0000000036274937 \cdot 10^{-15}:\\ \;\;\;\;\frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(\frac{\pi}{s} \cdot 0.6666666666666666 - r \cdot \left(\frac{\pi \cdot -0.345679012345679}{s \cdot s} + \frac{\left(s \cdot s\right) \cdot \left(\frac{\pi}{s} \cdot -0.4444444444444444\right) + \left(s \cdot \pi\right) \cdot 0.7407407407407407}{s \cdot \left(s \cdot s\right)}\right)\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(\frac{\pi}{s} \cdot 0.6666666666666666 - r \cdot \frac{s \cdot \left(s \cdot s\right) + \left(\left(s \cdot s\right) \cdot \left(\frac{\pi}{s} \cdot -0.4444444444444444\right) + \left(s \cdot \pi\right) \cdot 0.7407407407407407\right) \cdot \frac{s \cdot s}{\pi \cdot -0.345679012345679}}{\left(s \cdot \left(s \cdot s\right)\right) \cdot \frac{s \cdot s}{\pi \cdot -0.345679012345679}}\right)\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 80.7% accurate, 3.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := s \cdot \left(s \cdot s\right)\\ t_1 := \frac{\pi}{s} \cdot 0.6666666666666666\\ t_2 := s \cdot \left(\pi \cdot 4\right)\\ t_3 := \left(s \cdot s\right) \cdot \left(\frac{\pi}{s} \cdot -0.4444444444444444\right) + \left(s \cdot \pi\right) \cdot 0.7407407407407407\\ \mathbf{if}\;s \leq 4.9999998413276127 \cdot 10^{-20}:\\ \;\;\;\;\frac{1}{r \cdot \left(t\_2 + r \cdot \left(r \cdot \left(r \cdot \left(\frac{\pi}{s \cdot s} \cdot 0.04938271604938271\right) + t\_1\right) + \pi \cdot 2.6666666666666665\right)\right)}\\ \mathbf{elif}\;s \leq 2.0000000072549875 \cdot 10^{-15}:\\ \;\;\;\;\frac{1}{r \cdot \left(t\_2 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_1 - r \cdot \left(\frac{\pi \cdot -0.345679012345679}{s \cdot s} + \frac{t\_3}{t\_0}\right)\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{r \cdot \left(t\_2 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_1 - r \cdot \frac{\left(s \cdot s\right) \cdot t\_3 + t\_0 \cdot \left(\pi \cdot -0.345679012345679\right)}{\left(s \cdot s\right) \cdot t\_0}\right)\right)\right)}\\ \end{array} \end{array} \]
(FPCore (s r)
 :precision binary32
 (let* ((t_0 (* s (* s s)))
        (t_1 (* (/ PI s) 0.6666666666666666))
        (t_2 (* s (* PI 4.0)))
        (t_3
         (+
          (* (* s s) (* (/ PI s) -0.4444444444444444))
          (* (* s PI) 0.7407407407407407))))
   (if (<= s 4.9999998413276127e-20)
     (/
      1.0
      (*
       r
       (+
        t_2
        (*
         r
         (+
          (* r (+ (* r (* (/ PI (* s s)) 0.04938271604938271)) t_1))
          (* PI 2.6666666666666665))))))
     (if (<= s 2.0000000072549875e-15)
       (/
        1.0
        (*
         r
         (+
          t_2
          (*
           r
           (+
            (* PI 2.6666666666666665)
            (*
             r
             (-
              t_1
              (*
               r
               (+ (/ (* PI -0.345679012345679) (* s s)) (/ t_3 t_0))))))))))
       (/
        1.0
        (*
         r
         (+
          t_2
          (*
           r
           (+
            (* PI 2.6666666666666665)
            (*
             r
             (-
              t_1
              (*
               r
               (/
                (+ (* (* s s) t_3) (* t_0 (* PI -0.345679012345679)))
                (* (* s s) t_0))))))))))))))
float code(float s, float r) {
	float t_0 = s * (s * s);
	float t_1 = (((float) M_PI) / s) * 0.6666666666666666f;
	float t_2 = s * (((float) M_PI) * 4.0f);
	float t_3 = ((s * s) * ((((float) M_PI) / s) * -0.4444444444444444f)) + ((s * ((float) M_PI)) * 0.7407407407407407f);
	float tmp;
	if (s <= 4.9999998413276127e-20f) {
		tmp = 1.0f / (r * (t_2 + (r * ((r * ((r * ((((float) M_PI) / (s * s)) * 0.04938271604938271f)) + t_1)) + (((float) M_PI) * 2.6666666666666665f)))));
	} else if (s <= 2.0000000072549875e-15f) {
		tmp = 1.0f / (r * (t_2 + (r * ((((float) M_PI) * 2.6666666666666665f) + (r * (t_1 - (r * (((((float) M_PI) * -0.345679012345679f) / (s * s)) + (t_3 / t_0)))))))));
	} else {
		tmp = 1.0f / (r * (t_2 + (r * ((((float) M_PI) * 2.6666666666666665f) + (r * (t_1 - (r * ((((s * s) * t_3) + (t_0 * (((float) M_PI) * -0.345679012345679f))) / ((s * s) * t_0)))))))));
	}
	return tmp;
}
function code(s, r)
	t_0 = Float32(s * Float32(s * s))
	t_1 = Float32(Float32(Float32(pi) / s) * Float32(0.6666666666666666))
	t_2 = Float32(s * Float32(Float32(pi) * Float32(4.0)))
	t_3 = Float32(Float32(Float32(s * s) * Float32(Float32(Float32(pi) / s) * Float32(-0.4444444444444444))) + Float32(Float32(s * Float32(pi)) * Float32(0.7407407407407407)))
	tmp = Float32(0.0)
	if (s <= Float32(4.9999998413276127e-20))
		tmp = Float32(Float32(1.0) / Float32(r * Float32(t_2 + Float32(r * Float32(Float32(r * Float32(Float32(r * Float32(Float32(Float32(pi) / Float32(s * s)) * Float32(0.04938271604938271))) + t_1)) + Float32(Float32(pi) * Float32(2.6666666666666665)))))));
	elseif (s <= Float32(2.0000000072549875e-15))
		tmp = Float32(Float32(1.0) / Float32(r * Float32(t_2 + Float32(r * Float32(Float32(Float32(pi) * Float32(2.6666666666666665)) + Float32(r * Float32(t_1 - Float32(r * Float32(Float32(Float32(Float32(pi) * Float32(-0.345679012345679)) / Float32(s * s)) + Float32(t_3 / t_0))))))))));
	else
		tmp = Float32(Float32(1.0) / Float32(r * Float32(t_2 + Float32(r * Float32(Float32(Float32(pi) * Float32(2.6666666666666665)) + Float32(r * Float32(t_1 - Float32(r * Float32(Float32(Float32(Float32(s * s) * t_3) + Float32(t_0 * Float32(Float32(pi) * Float32(-0.345679012345679)))) / Float32(Float32(s * s) * t_0))))))))));
	end
	return tmp
end
function tmp_2 = code(s, r)
	t_0 = s * (s * s);
	t_1 = (single(pi) / s) * single(0.6666666666666666);
	t_2 = s * (single(pi) * single(4.0));
	t_3 = ((s * s) * ((single(pi) / s) * single(-0.4444444444444444))) + ((s * single(pi)) * single(0.7407407407407407));
	tmp = single(0.0);
	if (s <= single(4.9999998413276127e-20))
		tmp = single(1.0) / (r * (t_2 + (r * ((r * ((r * ((single(pi) / (s * s)) * single(0.04938271604938271))) + t_1)) + (single(pi) * single(2.6666666666666665))))));
	elseif (s <= single(2.0000000072549875e-15))
		tmp = single(1.0) / (r * (t_2 + (r * ((single(pi) * single(2.6666666666666665)) + (r * (t_1 - (r * (((single(pi) * single(-0.345679012345679)) / (s * s)) + (t_3 / t_0)))))))));
	else
		tmp = single(1.0) / (r * (t_2 + (r * ((single(pi) * single(2.6666666666666665)) + (r * (t_1 - (r * ((((s * s) * t_3) + (t_0 * (single(pi) * single(-0.345679012345679)))) / ((s * s) * t_0)))))))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := s \cdot \left(s \cdot s\right)\\
t_1 := \frac{\pi}{s} \cdot 0.6666666666666666\\
t_2 := s \cdot \left(\pi \cdot 4\right)\\
t_3 := \left(s \cdot s\right) \cdot \left(\frac{\pi}{s} \cdot -0.4444444444444444\right) + \left(s \cdot \pi\right) \cdot 0.7407407407407407\\
\mathbf{if}\;s \leq 4.9999998413276127 \cdot 10^{-20}:\\
\;\;\;\;\frac{1}{r \cdot \left(t\_2 + r \cdot \left(r \cdot \left(r \cdot \left(\frac{\pi}{s \cdot s} \cdot 0.04938271604938271\right) + t\_1\right) + \pi \cdot 2.6666666666666665\right)\right)}\\

\mathbf{elif}\;s \leq 2.0000000072549875 \cdot 10^{-15}:\\
\;\;\;\;\frac{1}{r \cdot \left(t\_2 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_1 - r \cdot \left(\frac{\pi \cdot -0.345679012345679}{s \cdot s} + \frac{t\_3}{t\_0}\right)\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{r \cdot \left(t\_2 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_1 - r \cdot \frac{\left(s \cdot s\right) \cdot t\_3 + t\_0 \cdot \left(\pi \cdot -0.345679012345679\right)}{\left(s \cdot s\right) \cdot t\_0}\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if s < 4.99999984e-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. Add Preprocessing
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified-0.0%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Taylor expanded in r around 0

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\left(\mathsf{neg}\left(r \cdot \left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      2. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      5. distribute-rgt-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      6. distribute-lft-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      7. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      10. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      11. unpow2N/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      13. metadata-evalN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\frac{-4}{81}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    9. Simplified100.0%

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

    if 4.99999984e-20 < s < 2.00000001e-15

    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. Add Preprocessing
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified51.8%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Step-by-step derivation
      1. frac-addN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \mathsf{/.f32}\left(\left(\left(\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}\right) \cdot \left(s \cdot s\right) + s \cdot \left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)\right), \left(s \cdot \left(s \cdot s\right)\right)\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr100.0%

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

    if 2.00000001e-15 < s

    1. Initial program 99.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. Add Preprocessing
    3. Applied egg-rr99.1%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr99.2%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified27.7%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Applied egg-rr51.9%

      \[\leadsto \frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\color{blue}{\frac{\left(\left(s \cdot s\right) \cdot \left(\frac{\pi}{s} \cdot -0.4444444444444444\right) + \left(s \cdot \pi\right) \cdot 0.7407407407407407\right) \cdot \left(s \cdot s\right) + \left(s \cdot \left(s \cdot s\right)\right) \cdot \left(\pi \cdot -0.345679012345679\right)}{\left(s \cdot s\right) \cdot \left(s \cdot \left(s \cdot s\right)\right)}} \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;s \leq 4.9999998413276127 \cdot 10^{-20}:\\ \;\;\;\;\frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(r \cdot \left(\frac{\pi}{s \cdot s} \cdot 0.04938271604938271\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}\\ \mathbf{elif}\;s \leq 2.0000000072549875 \cdot 10^{-15}:\\ \;\;\;\;\frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(\frac{\pi}{s} \cdot 0.6666666666666666 - r \cdot \left(\frac{\pi \cdot -0.345679012345679}{s \cdot s} + \frac{\left(s \cdot s\right) \cdot \left(\frac{\pi}{s} \cdot -0.4444444444444444\right) + \left(s \cdot \pi\right) \cdot 0.7407407407407407}{s \cdot \left(s \cdot s\right)}\right)\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(\frac{\pi}{s} \cdot 0.6666666666666666 - r \cdot \frac{\left(s \cdot s\right) \cdot \left(\left(s \cdot s\right) \cdot \left(\frac{\pi}{s} \cdot -0.4444444444444444\right) + \left(s \cdot \pi\right) \cdot 0.7407407407407407\right) + \left(s \cdot \left(s \cdot s\right)\right) \cdot \left(\pi \cdot -0.345679012345679\right)}{\left(s \cdot s\right) \cdot \left(s \cdot \left(s \cdot s\right)\right)}\right)\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 77.3% accurate, 3.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{r \cdot \left(t\_1 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_0 - r \cdot \left(\frac{\pi \cdot -0.345679012345679}{s \cdot s} + \frac{s \cdot s + \left(\pi \cdot 0.7407407407407407\right) \cdot t\_2}{\left(s \cdot s\right) \cdot t\_2}\right)\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if s < 4.99999984e-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. Add Preprocessing
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified-0.0%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Taylor expanded in r around 0

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\left(\mathsf{neg}\left(r \cdot \left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      2. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      5. distribute-rgt-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      6. distribute-lft-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      7. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      10. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      11. unpow2N/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      13. metadata-evalN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\frac{-4}{81}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    9. Simplified100.0%

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

    if 4.99999984e-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. Add Preprocessing
    3. Applied egg-rr99.3%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr99.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified33.5%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\frac{\frac{20}{27} \cdot \mathsf{PI}\left(\right)}{s \cdot s} + \frac{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}{s}\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\frac{\frac{20}{27} \cdot \mathsf{PI}\left(\right)}{s \cdot s} + \frac{1}{\frac{s}{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}}\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      3. frac-addN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\frac{\left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{s}{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}} + \left(s \cdot s\right) \cdot 1}{\left(s \cdot s\right) \cdot \frac{s}{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}}\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\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(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \mathsf{/.f32}\left(\left(\left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{s}{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}} + \left(s \cdot s\right) \cdot 1\right), \left(\left(s \cdot s\right) \cdot \frac{s}{\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}}\right)\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr52.3%

      \[\leadsto \frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \color{blue}{\frac{\left(\pi \cdot 0.7407407407407407\right) \cdot \frac{s}{\frac{\pi}{s} \cdot -0.4444444444444444} + \left(s \cdot s\right) \cdot 1}{\left(s \cdot s\right) \cdot \frac{s}{\frac{\pi}{s} \cdot -0.4444444444444444}}}\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.5%

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

Alternative 12: 74.5% accurate, 3.7× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{r \cdot \left(t\_1 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_0 + r \cdot \left(\left(\left(s \cdot s\right) \cdot \left(\frac{\pi}{s} \cdot -0.4444444444444444\right) + \left(s \cdot \pi\right) \cdot 0.7407407407407407\right) \cdot \frac{-1}{s \cdot \left(s \cdot s\right)} - \frac{\pi \cdot -0.345679012345679}{s \cdot s}\right)\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if s < 4.99999984e-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. Add Preprocessing
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified-0.0%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Taylor expanded in r around 0

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\left(\mathsf{neg}\left(r \cdot \left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      2. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      5. distribute-rgt-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      6. distribute-lft-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      7. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      10. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      11. unpow2N/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      13. metadata-evalN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\frac{-4}{81}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    9. Simplified100.0%

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

    if 4.99999984e-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. Add Preprocessing
    3. Applied egg-rr99.3%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr99.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified33.5%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Step-by-step derivation
      1. frac-addN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\frac{\left(\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}\right) \cdot \left(s \cdot s\right) + s \cdot \left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)}{s \cdot \left(s \cdot s\right)}\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      2. div-invN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\left(\left(\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}\right) \cdot \left(s \cdot s\right) + s \cdot \left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \frac{{1}^{3}}{s \cdot \left(s \cdot s\right)}\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      4. cube-unmultN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\left(\left(\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}\right) \cdot \left(s \cdot s\right) + s \cdot \left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \frac{{1}^{3}}{{s}^{3}}\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      5. cube-divN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\left(\left(\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}\right) \cdot \left(s \cdot s\right) + s \cdot \left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(\frac{1}{s}\right)}^{\left(\mathsf{neg}\left(-3\right)\right)}\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\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(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \mathsf{*.f32}\left(\left(\left(\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}\right) \cdot \left(s \cdot s\right) + s \cdot \left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)\right), \left({\left(\frac{1}{s}\right)}^{\left(\mathsf{neg}\left(-3\right)\right)}\right)\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr49.7%

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

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

Alternative 13: 70.5% accurate, 3.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{r \cdot \left(t\_1 + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(t\_0 - r \cdot \left(\frac{\pi \cdot -0.345679012345679}{s \cdot s} + \frac{\left(s \cdot s\right) \cdot \left(\frac{\pi}{s} \cdot -0.4444444444444444\right) + \left(s \cdot \pi\right) \cdot 0.7407407407407407}{s \cdot \left(s \cdot s\right)}\right)\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if s < 4.99999984e-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. Add Preprocessing
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified-0.0%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Taylor expanded in r around 0

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\left(\mathsf{neg}\left(r \cdot \left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      2. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      5. distribute-rgt-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      6. distribute-lft-outN/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      7. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      10. PI-lowering-PI.f32N/A

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      11. unpow2N/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
      13. metadata-evalN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\frac{-4}{81}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    9. Simplified100.0%

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

    if 4.99999984e-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. Add Preprocessing
    3. Applied egg-rr99.3%

      \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
    4. Applied egg-rr99.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
    5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    6. Simplified33.5%

      \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
    7. Step-by-step derivation
      1. frac-addN/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{-28}{81}, \mathsf{PI.f32}\left(\right)\right), \mathsf{*.f32}\left(s, s\right)\right), \mathsf{/.f32}\left(\left(\left(\left(\frac{2}{3} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot \frac{-2}{3}\right) \cdot \left(s \cdot s\right) + s \cdot \left(\frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)\right), \left(s \cdot \left(s \cdot s\right)\right)\right)\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr45.1%

      \[\leadsto \frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \color{blue}{\frac{\left(s \cdot s\right) \cdot \left(\frac{\pi}{s} \cdot -0.4444444444444444\right) + \left(s \cdot \pi\right) \cdot 0.7407407407407407}{s \cdot \left(s \cdot s\right)}}\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification70.6%

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

Alternative 14: 64.8% accurate, 7.0× speedup?

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

\\
\frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(\frac{\pi}{s} \cdot 0.6666666666666666 - r \cdot \frac{\frac{\pi \cdot -0.04938271604938271}{s}}{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. Add Preprocessing
  3. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
  4. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
  5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
  6. Simplified17.9%

    \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
  7. Taylor expanded in s around 0

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

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\left(\frac{\frac{-4}{9} \cdot \mathsf{PI}\left(\right) + \left(\frac{-28}{81} \cdot \mathsf{PI}\left(\right) + \frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)}{s}\right), s\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\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(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{-4}{9} \cdot \mathsf{PI}\left(\right) + \left(\frac{-28}{81} \cdot \mathsf{PI}\left(\right) + \frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)\right), s\right), s\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    5. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\mathsf{PI}\left(\right) \cdot \frac{-4}{9} + \left(\frac{-28}{81} \cdot \mathsf{PI}\left(\right) + \frac{20}{27} \cdot \mathsf{PI}\left(\right)\right)\right), s\right), s\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    6. distribute-rgt-outN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\mathsf{PI}\left(\right) \cdot \frac{-4}{9} + \mathsf{PI}\left(\right) \cdot \left(\frac{-28}{81} + \frac{20}{27}\right)\right), s\right), s\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    7. distribute-lft-outN/A

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right), s\right), s\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    10. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\frac{-4}{9} + \frac{32}{81}\right)\right), s\right), s\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    11. metadata-eval64.4%

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{-4}{81}\right), s\right), s\right), \mathsf{neg.f32}\left(r\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
  9. Simplified64.4%

    \[\leadsto \frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\color{blue}{\frac{\frac{\pi \cdot -0.04938271604938271}{s}}{s}} \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)} \]
  10. Final simplification64.4%

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

Alternative 15: 65.5% accurate, 7.0× speedup?

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

\\
\frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(r \cdot \left(\frac{\pi}{s \cdot s} \cdot 0.04938271604938271\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\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. Add Preprocessing
  3. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
  4. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
  5. 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(r \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{2}{3} \cdot \frac{\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}}{s} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right) - \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
  6. Simplified17.9%

    \[\leadsto \frac{1}{\color{blue}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(r \cdot \left(\left(\frac{-0.345679012345679 \cdot \pi}{s \cdot s} + \left(\frac{\left(0.6666666666666666 \cdot \frac{\pi}{s}\right) \cdot -0.6666666666666666}{s} + \frac{0.7407407407407407 \cdot \pi}{s \cdot s}\right)\right) \cdot \left(-r\right) + \frac{\pi}{s} \cdot 0.6666666666666666\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
  7. Taylor expanded in r around 0

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\left(\mathsf{neg}\left(r \cdot \left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    2. distribute-rgt-neg-inN/A

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{-4}{9} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    4. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \left(\frac{-28}{81} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}} + \frac{20}{27} \cdot \frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    5. distribute-rgt-outN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \frac{-4}{9} + \frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    6. distribute-lft-outN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}} \cdot \left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    7. distribute-rgt-neg-inN/A

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\left(\frac{\mathsf{PI}\left(\right)}{{s}^{2}}\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    9. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    10. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \left({s}^{2}\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    11. unpow2N/A

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\left(\frac{-4}{9} + \left(\frac{-28}{81} + \frac{20}{27}\right)\right)\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
    13. metadata-evalN/A

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{*.f32}\left(s, s\right)\right), \left(\mathsf{neg}\left(\frac{-4}{81}\right)\right)\right)\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right), \frac{2}{3}\right)\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
  9. Simplified64.4%

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

Alternative 16: 27.4% accurate, 10.0× speedup?

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

\\
\frac{1}{r \cdot \left(s \cdot \left(\pi \cdot 4\right) + r \cdot \left(\pi \cdot 2.6666666666666665 + r \cdot \left(\frac{\pi}{s} \cdot 0.6666666666666666\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. Add Preprocessing
  3. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
  4. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
  5. 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(-1 \cdot \left(r \cdot \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
  6. 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(-1 \cdot \left(r \cdot \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \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(-1 \cdot \left(r \cdot \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \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(-1 \cdot \left(r \cdot \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right) \]
    4. associate-*l*N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\left(s \cdot \left(\mathsf{PI}\left(\right) \cdot 4\right)\right), \left(\color{blue}{r} \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \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(s, \left(\mathsf{PI}\left(\right) \cdot 4\right)\right), \left(\color{blue}{r} \cdot \left(-1 \cdot \left(r \cdot \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f32N/A

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\left(-1 \cdot \left(r \cdot \left(\frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s} + \frac{10}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right)\right)\right), \color{blue}{\left(\mathsf{neg}\left(\frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)\right)\right)\right) \]
  7. Simplified29.1%

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

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

Alternative 17: 12.7% 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. Add Preprocessing
  3. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
  4. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{1}{\frac{r}{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}} + \frac{0.125}{s \cdot \pi} \cdot e^{\frac{\frac{r}{s}}{-3}}}}} \]
  5. 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) \]
  6. Step-by-step derivation
    1. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \color{blue}{\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) \]
    2. 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) \]
    3. 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) \]
    4. 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) \]
    5. *-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) \]
    6. 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) \]
    7. +-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) \]
    8. *-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(\frac{8}{3}, r\right), \left(\color{blue}{4} \cdot s\right)\right)\right)\right)\right) \]
    9. *-lowering-*.f3211.3%

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

    \[\leadsto \frac{1}{\color{blue}{r \cdot \left(\pi \cdot \left(2.6666666666666665 \cdot r + 4 \cdot s\right)\right)}} \]
  8. Final simplification11.3%

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

Alternative 18: 9.2% accurate, 25.7× speedup?

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

\\
\frac{\frac{1}{\pi} \cdot \frac{0.25}{s}}{r}
\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. *-commutativeN/A

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

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

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

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(\left(\mathsf{PI}\left(\right) \cdot r\right), s\right)\right) \]
    5. *-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) \]
    6. 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) \]
  7. Applied egg-rr8.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 19: 9.2% accurate, 25.7× speedup?

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

\\
\frac{1}{\frac{r}{\frac{0.25}{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. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{\frac{\frac{0.125}{s \cdot \pi}}{e^{\frac{r}{s}}}}{r} - \frac{e^{\frac{r}{s \cdot -3}} \cdot \frac{-0.125}{s \cdot \pi}}{r}} \]
  4. Applied egg-rr99.7%

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

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

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

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

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

Alternative 20: 9.2% accurate, 33.0× speedup?

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

\\
\frac{\frac{0.25}{s \cdot \pi}}{r}
\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. *-commutativeN/A

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

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

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

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

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

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

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

Alternative 21: 9.2% accurate, 33.0× speedup?

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

\\
\frac{0.25}{s \cdot \left(r \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. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(\left(\mathsf{PI}\left(\right) \cdot r\right), s\right)\right) \]
    5. *-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) \]
    6. 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) \]
  7. Applied egg-rr8.0%

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

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

Alternative 22: 9.2% 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 2024192 
(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))))