Disney BSSRDF, PDF of scattering profile

Percentage Accurate: 99.6% → 99.6%
Time: 18.7s
Alternatives: 24
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 24 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 \left(-3\right)}}}{\pi \cdot \left(r \cdot \left(s \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))))) (* PI (* r (* s 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)))) / (((float) M_PI) * (r * (s * 6.0f))));
}
function code(s, r)
	return Float32(Float32(Float32(Float32(0.25) * exp(Float32(r / Float32(-s)))) / Float32(r * Float32(s * Float32(Float32(2.0) * Float32(pi))))) + Float32(Float32(Float32(0.75) * exp(Float32(r / Float32(s * Float32(-Float32(3.0)))))) / Float32(Float32(pi) * Float32(r * Float32(s * 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))))) / (single(pi) * (r * (s * 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 \left(-3\right)}}}{\pi \cdot \left(r \cdot \left(s \cdot 6\right)\right)}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cbrt-cube45.5%

      \[\leadsto \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}}}{\color{blue}{\sqrt[3]{\left(\left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right) \cdot \left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right)\right) \cdot \left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right)}}} \]
    2. pow1/345.1%

      \[\leadsto \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}}}{\color{blue}{{\left(\left(\left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right) \cdot \left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right)\right) \cdot \left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right)\right)}^{0.3333333333333333}}} \]
    3. pow345.1%

      \[\leadsto \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}}}{{\color{blue}{\left({\left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right)}^{3}\right)}}^{0.3333333333333333}} \]
    4. *-commutative45.1%

      \[\leadsto \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(\color{blue}{\left(s \cdot \left(6 \cdot \pi\right)\right)} \cdot r\right)}^{3}\right)}^{0.3333333333333333}} \]
    5. associate-*l*45.0%

      \[\leadsto \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({\color{blue}{\left(s \cdot \left(\left(6 \cdot \pi\right) \cdot r\right)\right)}}^{3}\right)}^{0.3333333333333333}} \]
    6. *-commutative45.0%

      \[\leadsto \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(s \cdot \left(\color{blue}{\left(\pi \cdot 6\right)} \cdot r\right)\right)}^{3}\right)}^{0.3333333333333333}} \]
  4. Applied egg-rr45.0%

    \[\leadsto \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}}}{\color{blue}{{\left({\left(s \cdot \left(\left(\pi \cdot 6\right) \cdot r\right)\right)}^{3}\right)}^{0.3333333333333333}}} \]
  5. Step-by-step derivation
    1. unpow1/345.5%

      \[\leadsto \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}}}{\color{blue}{\sqrt[3]{{\left(s \cdot \left(\left(\pi \cdot 6\right) \cdot r\right)\right)}^{3}}}} \]
    2. rem-cbrt-cube99.4%

      \[\leadsto \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}}}{\color{blue}{s \cdot \left(\left(\pi \cdot 6\right) \cdot r\right)}} \]
    3. *-commutative99.4%

      \[\leadsto \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}}}{s \cdot \left(\color{blue}{\left(6 \cdot \pi\right)} \cdot r\right)} \]
    4. associate-*r*99.4%

      \[\leadsto \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}}}{s \cdot \color{blue}{\left(6 \cdot \left(\pi \cdot r\right)\right)}} \]
    5. associate-*l*99.4%

      \[\leadsto \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}}}{\color{blue}{\left(s \cdot 6\right) \cdot \left(\pi \cdot r\right)}} \]
    6. *-commutative99.4%

      \[\leadsto \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(s \cdot 6\right) \cdot \color{blue}{\left(r \cdot \pi\right)}} \]
    7. associate-*r*99.4%

      \[\leadsto \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}}}{\color{blue}{\left(\left(s \cdot 6\right) \cdot r\right) \cdot \pi}} \]
  6. Applied egg-rr99.4%

    \[\leadsto \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}}}{\color{blue}{\left(\left(s \cdot 6\right) \cdot r\right) \cdot \pi}} \]
  7. Final simplification99.4%

    \[\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 \left(-3\right)}}}{\pi \cdot \left(r \cdot \left(s \cdot 6\right)\right)} \]
  8. Add Preprocessing

