Disney BSSRDF, PDF of scattering profile

Percentage Accurate: 99.6% → 99.5%
Time: 16.2s
Alternatives: 16
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 16 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.5% accurate, 1.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Add Preprocessing
  3. Applied egg-rr99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, 1.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Add Preprocessing
  3. Applied egg-rr99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.6% accurate, 1.1× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Simplified97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 76.3% accurate, 1.6× speedup?

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

\\
\frac{1}{s \cdot \left(\left(1.1851851851851851 \cdot {r}^{4}\right) \cdot \frac{\frac{\pi}{s \cdot s}}{s} + \left(\left(r \cdot \left(\pi \cdot 4\right) + \frac{\pi \cdot \left(2.6666666666666665 \cdot \left(r \cdot r\right)\right)}{s}\right) - \frac{\left(r \cdot \left(r \cdot r\right)\right) \cdot \left(\pi \cdot -1.7777777777777777\right)}{s \cdot s}\right)\right)}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Simplified97.5%

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(r \cdot \left(\frac{5}{72} \cdot \frac{r}{{s}^{3}} - \frac{1}{6} \cdot \frac{1}{{s}^{2}}\right) + \frac{1}{4} \cdot \frac{1}{s}\right), r\right), \mathsf{PI.f32}\left(\right)\right) \]
  6. Simplified7.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{r \cdot \pi}{\frac{0.25 + \frac{r \cdot -0.16666666666666666}{s}}{s}}}} \]
  12. Taylor expanded in s around inf

    \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(s \cdot \left(\left(\frac{32}{27} \cdot \frac{{r}^{4} \cdot \mathsf{PI}\left(\right)}{{s}^{3}} + 4 \cdot \left(r \cdot \mathsf{PI}\left(\right)\right)\right) - \left(\frac{-8}{3} \cdot \frac{{r}^{2} \cdot \mathsf{PI}\left(\right)}{s} + \frac{-16}{9} \cdot \frac{{r}^{3} \cdot \mathsf{PI}\left(\right)}{{s}^{2}}\right)\right)\right)}\right) \]
  13. Simplified75.1%

    \[\leadsto \frac{1}{\color{blue}{s \cdot \left(\left(1.1851851851851851 \cdot {r}^{4}\right) \cdot \frac{\frac{\pi}{s \cdot s}}{s} + \left(\left(r \cdot \left(\pi \cdot 4\right) + \frac{\left(2.6666666666666665 \cdot \left(r \cdot r\right)\right) \cdot \pi}{s}\right) - \frac{\left(r \cdot \left(r \cdot r\right)\right) \cdot \left(\pi \cdot -1.7777777777777777\right)}{s \cdot s}\right)\right)}} \]
  14. Final simplification75.1%

    \[\leadsto \frac{1}{s \cdot \left(\left(1.1851851851851851 \cdot {r}^{4}\right) \cdot \frac{\frac{\pi}{s \cdot s}}{s} + \left(\left(r \cdot \left(\pi \cdot 4\right) + \frac{\pi \cdot \left(2.6666666666666665 \cdot \left(r \cdot r\right)\right)}{s}\right) - \frac{\left(r \cdot \left(r \cdot r\right)\right) \cdot \left(\pi \cdot -1.7777777777777777\right)}{s \cdot s}\right)\right)} \]
  15. Add Preprocessing

Alternative 5: 71.8% accurate, 1.7× speedup?

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

