Disney BSSRDF, PDF of scattering profile

Percentage Accurate: 99.6% → 99.6%
Time: 10.6s
Alternatives: 16
Speedup: 1.0×

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.6% accurate, 1.0× speedup?

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

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

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

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

Alternative 2: 99.6% accurate, 1.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. times-frac99.6%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.5% accurate, 1.3× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.5% accurate, 1.3× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.5% accurate, 1.4× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.5% accurate, 1.4× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

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

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

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

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

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

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

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

Alternative 7: 99.5% accurate, 1.4× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 43.6% accurate, 1.4× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

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

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

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

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

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

Alternative 9: 9.5% accurate, 2.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 9.5% accurate, 2.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 9.4% accurate, 2.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 9.4% accurate, 2.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 8.9% accurate, 3.6× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 0.125 \cdot \frac{\color{blue}{\left(1 + -1 \cdot \frac{r}{s}\right)} + \left(1 + r \cdot \frac{-0.3333333333333333}{s}\right)}{s \cdot \left(\pi \cdot r\right)} \]
  11. Step-by-step derivation
    1. mul-1-neg9.7%

      \[\leadsto 0.125 \cdot \frac{\left(1 + \color{blue}{\left(-\frac{r}{s}\right)}\right) + \left(1 + r \cdot \frac{-0.3333333333333333}{s}\right)}{s \cdot \left(\pi \cdot r\right)} \]
    2. unsub-neg9.7%

      \[\leadsto 0.125 \cdot \frac{\color{blue}{\left(1 - \frac{r}{s}\right)} + \left(1 + r \cdot \frac{-0.3333333333333333}{s}\right)}{s \cdot \left(\pi \cdot r\right)} \]
  12. Simplified9.7%

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

    \[\leadsto 0.125 \cdot \frac{\left(1 + r \cdot \frac{-0.3333333333333333}{s}\right) + \left(1 - \frac{r}{s}\right)}{s \cdot \left(r \cdot \pi\right)} \]

Alternative 14: 8.9% accurate, 4.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{0.25}{s}}{r \cdot \pi}} \]
    2. *-commutative9.4%

      \[\leadsto \frac{\frac{0.25}{s}}{\color{blue}{\pi \cdot r}} \]
  6. Simplified9.4%

    \[\leadsto \color{blue}{\frac{\frac{0.25}{s}}{\pi \cdot r}} \]
  7. Taylor expanded in s around 0 9.4%

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

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

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

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

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

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

Alternative 15: 8.9% accurate, 4.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

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

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

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

Alternative 16: 8.9% accurate, 4.0× speedup?

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

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

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Step-by-step derivation
    1. associate-*l/97.3%

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

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

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{\color{blue}{0.125}}{\pi \cdot \left(s \cdot r\right)} \cdot e^{\frac{-r}{3 \cdot s}} \]
    7. metadata-eval97.2%

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

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

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

      \[\leadsto \frac{0.25}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} \cdot e^{\frac{-r}{s}} + \frac{0.25}{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r}} \cdot e^{\frac{-r}{3 \cdot s}} \]
    11. distribute-lft-out97.2%

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

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

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

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

    \[\leadsto \color{blue}{\frac{0.25}{s \cdot \left(\pi \cdot r\right)}} \]
  7. Taylor expanded in s around 0 9.4%

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

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

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

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

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

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

Reproduce

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