Alternative 2: 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 \left(-3\right)}}}{6 \cdot \left(\pi \cdot \left(r \cdot s\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))))) (* 6.0 (* PI (* r s))))))
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)))) / (6.0f * (((float) M_PI) * (r * s))));
}
function code(s, r)
	return Float32(Float32(Float32(Float32(0.25) * exp(Float32(r / Float32(-s)))) / Float32(r * Float32(s * Float32(Float32(2.0) * Float32(pi))))) + Float32(Float32(Float32(0.75) * exp(Float32(r / Float32(s * Float32(-Float32(3.0)))))) / Float32(Float32(6.0) * Float32(Float32(pi) * Float32(r * s)))))
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))))) / (single(6.0) * (single(pi) * (r * s))));
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 \left(-3\right)}}}{6 \cdot \left(\pi \cdot \left(r \cdot s\right)\right)}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Add Preprocessing
  3. Taylor expanded in s around 0 99.4%

    \[\leadsto \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}}}{\color{blue}{6 \cdot \left(r \cdot \left(s \cdot \pi\right)\right)}} \]
  4. Step-by-step derivation
    1. associate-*r*99.4%

      \[\leadsto \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}}}{6 \cdot \color{blue}{\left(\left(r \cdot s\right) \cdot \pi\right)}} \]
  5. Simplified99.4%

    \[\leadsto \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}}}{\color{blue}{6 \cdot \left(\left(r \cdot s\right) \cdot \pi\right)}} \]
  6. Final simplification99.4%

    \[\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 \left(-3\right)}}}{6 \cdot \left(\pi \cdot \left(r \cdot s\right)\right)} \]
  7. Add Preprocessing

Alternative 3: 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 \left(-3\right)}}}{s \cdot \left(6 \cdot \left(r \cdot \pi\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))))) (* s (* 6.0 (* r PI))))))
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)))) / (s * (6.0f * (r * ((float) M_PI)))));
}
function code(s, r)
	return Float32(Float32(Float32(Float32(0.25) * exp(Float32(r / Float32(-s)))) / Float32(r * Float32(s * Float32(Float32(2.0) * Float32(pi))))) + Float32(Float32(Float32(0.75) * exp(Float32(r / Float32(s * Float32(-Float32(3.0)))))) / Float32(s * Float32(Float32(6.0) * Float32(r * Float32(pi))))))
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))))) / (s * (single(6.0) * (r * single(pi)))));
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 \left(-3\right)}}}{s \cdot \left(6 \cdot \left(r \cdot \pi\right)\right)}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cbrt-cube45.5%

      \[\leadsto \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}}}{\color{blue}{\sqrt[3]{\left(\left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right) \cdot \left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right)\right) \cdot \left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right)}}} \]
    2. pow1/345.1%

      \[\leadsto \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}}}{\color{blue}{{\left(\left(\left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right) \cdot \left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right)\right) \cdot \left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right)\right)}^{0.3333333333333333}}} \]
    3. pow345.1%

      \[\leadsto \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}}}{{\color{blue}{\left({\left(\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r\right)}^{3}\right)}}^{0.3333333333333333}} \]
    4. *-commutative45.1%

      \[\leadsto \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(\color{blue}{\left(s \cdot \left(6 \cdot \pi\right)\right)} \cdot r\right)}^{3}\right)}^{0.3333333333333333}} \]
    5. associate-*l*45.0%

      \[\leadsto \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({\color{blue}{\left(s \cdot \left(\left(6 \cdot \pi\right) \cdot r\right)\right)}}^{3}\right)}^{0.3333333333333333}} \]
    6. *-commutative45.0%

      \[\leadsto \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(s \cdot \left(\color{blue}{\left(\pi \cdot 6\right)} \cdot r\right)\right)}^{3}\right)}^{0.3333333333333333}} \]
  4. Applied egg-rr45.0%

    \[\leadsto \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}}}{\color{blue}{{\left({\left(s \cdot \left(\left(\pi \cdot 6\right) \cdot r\right)\right)}^{3}\right)}^{0.3333333333333333}}} \]
  5. Step-by-step derivation
    1. unpow1/345.5%

      \[\leadsto \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}}}{\color{blue}{\sqrt[3]{{\left(s \cdot \left(\left(\pi \cdot 6\right) \cdot r\right)\right)}^{3}}}} \]
    2. rem-cbrt-cube99.4%

      \[\leadsto \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}}}{\color{blue}{s \cdot \left(\left(\pi \cdot 6\right) \cdot r\right)}} \]
    3. *-commutative99.4%

      \[\leadsto \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}}}{\color{blue}{\left(\left(\pi \cdot 6\right) \cdot r\right) \cdot s}} \]
    4. *-commutative99.4%

      \[\leadsto \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(\color{blue}{\left(6 \cdot \pi\right)} \cdot r\right) \cdot s} \]
    5. associate-*r*99.4%

      \[\leadsto \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}}}{\color{blue}{\left(6 \cdot \left(\pi \cdot r\right)\right)} \cdot s} \]
  6. Applied egg-rr99.4%

    \[\leadsto \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}}}{\color{blue}{\left(6 \cdot \left(\pi \cdot r\right)\right) \cdot s}} \]
  7. Final simplification99.4%

    \[\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 \left(-3\right)}}}{s \cdot \left(6 \cdot \left(r \cdot \pi\right)\right)} \]
  8. Add Preprocessing