\\
\frac{1}{s \cdot \left(\frac{\pi \cdot \left(2.6666666666666665 \cdot \left(r \cdot r\right)\right) - \frac{\left(r \cdot \left(r \cdot r\right)\right) \cdot \left(\pi \cdot -1.7777777777777777\right) + \frac{\pi \cdot \left({r}^{4} \cdot -1.1851851851851851\right)}{s}}{s}}{s} - \left(r \cdot \pi\right) \cdot -4\right)}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Simplified97.5%

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(r \cdot \left(\frac{5}{72} \cdot \frac{r}{{s}^{3}} - \frac{1}{6} \cdot \frac{1}{{s}^{2}}\right) + \frac{1}{4} \cdot \frac{1}{s}\right), r\right), \mathsf{PI.f32}\left(\right)\right) \]
  6. Simplified7.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{r \cdot \pi}{\frac{0.25 + \frac{r \cdot -0.16666666666666666}{s}}{s}}}} \]
  12. Taylor expanded in s around -inf

    \[\leadsto \mathsf{/.f32}\left(1, \color{blue}{\left(-1 \cdot \left(s \cdot \left(-4 \cdot \left(r \cdot \mathsf{PI}\left(\right)\right) + -1 \cdot \frac{-1 \cdot \frac{\frac{-16}{9} \cdot \left({r}^{3} \cdot \mathsf{PI}\left(\right)\right) + \frac{-32}{27} \cdot \frac{{r}^{4} \cdot \mathsf{PI}\left(\right)}{s}}{s} + \frac{8}{3} \cdot \left({r}^{2} \cdot \mathsf{PI}\left(\right)\right)}{s}\right)\right)\right)}\right) \]
  13. Simplified71.9%

    \[\leadsto \frac{1}{\color{blue}{\left(\left(r \cdot \pi\right) \cdot -4 - \frac{\left(2.6666666666666665 \cdot \left(r \cdot r\right)\right) \cdot \pi - \frac{\left(r \cdot \left(r \cdot r\right)\right) \cdot \left(\pi \cdot -1.7777777777777777\right) + \frac{\left(-1.1851851851851851 \cdot {r}^{4}\right) \cdot \pi}{s}}{s}}{s}\right) \cdot \left(-s\right)}} \]
  14. Final simplification71.9%

    \[\leadsto \frac{1}{s \cdot \left(\frac{\pi \cdot \left(2.6666666666666665 \cdot \left(r \cdot r\right)\right) - \frac{\left(r \cdot \left(r \cdot r\right)\right) \cdot \left(\pi \cdot -1.7777777777777777\right) + \frac{\pi \cdot \left({r}^{4} \cdot -1.1851851851851851\right)}{s}}{s}}{s} - \left(r \cdot \pi\right) \cdot -4\right)} \]
  15. Add Preprocessing

Alternative 6: 63.4% accurate, 7.0× speedup?

\[\begin{array}{l} \\ \frac{1}{r \cdot \left(\left(s \cdot \pi\right) \cdot 4 + r \cdot \left(r \cdot \left(\frac{1.1851851851851851 \cdot \left(r \cdot \pi\right)}{s \cdot s} + \frac{\pi \cdot 1.7777777777777777}{s}\right) + \pi \cdot 2.6666666666666665\right)\right)} \end{array} \]
(FPCore (s r)
 :precision binary32
 (/
  1.0
  (*
   r
   (+
    (* (* s PI) 4.0)
    (*
     r
     (+
      (*
       r
       (+
        (/ (* 1.1851851851851851 (* r PI)) (* s s))
        (/ (* PI 1.7777777777777777) s)))
      (* PI 2.6666666666666665)))))))
float code(float s, float r) {
	return 1.0f / (r * (((s * ((float) M_PI)) * 4.0f) + (r * ((r * (((1.1851851851851851f * (r * ((float) M_PI))) / (s * s)) + ((((float) M_PI) * 1.7777777777777777f) / s))) + (((float) M_PI) * 2.6666666666666665f)))));
}
function code(s, r)
	return Float32(Float32(1.0) / Float32(r * Float32(Float32(Float32(s * Float32(pi)) * Float32(4.0)) + Float32(r * Float32(Float32(r * Float32(Float32(Float32(Float32(1.1851851851851851) * Float32(r * Float32(pi))) / Float32(s * s)) + Float32(Float32(Float32(pi) * Float32(1.7777777777777777)) / s))) + 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 * (((single(1.1851851851851851) * (r * single(pi))) / (s * s)) + ((single(pi) * single(1.7777777777777777)) / s))) + (single(pi) * single(2.6666666666666665))))));