Alternative 4: 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 \left(-3\right)}}}{\left(s \cdot 6\right) \cdot \left(r \cdot \pi\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))))) (* (* s 6.0) (* r PI)))))
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)))) / ((s * 6.0f) * (r * ((float) M_PI))));
}
function code(s, r)
	return Float32(Float32(Float32(Float32(0.25) * exp(Float32(r / Float32(-s)))) / Float32(r * Float32(s * Float32(Float32(2.0) * Float32(pi))))) + Float32(Float32(Float32(0.75) * exp(Float32(r / Float32(s * Float32(-Float32(3.0)))))) / Float32(Float32(s * Float32(6.0)) * Float32(r * Float32(pi)))))
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))))) / ((s * single(6.0)) * (r * single(pi))));
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 \left(-3\right)}}}{\left(s \cdot 6\right) \cdot \left(r \cdot \pi\right)}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\frac{0.25 \cdot e^{\frac{-r}{s}}}{\left(\left(2 \cdot \pi\right) \cdot s\right) \cdot r} + \frac{0.75 \cdot e^{\frac{-r}{3 \cdot s}}}{\left(\left(6 \cdot \pi\right) \cdot s\right) \cdot r} \]
  2. Add Preprocessing
  3. Taylor expanded in s around 0 99.4%

    \[\leadsto \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}}}{\color{blue}{6 \cdot \left(r \cdot \left(s \cdot \pi\right)\right)}} \]
  4. Step-by-step derivation
    1. *-commutative99.4%

      \[\leadsto \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}}}{6 \cdot \color{blue}{\left(\left(s \cdot \pi\right) \cdot r\right)}} \]
    2. associate-*r*99.3%

      \[\leadsto \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}}}{\color{blue}{\left(6 \cdot \left(s \cdot \pi\right)\right) \cdot r}} \]
    3. associate-*r*99.5%

      \[\leadsto \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}}}{\color{blue}{\left(\left(6 \cdot s\right) \cdot \pi\right)} \cdot r} \]
    4. associate-*l*99.4%

      \[\leadsto \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}}}{\color{blue}{\left(6 \cdot s\right) \cdot \left(\pi \cdot r\right)}} \]
    5. *-commutative99.4%

      \[\leadsto \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}}}{\color{blue}{\left(s \cdot 6\right)} \cdot \left(\pi \cdot r\right)} \]
  5. Simplified99.4%

    \[\leadsto \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}}}{\color{blue}{\left(s \cdot 6\right) \cdot \left(\pi \cdot r\right)}} \]
  6. Final simplification99.4%

    \[\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 \left(-3\right)}}}{\left(s \cdot 6\right) \cdot \left(r \cdot \pi\right)} \]
  7. Add Preprocessing

Alternative 5: 99.6% accurate, 1.0× speedup?

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

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

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

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

      \[\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. distribute-frac-neg99.3%

      \[\leadsto \frac{0.25}{s \cdot \left(2 \cdot \pi\right)} \cdot \frac{e^{\color{blue}{-\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} \]
    4. associate-/l*99.4%

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

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

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

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

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

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

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

Alternative 6: 99.6% accurate, 1.0× speedup?

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

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

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

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

      \[\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. distribute-frac-neg99.3%

      \[\leadsto \frac{0.25}{s \cdot \left(2 \cdot \pi\right)} \cdot \frac{e^{\color{blue}{-\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} \]
    4. associate-/l*99.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 99.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{\color{blue}{-1}}{-\frac{3 \cdot s}{-r}}}}{r}\right) \]
    7. add-sqr-sqrt-0.0%

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

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

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

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{-1}{-\frac{3 \cdot s}{\color{blue}{\sqrt{r} \cdot \sqrt{r}}}}}}{r}\right) \]
    11. add-sqr-sqrt9.1%

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

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

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{-1}{\color{blue}{3 \cdot \frac{s}{-r}}}}}{r}\right) \]
    14. add-sqr-sqrt-0.0%

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

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{-1}{3 \cdot \frac{s}{\color{blue}{\sqrt{\left(-r\right) \cdot \left(-r\right)}}}}}}{r}\right) \]
    16. sqr-neg99.2%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{-1}{3 \cdot \frac{s}{\sqrt{\color{blue}{r \cdot r}}}}}}{r}\right) \]
    17. sqrt-unprod99.0%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \left(\frac{e^{\frac{r}{-s}}}{r} + \frac{e^{\frac{-1}{3 \cdot \frac{s}{\color{blue}{\sqrt{r} \cdot \sqrt{r}}}}}}{r}\right) \]
    18. add-sqr-sqrt99.2%

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

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

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