end
\begin{array}{l}

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Simplified97.5%

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(r \cdot \left(\frac{5}{72} \cdot \frac{r}{{s}^{3}} - \frac{1}{6} \cdot \frac{1}{{s}^{2}}\right) + \frac{1}{4} \cdot \frac{1}{s}\right), r\right), \mathsf{PI.f32}\left(\right)\right) \]
  6. Simplified7.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{r \cdot \pi}{\frac{0.25 + \frac{r \cdot -0.16666666666666666}{s}}{s}}}} \]
  12. 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(\frac{32}{27} \cdot \frac{r \cdot \mathsf{PI}\left(\right)}{{s}^{2}} - \frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
  13. 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(r \cdot \left(\frac{32}{27} \cdot \frac{r \cdot \mathsf{PI}\left(\right)}{{s}^{2}} - \frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\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(r \cdot \left(\frac{32}{27} \cdot \frac{r \cdot \mathsf{PI}\left(\right)}{{s}^{2}} - \frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\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(r \cdot \left(\frac{32}{27} \cdot \frac{r \cdot \mathsf{PI}\left(\right)}{{s}^{2}} - \frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) - \frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)\right) \]
    4. *-lowering-*.f32N/A

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right), 4\right), \mathsf{*.f32}\left(r, \left(r \cdot \left(\frac{32}{27} \cdot \frac{r \cdot \mathsf{PI}\left(\right)}{{s}^{2}} - \frac{-16}{9} \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{-8}{3} \cdot \mathsf{PI}\left(\right)\right)\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(\mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right), 4\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\left(r \cdot \left(\frac{32}{27} \cdot \frac{r \cdot \mathsf{PI}\left(\right)}{{s}^{2}} - \frac{-16}{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) \]
  14. Simplified64.7%

    \[\leadsto \frac{1}{\color{blue}{r \cdot \left(\left(s \cdot \pi\right) \cdot 4 + r \cdot \left(r \cdot \left(\frac{1.1851851851851851 \cdot \left(r \cdot \pi\right)}{s \cdot s} + \frac{1.7777777777777777 \cdot \pi}{s}\right) + \pi \cdot 2.6666666666666665\right)\right)}} \]
  15. Final simplification64.7%

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

Alternative 7: 57.8% accurate, 7.5× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Simplified97.5%

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(r \cdot \left(\frac{5}{72} \cdot \frac{r}{{s}^{3}} - \frac{1}{6} \cdot \frac{1}{{s}^{2}}\right) + \frac{1}{4} \cdot \frac{1}{s}\right), r\right), \mathsf{PI.f32}\left(\right)\right) \]
  6. Simplified7.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{r \cdot \pi}{\frac{0.25 + \frac{r \cdot -0.16666666666666666}{s}}{s}}}} \]
  12. Taylor expanded in s around -inf

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

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{\left(\left(r \cdot \pi\right) \cdot -4 - \frac{\left(r \cdot \left(r \cdot r\right)\right) \cdot \frac{1.7777777777777777 \cdot \pi}{s} + \left(2.6666666666666665 \cdot \left(r \cdot r\right)\right) \cdot \pi}{s}\right) \cdot \left(-s\right)}} \]
  15. Final simplification57.9%

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

Alternative 8: 25.7% accurate, 10.0× speedup?

\[\begin{array}{l} \\ \frac{1}{r \cdot \left(\left(s \cdot \pi\right) \cdot 4 + r \cdot \left(\pi \cdot 2.6666666666666665 + \frac{\left(r \cdot \pi\right) \cdot 1.7777777777777777}{s}\right)\right)} \end{array} \]
(FPCore (s r)
 :precision binary32
 (/
  1.0
  (*
   r
   (+
    (* (* s PI) 4.0)
    (*
     r
     (+ (* PI 2.6666666666666665) (/ (* (* r PI) 1.7777777777777777) 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)) * 1.7777777777777777f) / s)))));
}
function code(s, r)
	return Float32(Float32(1.0) / Float32(r * Float32(Float32(Float32(s * Float32(pi)) * Float32(4.0)) + Float32(r * Float32(Float32(Float32(pi) * Float32(2.6666666666666665)) + Float32(Float32(Float32(r * Float32(pi)) * Float32(1.7777777777777777)) / 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)) * single(1.7777777777777777)) / s)))));
end
\begin{array}{l}

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Simplified97.5%

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(r \cdot \left(\frac{5}{72} \cdot \frac{r}{{s}^{3}} - \frac{1}{6} \cdot \frac{1}{{s}^{2}}\right) + \frac{1}{4} \cdot \frac{1}{s}\right), r\right), \mathsf{PI.f32}\left(\right)\right) \]
  6. Simplified7.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{r \cdot \pi}{\frac{0.25 + \frac{r \cdot -0.16666666666666666}{s}}{s}}}} \]
  12. Taylor expanded in r around 0

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{PI.f32}\left(\right)\right), 4\right), \mathsf{*.f32}\left(r, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(\frac{16}{9}, \mathsf{*.f32}\left(r, \mathsf{PI.f32}\left(\right)\right)\right), s\right), \left(\mathsf{PI}\left(\right) \cdot \frac{8}{3}\right)\right)\right)\right)\right)\right) \]
  14. Simplified24.7%

    \[\leadsto \frac{1}{\color{blue}{r \cdot \left(\left(s \cdot \pi\right) \cdot 4 + r \cdot \left(\frac{1.7777777777777777 \cdot \left(r \cdot \pi\right)}{s} + \pi \cdot 2.6666666666666665\right)\right)}} \]
  15. Final simplification24.7%

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