Alternative 8: 99.5% accurate, 1.1× speedup?

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

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

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

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

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

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

Alternative 9: 99.5% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

Alternative 10: 11.8% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

Alternative 11: 9.6% accurate, 1.9× speedup?

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

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

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

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

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

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

Alternative 12: 9.4% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

Alternative 13: 9.4% accurate, 2.0× speedup?

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

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

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

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

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

    \[\leadsto \color{blue}{0.125 \cdot \frac{\frac{1}{r} + \frac{e^{-1 \cdot \frac{r}{s}}}{r}}{s \cdot \pi}} \]
  6. Step-by-step derivation
    1. mul-1-neg10.8%

      \[\leadsto 0.125 \cdot \frac{\frac{1}{r} + \frac{e^{\color{blue}{-\frac{r}{s}}}}{r}}{s \cdot \pi} \]
  7. Simplified10.8%

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

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

Alternative 14: 9.4% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 9.4% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.125 \cdot \frac{\frac{1}{r} + \frac{e^{\color{blue}{\frac{-1 \cdot r}{s}}}}{r}}{s \cdot \pi} \]
    2. neg-mul-110.8%

      \[\leadsto 0.125 \cdot \frac{\frac{1}{r} + \frac{e^{\frac{\color{blue}{-r}}{s}}}{r}}{s \cdot \pi} \]
  9. Simplified10.8%

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

    \[\leadsto 0.125 \cdot \frac{\color{blue}{\frac{1 + e^{-1 \cdot \frac{r}{s}}}{r}}}{s \cdot \pi} \]
  11. Step-by-step derivation
    1. mul-1-neg10.8%

      \[\leadsto 0.125 \cdot \frac{\frac{1 + e^{\color{blue}{-\frac{r}{s}}}}{r}}{s \cdot \pi} \]
    2. distribute-neg-frac210.8%

      \[\leadsto 0.125 \cdot \frac{\frac{1 + e^{\color{blue}{\frac{r}{-s}}}}{r}}{s \cdot \pi} \]
  12. Simplified10.8%

    \[\leadsto 0.125 \cdot \frac{\color{blue}{\frac{1 + e^{\frac{r}{-s}}}{r}}}{s \cdot \pi} \]
  13. Final simplification10.8%

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

Alternative 16: 9.4% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \frac{1 + e^{-1 \cdot \frac{r}{s}}}{r}} \]
    4. mul-1-neg10.8%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \frac{1 + e^{\color{blue}{-\frac{r}{s}}}}{r} \]
    5. distribute-neg-frac210.8%

      \[\leadsto \frac{0.125}{s \cdot \pi} \cdot \frac{1 + e^{\color{blue}{\frac{r}{-s}}}}{r} \]
  9. Simplified10.8%

    \[\leadsto \color{blue}{\frac{0.125}{s \cdot \pi} \cdot \frac{1 + e^{\frac{r}{-s}}}{r}} \]
  10. Final simplification10.8%

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

Alternative 17: 8.9% accurate, 21.0× speedup?

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

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

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

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

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

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

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

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

    \[\leadsto \left(\frac{0.125}{s} \cdot \frac{1}{\pi}\right) \cdot \color{blue}{\frac{2}{r}} \]
  8. Final simplification10.1%

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