Alternative 9: 19.9% accurate, 12.2× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Simplified97.5%

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(r \cdot \left(\frac{5}{72} \cdot \frac{r}{{s}^{3}} - \frac{1}{6} \cdot \frac{1}{{s}^{2}}\right) + \frac{1}{4} \cdot \frac{1}{s}\right), r\right), \mathsf{PI.f32}\left(\right)\right) \]
  6. Simplified7.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{r \cdot \pi}{\frac{0.25 + \frac{r \cdot -0.16666666666666666}{s}}{s}}}} \]
  12. Taylor expanded in s around -inf

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

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{\left(\left(r \cdot r\right) \cdot \left(\frac{\pi}{s} \cdot -2.6666666666666665\right) + \left(r \cdot \pi\right) \cdot -4\right) \cdot \left(-s\right)}} \]
  15. Final simplification18.7%

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

Alternative 10: 19.3% accurate, 12.2× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Simplified97.5%

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(r \cdot \left(\frac{5}{72} \cdot \frac{r}{{s}^{3}} - \frac{1}{6} \cdot \frac{1}{{s}^{2}}\right) + \frac{1}{4} \cdot \frac{1}{s}\right), r\right), \mathsf{PI.f32}\left(\right)\right) \]
  6. Simplified7.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{r \cdot \pi}{\frac{0.25 + \frac{r \cdot -0.16666666666666666}{s}}{s}}}} \]
  12. Taylor expanded in s around inf

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{*.f32}\left(r, \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 4\right)\right), \left(\mathsf{neg}\left(\frac{-8}{3} \cdot \frac{\color{blue}{{r}^{2} \cdot \mathsf{PI}\left(\right)}}{s}\right)\right)\right)\right)\right) \]
    11. distribute-lft-neg-inN/A

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

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

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

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

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

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

Alternative 11: 12.3% accurate, 17.8× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Simplified97.5%

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(r \cdot \left(\frac{5}{72} \cdot \frac{r}{{s}^{3}} - \frac{1}{6} \cdot \frac{1}{{s}^{2}}\right) + \frac{1}{4} \cdot \frac{1}{s}\right), r\right), \mathsf{PI.f32}\left(\right)\right) \]
  6. Simplified7.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{r \cdot \pi}{\frac{0.25 + \frac{r \cdot -0.16666666666666666}{s}}{s}}}} \]
  12. 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) \]
  13. 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.5%

      \[\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) \]
  14. Simplified11.5%

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

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

Alternative 12: 8.9% accurate, 21.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Add Preprocessing
  3. Applied egg-rr99.5%

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

    \[\leadsto \color{blue}{\frac{\frac{1}{4}}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}} \]
  5. 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. *-commutativeN/A

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{PI}\left(\right)\right)\right)\right), r\right)\right)\right) \]
    2. expm1-undefineN/A

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

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{\_.f32}\left(\left(e^{\mathsf{log1p}\left(\mathsf{PI}\left(\right)\right)}\right), 1\right), r\right)\right)\right) \]
    4. log1p-undefineN/A

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

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

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

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

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

    \[\leadsto \frac{0.25}{s \cdot \left(r \cdot \left(\left(\pi + 1\right) + -1\right)\right)} \]
  10. Add Preprocessing

Alternative 13: 8.9% accurate, 33.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. 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. *-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. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 8.9% accurate, 33.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Add Preprocessing
  3. Applied egg-rr99.5%

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

    \[\leadsto \color{blue}{\frac{\frac{1}{4}}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}} \]
  5. 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 8.9% accurate, 33.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Add Preprocessing
  3. Applied egg-rr99.5%

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

    \[\leadsto \color{blue}{\frac{\frac{1}{4}}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}} \]
  5. 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 8.9% 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.4%

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Add Preprocessing
  3. Applied egg-rr99.5%

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

    \[\leadsto \color{blue}{\frac{\frac{1}{4}}{r \cdot \left(s \cdot \mathsf{PI}\left(\right)\right)}} \]
  5. 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

Reproduce

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