Alternative 18: 8.9% accurate, 25.7× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.125 \cdot \frac{\frac{1}{r} + \frac{e^{\color{blue}{\frac{-1 \cdot r}{s}}}}{r}}{s \cdot \pi} \]
    2. neg-mul-110.8%

      \[\leadsto 0.125 \cdot \frac{\frac{1}{r} + \frac{e^{\frac{\color{blue}{-r}}{s}}}{r}}{s \cdot \pi} \]
  9. Simplified10.8%

    \[\leadsto \color{blue}{0.125 \cdot \frac{\frac{1}{r} + \frac{e^{\frac{-r}{s}}}{r}}{s \cdot \pi}} \]
  10. Taylor expanded in r around 0 10.1%

    \[\leadsto 0.125 \cdot \color{blue}{\frac{2}{r \cdot \left(s \cdot \pi\right)}} \]
  11. Step-by-step derivation
    1. *-commutative10.1%

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

      \[\leadsto 0.125 \cdot \frac{2}{\color{blue}{s \cdot \left(\pi \cdot r\right)}} \]
    3. associate-/l/10.1%

      \[\leadsto 0.125 \cdot \color{blue}{\frac{\frac{2}{\pi \cdot r}}{s}} \]
    4. *-commutative10.1%

      \[\leadsto 0.125 \cdot \frac{\frac{2}{\color{blue}{r \cdot \pi}}}{s} \]
  12. Simplified10.1%

    \[\leadsto 0.125 \cdot \color{blue}{\frac{\frac{2}{r \cdot \pi}}{s}} \]
  13. Final simplification10.1%

    \[\leadsto 0.125 \cdot \frac{\frac{2}{r \cdot \pi}}{s} \]
  14. Add Preprocessing

Alternative 19: 8.9% accurate, 25.7× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{0.25}{r}}{s \cdot \pi}} \]
  9. Simplified10.1%

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

      \[\leadsto \color{blue}{\frac{0.25}{\left(s \cdot \pi\right) \cdot r}} \]
    2. div-inv10.1%

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

      \[\leadsto 0.25 \cdot \frac{1}{\color{blue}{s \cdot \left(\pi \cdot r\right)}} \]
  11. Applied egg-rr10.1%

    \[\leadsto \color{blue}{0.25 \cdot \frac{1}{s \cdot \left(\pi \cdot r\right)}} \]
  12. Final simplification10.1%

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

Alternative 20: 8.9% accurate, 25.7× speedup?

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{0.25}{r}}{s \cdot \pi}} \]
    2. div-inv10.1%

      \[\leadsto \color{blue}{\frac{0.25}{r} \cdot \frac{1}{s \cdot \pi}} \]
  7. Applied egg-rr10.1%

    \[\leadsto \color{blue}{\frac{0.25}{r} \cdot \frac{1}{s \cdot \pi}} \]
  8. Final simplification10.1%

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

Alternative 21: 8.9% accurate, 25.7× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{0.25}{r}}{s \cdot \pi}} \]
  9. Simplified10.1%

    \[\leadsto \color{blue}{\frac{\frac{0.25}{r}}{s \cdot \pi}} \]
  10. Step-by-step derivation
    1. *-un-lft-identity10.1%

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

      \[\leadsto \frac{1 \cdot \frac{0.25}{r}}{\color{blue}{\pi \cdot s}} \]
    3. times-frac10.1%

      \[\leadsto \color{blue}{\frac{1}{\pi} \cdot \frac{\frac{0.25}{r}}{s}} \]
    4. associate-/l/10.1%

      \[\leadsto \frac{1}{\pi} \cdot \color{blue}{\frac{0.25}{s \cdot r}} \]
  11. Applied egg-rr10.1%

    \[\leadsto \color{blue}{\frac{1}{\pi} \cdot \frac{0.25}{s \cdot r}} \]
  12. Final simplification10.1%

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

Alternative 22: 8.9% accurate, 25.7× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{0.25}{r}}{s \cdot \pi}} \]
  9. Simplified10.1%

    \[\leadsto \color{blue}{\frac{\frac{0.25}{r}}{s \cdot \pi}} \]
  10. Step-by-step derivation
    1. clear-num10.1%

      \[\leadsto \color{blue}{\frac{1}{\frac{s \cdot \pi}{\frac{0.25}{r}}}} \]
    2. associate-/r/10.1%

      \[\leadsto \color{blue}{\frac{1}{s \cdot \pi} \cdot \frac{0.25}{r}} \]
    3. associate-/r*10.1%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{\pi}} \cdot \frac{0.25}{r} \]
  11. Applied egg-rr10.1%

    \[\leadsto \color{blue}{\frac{\frac{1}{s}}{\pi} \cdot \frac{0.25}{r}} \]
  12. Final simplification10.1%

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

Alternative 23: 8.9% accurate, 33.0× speedup?

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

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

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

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

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

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

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

Alternative 24: 8.9% accurate, 33.0× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{0.25}{r}}{s \cdot \pi}} \]
  9. Simplified10.1%

    \[\leadsto \color{blue}{\frac{\frac{0.25}{r}}{s \cdot \pi}} \]
  10. Final simplification10.1%

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

Reproduce

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