Logistic distribution

Percentage Accurate: 99.6% → 99.6%
Time: 18.6s
Alternatives: 21
Speedup: 2.9×

Specification

?
\[0 \leq s \land s \leq 1.0651631\]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{\frac{-\left|x\right|}{s}}\\ t_1 := 1 + t\_0\\ \frac{t\_0}{\left(s \cdot t\_1\right) \cdot t\_1} \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (let* ((t_0 (exp (/ (- (fabs x)) s))) (t_1 (+ 1.0 t_0)))
   (/ t_0 (* (* s t_1) t_1))))
float code(float x, float s) {
	float t_0 = expf((-fabsf(x) / s));
	float t_1 = 1.0f + t_0;
	return t_0 / ((s * t_1) * t_1);
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: t_0
    real(4) :: t_1
    t_0 = exp((-abs(x) / s))
    t_1 = 1.0e0 + t_0
    code = t_0 / ((s * t_1) * t_1)
end function
function code(x, s)
	t_0 = exp(Float32(Float32(-abs(x)) / s))
	t_1 = Float32(Float32(1.0) + t_0)
	return Float32(t_0 / Float32(Float32(s * t_1) * t_1))
end
function tmp = code(x, s)
	t_0 = exp((-abs(x) / s));
	t_1 = single(1.0) + t_0;
	tmp = t_0 / ((s * t_1) * t_1);
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{\frac{-\left|x\right|}{s}}\\
t_1 := 1 + t\_0\\
\frac{t\_0}{\left(s \cdot t\_1\right) \cdot t\_1}
\end{array}
\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 21 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} \\ \begin{array}{l} t_0 := e^{\frac{-\left|x\right|}{s}}\\ t_1 := 1 + t\_0\\ \frac{t\_0}{\left(s \cdot t\_1\right) \cdot t\_1} \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (let* ((t_0 (exp (/ (- (fabs x)) s))) (t_1 (+ 1.0 t_0)))
   (/ t_0 (* (* s t_1) t_1))))
float code(float x, float s) {
	float t_0 = expf((-fabsf(x) / s));
	float t_1 = 1.0f + t_0;
	return t_0 / ((s * t_1) * t_1);
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: t_0
    real(4) :: t_1
    t_0 = exp((-abs(x) / s))
    t_1 = 1.0e0 + t_0
    code = t_0 / ((s * t_1) * t_1)
end function
function code(x, s)
	t_0 = exp(Float32(Float32(-abs(x)) / s))
	t_1 = Float32(Float32(1.0) + t_0)
	return Float32(t_0 / Float32(Float32(s * t_1) * t_1))
end
function tmp = code(x, s)
	t_0 = exp((-abs(x) / s));
	t_1 = single(1.0) + t_0;
	tmp = t_0 / ((s * t_1) * t_1);
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{\frac{-\left|x\right|}{s}}\\
t_1 := 1 + t\_0\\
\frac{t\_0}{\left(s \cdot t\_1\right) \cdot t\_1}
\end{array}
\end{array}

Alternative 1: 99.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{\frac{0 - \left|x\right|}{s}}\\ \frac{t\_0}{\left(s \cdot \left(1 + \frac{1}{e^{\frac{\left|x\right|}{s}}}\right)\right) \cdot \left(t\_0 + 1\right)} \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (let* ((t_0 (exp (/ (- 0.0 (fabs x)) s))))
   (/ t_0 (* (* s (+ 1.0 (/ 1.0 (exp (/ (fabs x) s))))) (+ t_0 1.0)))))
float code(float x, float s) {
	float t_0 = expf(((0.0f - fabsf(x)) / s));
	return t_0 / ((s * (1.0f + (1.0f / expf((fabsf(x) / s))))) * (t_0 + 1.0f));
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: t_0
    t_0 = exp(((0.0e0 - abs(x)) / s))
    code = t_0 / ((s * (1.0e0 + (1.0e0 / exp((abs(x) / s))))) * (t_0 + 1.0e0))
end function
function code(x, s)
	t_0 = exp(Float32(Float32(Float32(0.0) - abs(x)) / s))
	return Float32(t_0 / Float32(Float32(s * Float32(Float32(1.0) + Float32(Float32(1.0) / exp(Float32(abs(x) / s))))) * Float32(t_0 + Float32(1.0))))
end
function tmp = code(x, s)
	t_0 = exp(((single(0.0) - abs(x)) / s));
	tmp = t_0 / ((s * (single(1.0) + (single(1.0) / exp((abs(x) / s))))) * (t_0 + single(1.0)));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{\frac{0 - \left|x\right|}{s}}\\
\frac{t\_0}{\left(s \cdot \left(1 + \frac{1}{e^{\frac{\left|x\right|}{s}}}\right)\right) \cdot \left(t\_0 + 1\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. distribute-frac-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{+.f32}\left(1, \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right)\right)\right)\right) \]
    2. exp-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{+.f32}\left(1, \left(\frac{1}{e^{\frac{\left|x\right|}{s}}}\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right)\right)\right)\right) \]
    3. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(1, \left(e^{\frac{\left|x\right|}{s}}\right)\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right)\right)\right)\right) \]
    4. exp-lowering-exp.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(1, \mathsf{exp.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right)\right)\right)\right) \]
    5. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right)\right)\right)\right) \]
    6. fabs-lowering-fabs.f3299.8%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right)\right)\right)\right) \]
  4. Applied egg-rr99.8%

    \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + \color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
  5. Final simplification99.8%

    \[\leadsto \frac{e^{\frac{0 - \left|x\right|}{s}}}{\left(s \cdot \left(1 + \frac{1}{e^{\frac{\left|x\right|}{s}}}\right)\right) \cdot \left(e^{\frac{0 - \left|x\right|}{s}} + 1\right)} \]
  6. Add Preprocessing

Alternative 2: 99.6% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{\frac{0 - \left|x\right|}{s}}\\ \frac{\frac{t\_0}{s}}{{\left(t\_0 + 1\right)}^{2}} \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (let* ((t_0 (exp (/ (- 0.0 (fabs x)) s))))
   (/ (/ t_0 s) (pow (+ t_0 1.0) 2.0))))
float code(float x, float s) {
	float t_0 = expf(((0.0f - fabsf(x)) / s));
	return (t_0 / s) / powf((t_0 + 1.0f), 2.0f);
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: t_0
    t_0 = exp(((0.0e0 - abs(x)) / s))
    code = (t_0 / s) / ((t_0 + 1.0e0) ** 2.0e0)
end function
function code(x, s)
	t_0 = exp(Float32(Float32(Float32(0.0) - abs(x)) / s))
	return Float32(Float32(t_0 / s) / (Float32(t_0 + Float32(1.0)) ^ Float32(2.0)))
end
function tmp = code(x, s)
	t_0 = exp(((single(0.0) - abs(x)) / s));
	tmp = (t_0 / s) / ((t_0 + single(1.0)) ^ single(2.0));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{\frac{0 - \left|x\right|}{s}}\\
\frac{\frac{t\_0}{s}}{{\left(t\_0 + 1\right)}^{2}}
\end{array}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{e^{-1 \cdot \frac{\left|x\right|}{s}}}{s \cdot {\left(1 + e^{-1 \cdot \frac{\left|x\right|}{s}}\right)}^{2}}} \]
  4. Step-by-step derivation
    1. associate-/r*N/A

      \[\leadsto \frac{\frac{e^{-1 \cdot \frac{\left|x\right|}{s}}}{s}}{\color{blue}{{\left(1 + e^{-1 \cdot \frac{\left|x\right|}{s}}\right)}^{2}}} \]
    2. /-lowering-/.f32N/A

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(e^{-1 \cdot \frac{\left|x\right|}{s}}\right), s\right), \left({\color{blue}{\left(1 + e^{-1 \cdot \frac{\left|x\right|}{s}}\right)}}^{2}\right)\right) \]
    4. exp-lowering-exp.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{exp.f32}\left(\left(-1 \cdot \frac{\left|x\right|}{s}\right)\right), s\right), \left({\left(\color{blue}{1} + e^{-1 \cdot \frac{\left|x\right|}{s}}\right)}^{2}\right)\right) \]
    5. neg-mul-1N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{exp.f32}\left(\left(\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)\right)\right), s\right), \left({\left(1 + e^{-1 \cdot \frac{\left|x\right|}{s}}\right)}^{2}\right)\right) \]
    6. distribute-frac-neg2N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{exp.f32}\left(\left(\frac{\left|x\right|}{\mathsf{neg}\left(s\right)}\right)\right), s\right), \left({\left(1 + e^{-1 \cdot \frac{\left|x\right|}{s}}\right)}^{2}\right)\right) \]
    7. neg-mul-1N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{exp.f32}\left(\left(\frac{\left|x\right|}{-1 \cdot s}\right)\right), s\right), \left({\left(1 + e^{-1 \cdot \frac{\left|x\right|}{s}}\right)}^{2}\right)\right) \]
    8. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), \left(-1 \cdot s\right)\right)\right), s\right), \left({\left(1 + e^{-1 \cdot \frac{\left|x\right|}{s}}\right)}^{2}\right)\right) \]
    9. fabs-lowering-fabs.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), \left(-1 \cdot s\right)\right)\right), s\right), \left({\left(1 + e^{-1 \cdot \frac{\left|x\right|}{s}}\right)}^{2}\right)\right) \]
    10. neg-mul-1N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), \left(\mathsf{neg}\left(s\right)\right)\right)\right), s\right), \left({\left(1 + e^{-1 \cdot \frac{\left|x\right|}{s}}\right)}^{2}\right)\right) \]
    11. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), \mathsf{neg.f32}\left(s\right)\right)\right), s\right), \left({\left(1 + e^{-1 \cdot \frac{\left|x\right|}{s}}\right)}^{2}\right)\right) \]
    12. pow-lowering-pow.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), \mathsf{neg.f32}\left(s\right)\right)\right), s\right), \mathsf{pow.f32}\left(\left(1 + e^{-1 \cdot \frac{\left|x\right|}{s}}\right), \color{blue}{2}\right)\right) \]
  5. Simplified99.8%

    \[\leadsto \color{blue}{\frac{\frac{e^{\frac{\left|x\right|}{-s}}}{s}}{{\left(e^{\frac{\left|x\right|}{-s}} + 1\right)}^{2}}} \]
  6. Final simplification99.8%

    \[\leadsto \frac{\frac{e^{\frac{0 - \left|x\right|}{s}}}{s}}{{\left(e^{\frac{0 - \left|x\right|}{s}} + 1\right)}^{2}} \]
  7. Add Preprocessing

Alternative 3: 99.6% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \frac{{\left(\sqrt{\frac{1}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}}\right)}^{2}}{s} \end{array} \]
(FPCore (x s)
 :precision binary32
 (/ (pow (sqrt (/ 1.0 (+ 2.0 (* 2.0 (cosh (/ (fabs x) s)))))) 2.0) s))
float code(float x, float s) {
	return powf(sqrtf((1.0f / (2.0f + (2.0f * coshf((fabsf(x) / s)))))), 2.0f) / s;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = (sqrt((1.0e0 / (2.0e0 + (2.0e0 * cosh((abs(x) / s)))))) ** 2.0e0) / s
end function
function code(x, s)
	return Float32((sqrt(Float32(Float32(1.0) / Float32(Float32(2.0) + Float32(Float32(2.0) * cosh(Float32(abs(x) / s)))))) ^ Float32(2.0)) / s)
end
function tmp = code(x, s)
	tmp = (sqrt((single(1.0) / (single(2.0) + (single(2.0) * cosh((abs(x) / s)))))) ^ single(2.0)) / s;
end
\begin{array}{l}

\\
\frac{{\left(\sqrt{\frac{1}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}}\right)}^{2}}{s}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
  2. Simplified99.5%

    \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. inv-powN/A

      \[\leadsto \mathsf{/.f32}\left(\left({\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}^{-1}\right), s\right) \]
    2. sqr-powN/A

      \[\leadsto \mathsf{/.f32}\left(\left({\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}^{\left(\frac{-1}{2}\right)}\right), s\right) \]
    3. pow2N/A

      \[\leadsto \mathsf{/.f32}\left(\left({\left({\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}^{\left(\frac{-1}{2}\right)}\right)}^{2}\right), s\right) \]
    4. pow-lowering-pow.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left({\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}^{\left(\frac{-1}{2}\right)}\right), 2\right), s\right) \]
  5. Applied egg-rr99.5%

    \[\leadsto \frac{\color{blue}{{\left({\left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}^{-0.5}\right)}^{2}}}{s} \]
  6. Step-by-step derivation
    1. unpow1N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left({\left({\left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}^{\frac{-1}{2}}\right)}^{1}\right), 2\right), s\right) \]
    2. sqr-powN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left({\left({\left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}^{\frac{-1}{2}}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left({\left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}^{\frac{-1}{2}}\right)}^{\left(\frac{1}{2}\right)}\right), 2\right), s\right) \]
    3. pow-prod-downN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left({\left({\left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}^{\frac{-1}{2}} \cdot {\left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}^{\frac{-1}{2}}\right)}^{\left(\frac{1}{2}\right)}\right), 2\right), s\right) \]
    4. unpow2N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left({\left({\left({\left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}^{\frac{-1}{2}}\right)}^{2}\right)}^{\left(\frac{1}{2}\right)}\right), 2\right), s\right) \]
    5. pow-lowering-pow.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\left({\left({\left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}^{\frac{-1}{2}}\right)}^{2}\right), \left(\frac{1}{2}\right)\right), 2\right), s\right) \]
    6. pow-powN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\left({\left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}^{\left(\frac{-1}{2} \cdot 2\right)}\right), \left(\frac{1}{2}\right)\right), 2\right), s\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\left({\left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}^{-1}\right), \left(\frac{1}{2}\right)\right), 2\right), s\right) \]
    8. inv-powN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\left(\frac{1}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}\right), \left(\frac{1}{2}\right)\right), 2\right), s\right) \]
    9. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(1, \left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)\right), \left(\frac{1}{2}\right)\right), 2\right), s\right) \]
    10. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(2, \left(2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)\right)\right), \left(\frac{1}{2}\right)\right), 2\right), s\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \cosh \left(\frac{\left|x\right|}{s}\right)\right)\right)\right), \left(\frac{1}{2}\right)\right), 2\right), s\right) \]
    12. cosh-lowering-cosh.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right), \left(\frac{1}{2}\right)\right), 2\right), s\right) \]
    13. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right), \left(\frac{1}{2}\right)\right), 2\right), s\right) \]
    14. fabs-lowering-fabs.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{pow.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right), \left(\frac{1}{2}\right)\right), 2\right), s\right) \]
  7. Applied egg-rr99.5%

    \[\leadsto \frac{{\color{blue}{\left({\left(\frac{1}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}\right)}^{0.5}\right)}}^{2}}{s} \]
  8. Step-by-step derivation
    1. unpow1/2N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left(\sqrt{\frac{1}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}}\right), 2\right), s\right) \]
    2. sqrt-lowering-sqrt.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{sqrt.f32}\left(\left(\frac{1}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right), 2\right), s\right) \]
    3. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)\right)\right), 2\right), s\right) \]
    4. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(2, \left(2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right), 2\right), s\right) \]
    5. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \cosh \left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right), 2\right), s\right) \]
    6. cosh-lowering-cosh.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right)\right), 2\right), s\right) \]
    7. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right)\right), 2\right), s\right) \]
    8. fabs-lowering-fabs.f3299.5%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\mathsf{sqrt.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right)\right), 2\right), s\right) \]
  9. Applied egg-rr99.5%

    \[\leadsto \frac{{\color{blue}{\left(\sqrt{\frac{1}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}}\right)}}^{2}}{s} \]
  10. Add Preprocessing

Alternative 4: 99.6% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \frac{{\left({\left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}^{-0.5}\right)}^{2}}{s} \end{array} \]
(FPCore (x s)
 :precision binary32
 (/ (pow (pow (+ 2.0 (* 2.0 (cosh (/ (fabs x) s)))) -0.5) 2.0) s))
float code(float x, float s) {
	return powf(powf((2.0f + (2.0f * coshf((fabsf(x) / s)))), -0.5f), 2.0f) / s;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = (((2.0e0 + (2.0e0 * cosh((abs(x) / s)))) ** (-0.5e0)) ** 2.0e0) / s
end function
function code(x, s)
	return Float32(((Float32(Float32(2.0) + Float32(Float32(2.0) * cosh(Float32(abs(x) / s)))) ^ Float32(-0.5)) ^ Float32(2.0)) / s)
end
function tmp = code(x, s)
	tmp = (((single(2.0) + (single(2.0) * cosh((abs(x) / s)))) ^ single(-0.5)) ^ single(2.0)) / s;
end
\begin{array}{l}

\\
\frac{{\left({\left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}^{-0.5}\right)}^{2}}{s}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
  2. Simplified99.5%

    \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. inv-powN/A

      \[\leadsto \mathsf{/.f32}\left(\left({\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}^{-1}\right), s\right) \]
    2. sqr-powN/A

      \[\leadsto \mathsf{/.f32}\left(\left({\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}^{\left(\frac{-1}{2}\right)}\right), s\right) \]
    3. pow2N/A

      \[\leadsto \mathsf{/.f32}\left(\left({\left({\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}^{\left(\frac{-1}{2}\right)}\right)}^{2}\right), s\right) \]
    4. pow-lowering-pow.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{pow.f32}\left(\left({\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}^{\left(\frac{-1}{2}\right)}\right), 2\right), s\right) \]
  5. Applied egg-rr99.5%

    \[\leadsto \frac{\color{blue}{{\left({\left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}^{-0.5}\right)}^{2}}}{s} \]
  6. Add Preprocessing

Alternative 5: 99.6% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \frac{1}{s \cdot \left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)} \end{array} \]
(FPCore (x s)
 :precision binary32
 (/ 1.0 (* s (+ 2.0 (* 2.0 (cosh (/ (fabs x) s)))))))
float code(float x, float s) {
	return 1.0f / (s * (2.0f + (2.0f * coshf((fabsf(x) / s)))));
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = 1.0e0 / (s * (2.0e0 + (2.0e0 * cosh((abs(x) / s)))))
end function
function code(x, s)
	return Float32(Float32(1.0) / Float32(s * Float32(Float32(2.0) + Float32(Float32(2.0) * cosh(Float32(abs(x) / s))))))
end
function tmp = code(x, s)
	tmp = single(1.0) / (s * (single(2.0) + (single(2.0) * cosh((abs(x) / s)))));
end
\begin{array}{l}

\\
\frac{1}{s \cdot \left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
  2. Simplified99.5%

    \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-/l/N/A

      \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
    2. /-lowering-/.f32N/A

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right)\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right)\right) \]
    6. +-lowering-+.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right)\right) \]
    7. distribute-frac-negN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right)\right) \]
    8. +-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right)\right) \]
    9. distribute-frac-negN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right)\right) \]
    10. cosh-undefN/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right)\right) \]
    11. *-lowering-*.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right)\right) \]
    12. cosh-lowering-cosh.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right)\right) \]
    13. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right)\right) \]
    14. fabs-lowering-fabs.f3299.5%

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right)\right) \]
  5. Applied egg-rr99.5%

    \[\leadsto \color{blue}{\frac{1}{s \cdot \left(2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right)}} \]
  6. Add Preprocessing

Alternative 6: 95.1% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \frac{e^{\left|x\right| \cdot \frac{-1}{s}}}{s \cdot 4} \end{array} \]
(FPCore (x s) :precision binary32 (/ (exp (* (fabs x) (/ -1.0 s))) (* s 4.0)))
float code(float x, float s) {
	return expf((fabsf(x) * (-1.0f / s))) / (s * 4.0f);
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = exp((abs(x) * ((-1.0e0) / s))) / (s * 4.0e0)
end function
function code(x, s)
	return Float32(exp(Float32(abs(x) * Float32(Float32(-1.0) / s))) / Float32(s * Float32(4.0)))
end
function tmp = code(x, s)
	tmp = exp((abs(x) * (single(-1.0) / s))) / (s * single(4.0));
end
\begin{array}{l}

\\
\frac{e^{\left|x\right| \cdot \frac{-1}{s}}}{s \cdot 4}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in s around inf

    \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \color{blue}{\left(4 \cdot s\right)}\right) \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \left(s \cdot \color{blue}{4}\right)\right) \]
    2. *-lowering-*.f3295.7%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \mathsf{*.f32}\left(s, \color{blue}{4}\right)\right) \]
  5. Simplified95.7%

    \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\color{blue}{s \cdot 4}} \]
  6. Step-by-step derivation
    1. distribute-frac-negN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\left(\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)\right)\right), \mathsf{*.f32}\left(s, 4\right)\right) \]
    2. clear-numN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{s}{\left|x\right|}}\right)\right)\right), \mathsf{*.f32}\left(s, 4\right)\right) \]
    3. associate-/r/N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\left(\mathsf{neg}\left(\frac{1}{s} \cdot \left|x\right|\right)\right)\right), \mathsf{*.f32}\left(s, 4\right)\right) \]
    4. distribute-lft-neg-inN/A

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{*.f32}\left(\left(\mathsf{neg}\left(\frac{1}{s}\right)\right), \left(\left|x\right|\right)\right)\right), \mathsf{*.f32}\left(s, 4\right)\right) \]
    6. distribute-neg-fracN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{*.f32}\left(\left(\frac{\mathsf{neg}\left(1\right)}{s}\right), \left(\left|x\right|\right)\right)\right), \mathsf{*.f32}\left(s, 4\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{*.f32}\left(\left(\frac{-1}{s}\right), \left(\left|x\right|\right)\right)\right), \mathsf{*.f32}\left(s, 4\right)\right) \]
    8. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(-1, s\right), \left(\left|x\right|\right)\right)\right), \mathsf{*.f32}\left(s, 4\right)\right) \]
    9. fabs-lowering-fabs.f3295.7%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(-1, s\right), \mathsf{fabs.f32}\left(x\right)\right)\right), \mathsf{*.f32}\left(s, 4\right)\right) \]
  7. Applied egg-rr95.7%

    \[\leadsto \frac{e^{\color{blue}{\frac{-1}{s} \cdot \left|x\right|}}}{s \cdot 4} \]
  8. Final simplification95.7%

    \[\leadsto \frac{e^{\left|x\right| \cdot \frac{-1}{s}}}{s \cdot 4} \]
  9. Add Preprocessing

Alternative 7: 95.1% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \frac{e^{\frac{0 - \left|x\right|}{s}}}{s \cdot 4} \end{array} \]
(FPCore (x s) :precision binary32 (/ (exp (/ (- 0.0 (fabs x)) s)) (* s 4.0)))
float code(float x, float s) {
	return expf(((0.0f - fabsf(x)) / s)) / (s * 4.0f);
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = exp(((0.0e0 - abs(x)) / s)) / (s * 4.0e0)
end function
function code(x, s)
	return Float32(exp(Float32(Float32(Float32(0.0) - abs(x)) / s)) / Float32(s * Float32(4.0)))
end
function tmp = code(x, s)
	tmp = exp(((single(0.0) - abs(x)) / s)) / (s * single(4.0));
end
\begin{array}{l}

\\
\frac{e^{\frac{0 - \left|x\right|}{s}}}{s \cdot 4}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in s around inf

    \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \color{blue}{\left(4 \cdot s\right)}\right) \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \left(s \cdot \color{blue}{4}\right)\right) \]
    2. *-lowering-*.f3295.7%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \mathsf{*.f32}\left(s, \color{blue}{4}\right)\right) \]
  5. Simplified95.7%

    \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\color{blue}{s \cdot 4}} \]
  6. Final simplification95.7%

    \[\leadsto \frac{e^{\frac{0 - \left|x\right|}{s}}}{s \cdot 4} \]
  7. Add Preprocessing

Alternative 8: 95.1% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \frac{\frac{0.25}{e^{\frac{\left|x\right|}{s}}}}{s} \end{array} \]
(FPCore (x s) :precision binary32 (/ (/ 0.25 (exp (/ (fabs x) s))) s))
float code(float x, float s) {
	return (0.25f / expf((fabsf(x) / s))) / s;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = (0.25e0 / exp((abs(x) / s))) / s
end function
function code(x, s)
	return Float32(Float32(Float32(0.25) / exp(Float32(abs(x) / s))) / s)
end
function tmp = code(x, s)
	tmp = (single(0.25) / exp((abs(x) / s))) / s;
end
\begin{array}{l}

\\
\frac{\frac{0.25}{e^{\frac{\left|x\right|}{s}}}}{s}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in s around inf

    \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \color{blue}{\left(4 \cdot s\right)}\right) \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \left(s \cdot \color{blue}{4}\right)\right) \]
    2. *-lowering-*.f3295.7%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{fabs.f32}\left(x\right)\right), s\right)\right), \mathsf{*.f32}\left(s, \color{blue}{4}\right)\right) \]
  5. Simplified95.7%

    \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\color{blue}{s \cdot 4}} \]
  6. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{1}{4} \cdot \frac{e^{-1 \cdot \frac{\left|x\right|}{s}}}{s}} \]
  7. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \frac{\frac{1}{4} \cdot e^{-1 \cdot \frac{\left|x\right|}{s}}}{\color{blue}{s}} \]
    2. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{4} \cdot e^{-1 \cdot \frac{\left|x\right|}{s}}\right), \color{blue}{s}\right) \]
    3. mul-1-negN/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{4} \cdot e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right), s\right) \]
    4. rec-expN/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{4} \cdot \frac{1}{e^{\frac{\left|x\right|}{s}}}\right), s\right) \]
    5. associate-*r/N/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{1}{4} \cdot 1}{e^{\frac{\left|x\right|}{s}}}\right), s\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{/.f32}\left(\left(\frac{\frac{1}{4}}{e^{\frac{\left|x\right|}{s}}}\right), s\right) \]
    7. /-lowering-/.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \left(e^{\frac{\left|x\right|}{s}}\right)\right), s\right) \]
    8. exp-lowering-exp.f32N/A

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right), s\right) \]
    10. fabs-lowering-fabs.f3295.6%

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\frac{1}{4}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right), s\right) \]
  8. Simplified95.6%

    \[\leadsto \color{blue}{\frac{\frac{0.25}{e^{\frac{\left|x\right|}{s}}}}{s}} \]
  9. Add Preprocessing

Alternative 9: 82.9% accurate, 16.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1.999999936531045 \cdot 10^{-21}:\\ \;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s}}{2 + 2 \cdot \left(1 + \left(x \cdot x\right) \cdot \left(\frac{\left(x \cdot x\right) \cdot 0.041666666666666664}{s \cdot \left(s \cdot \left(s \cdot s\right)\right)} + \frac{0.5}{s \cdot s}\right)\right)}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x 1.999999936531045e-21)
   (/ (/ 1.0 s) (+ 4.0 (* (/ x s) (/ x s))))
   (/
    (/ 1.0 s)
    (+
     2.0
     (*
      2.0
      (+
       1.0
       (*
        (* x x)
        (+
         (/ (* (* x x) 0.041666666666666664) (* s (* s (* s s))))
         (/ 0.5 (* s s))))))))))
float code(float x, float s) {
	float tmp;
	if (x <= 1.999999936531045e-21f) {
		tmp = (1.0f / s) / (4.0f + ((x / s) * (x / s)));
	} else {
		tmp = (1.0f / s) / (2.0f + (2.0f * (1.0f + ((x * x) * ((((x * x) * 0.041666666666666664f) / (s * (s * (s * s)))) + (0.5f / (s * s)))))));
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= 1.999999936531045e-21) then
        tmp = (1.0e0 / s) / (4.0e0 + ((x / s) * (x / s)))
    else
        tmp = (1.0e0 / s) / (2.0e0 + (2.0e0 * (1.0e0 + ((x * x) * ((((x * x) * 0.041666666666666664e0) / (s * (s * (s * s)))) + (0.5e0 / (s * s)))))))
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(1.999999936531045e-21))
		tmp = Float32(Float32(Float32(1.0) / s) / Float32(Float32(4.0) + Float32(Float32(x / s) * Float32(x / s))));
	else
		tmp = Float32(Float32(Float32(1.0) / s) / Float32(Float32(2.0) + Float32(Float32(2.0) * Float32(Float32(1.0) + Float32(Float32(x * x) * Float32(Float32(Float32(Float32(x * x) * Float32(0.041666666666666664)) / Float32(s * Float32(s * Float32(s * s)))) + Float32(Float32(0.5) / Float32(s * s))))))));
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(1.999999936531045e-21))
		tmp = (single(1.0) / s) / (single(4.0) + ((x / s) * (x / s)));
	else
		tmp = (single(1.0) / s) / (single(2.0) + (single(2.0) * (single(1.0) + ((x * x) * ((((x * x) * single(0.041666666666666664)) / (s * (s * (s * s)))) + (single(0.5) / (s * s)))))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.999999936531045 \cdot 10^{-21}:\\
\;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{s}}{2 + 2 \cdot \left(1 + \left(x \cdot x\right) \cdot \left(\frac{\left(x \cdot x\right) \cdot 0.041666666666666664}{s \cdot \left(s \cdot \left(s \cdot s\right)\right)} + \frac{0.5}{s \cdot s}\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.9999999e-21

    1. Initial program 99.8%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified99.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f3299.8%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3274.4%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified74.4%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Step-by-step derivation
      1. times-fracN/A

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

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(x, s\right), \mathsf{/.f32}\left(x, s\right)\right), 4\right)\right) \]
    10. Applied egg-rr76.6%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x}{s} \cdot \frac{x}{s}} + 4} \]

    if 1.9999999e-21 < x

    1. Initial program 99.7%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified99.1%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f3299.1%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr99.1%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around -inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\left(1 + \left(-1 \cdot \frac{\frac{-1}{2} \cdot \left(\frac{1}{2} \cdot {\left(\left|x\right|\right)}^{3} + \left|x\right| \cdot \left(-1 \cdot {\left(\left|x\right|\right)}^{2} + \frac{1}{2} \cdot {\left(\left|x\right|\right)}^{2}\right)\right) + \frac{1}{2} \cdot \frac{\frac{-1}{2} \cdot \left({\left(\left|x\right|\right)}^{2} \cdot \left(-1 \cdot {\left(\left|x\right|\right)}^{2} + \frac{1}{2} \cdot {\left(\left|x\right|\right)}^{2}\right)\right) + \left(\frac{-1}{6} \cdot {\left(\left|x\right|\right)}^{4} + \left|x\right| \cdot \left(\frac{-1}{6} \cdot {\left(\left|x\right|\right)}^{3} + \left(\frac{1}{2} \cdot {\left(\left|x\right|\right)}^{3} + \left|x\right| \cdot \left(-1 \cdot {\left(\left|x\right|\right)}^{2} + \frac{1}{2} \cdot {\left(\left|x\right|\right)}^{2}\right)\right)\right)\right)}{s}}{{s}^{3}} + \frac{1}{2} \cdot \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)\right)}\right)\right)\right) \]
    7. Simplified33.9%

      \[\leadsto \frac{\frac{1}{s}}{2 + 2 \cdot \color{blue}{\left(\left(1 + \frac{\left(x \cdot x\right) \cdot 0.5}{s \cdot s}\right) - \frac{\frac{0.5 \cdot \left(0.25 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + \left(\left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot -0.16666666666666666 + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot -0.16666666666666666\right) + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot 0.5\right) + \left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.5\right)\right)\right)\right)}{s} + 0}{s \cdot \left(s \cdot s\right)}\right)}} \]
    8. Taylor expanded in x around 0

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\left({x}^{2}\right), \color{blue}{\left(\frac{1}{24} \cdot \frac{{x}^{2}}{{s}^{4}} + \frac{1}{2} \cdot \frac{1}{{s}^{2}}\right)}\right)\right)\right)\right)\right) \]
      3. unpow2N/A

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{+.f32}\left(1, \mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{+.f32}\left(\left(\frac{1}{24} \cdot \frac{{x}^{2}}{{s}^{4}}\right), \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{{s}^{2}}\right)}\right)\right)\right)\right)\right)\right) \]
    10. Simplified93.9%

      \[\leadsto \frac{\frac{1}{s}}{2 + 2 \cdot \color{blue}{\left(1 + \left(x \cdot x\right) \cdot \left(\frac{\left(x \cdot x\right) \cdot 0.041666666666666664}{s \cdot \left(s \cdot \left(s \cdot s\right)\right)} + \frac{0.5}{s \cdot s}\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.999999936531045 \cdot 10^{-21}:\\ \;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s}}{2 + 2 \cdot \left(1 + \left(x \cdot x\right) \cdot \left(\frac{\left(x \cdot x\right) \cdot 0.041666666666666664}{s \cdot \left(s \cdot \left(s \cdot s\right)\right)} + \frac{0.5}{s \cdot s}\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 83.3% accurate, 17.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 5.000000136226006 \cdot 10^{-28}:\\ \;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\ \mathbf{elif}\;x \leq 4.999999980020986 \cdot 10^{-12}:\\ \;\;\;\;\frac{\frac{1}{4 + x \cdot \frac{x}{s \cdot s}}}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s}}{2 + 2 \cdot \left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{0.041666666666666664}{s \cdot \left(s \cdot \left(s \cdot s\right)\right)}\right)}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x 5.000000136226006e-28)
   (/ (/ 1.0 s) (+ 4.0 (* (/ x s) (/ x s))))
   (if (<= x 4.999999980020986e-12)
     (/ (/ 1.0 (+ 4.0 (* x (/ x (* s s))))) s)
     (/
      (/ 1.0 s)
      (+
       2.0
       (*
        2.0
        (*
         (* (* x x) (* x x))
         (/ 0.041666666666666664 (* s (* s (* s s)))))))))))
float code(float x, float s) {
	float tmp;
	if (x <= 5.000000136226006e-28f) {
		tmp = (1.0f / s) / (4.0f + ((x / s) * (x / s)));
	} else if (x <= 4.999999980020986e-12f) {
		tmp = (1.0f / (4.0f + (x * (x / (s * s))))) / s;
	} else {
		tmp = (1.0f / s) / (2.0f + (2.0f * (((x * x) * (x * x)) * (0.041666666666666664f / (s * (s * (s * s)))))));
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= 5.000000136226006e-28) then
        tmp = (1.0e0 / s) / (4.0e0 + ((x / s) * (x / s)))
    else if (x <= 4.999999980020986e-12) then
        tmp = (1.0e0 / (4.0e0 + (x * (x / (s * s))))) / s
    else
        tmp = (1.0e0 / s) / (2.0e0 + (2.0e0 * (((x * x) * (x * x)) * (0.041666666666666664e0 / (s * (s * (s * s)))))))
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(5.000000136226006e-28))
		tmp = Float32(Float32(Float32(1.0) / s) / Float32(Float32(4.0) + Float32(Float32(x / s) * Float32(x / s))));
	elseif (x <= Float32(4.999999980020986e-12))
		tmp = Float32(Float32(Float32(1.0) / Float32(Float32(4.0) + Float32(x * Float32(x / Float32(s * s))))) / s);
	else
		tmp = Float32(Float32(Float32(1.0) / s) / Float32(Float32(2.0) + Float32(Float32(2.0) * Float32(Float32(Float32(x * x) * Float32(x * x)) * Float32(Float32(0.041666666666666664) / Float32(s * Float32(s * Float32(s * s))))))));
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(5.000000136226006e-28))
		tmp = (single(1.0) / s) / (single(4.0) + ((x / s) * (x / s)));
	elseif (x <= single(4.999999980020986e-12))
		tmp = (single(1.0) / (single(4.0) + (x * (x / (s * s))))) / s;
	else
		tmp = (single(1.0) / s) / (single(2.0) + (single(2.0) * (((x * x) * (x * x)) * (single(0.041666666666666664) / (s * (s * (s * s)))))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.000000136226006 \cdot 10^{-28}:\\
\;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\

\mathbf{elif}\;x \leq 4.999999980020986 \cdot 10^{-12}:\\
\;\;\;\;\frac{\frac{1}{4 + x \cdot \frac{x}{s \cdot s}}}{s}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{s}}{2 + 2 \cdot \left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{0.041666666666666664}{s \cdot \left(s \cdot \left(s \cdot s\right)\right)}\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 5.00000014e-28

    1. Initial program 99.8%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified99.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f3299.8%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3274.5%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified74.5%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Step-by-step derivation
      1. times-fracN/A

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(x, s\right), \left(\frac{x}{s}\right)\right), 4\right)\right) \]
      4. /-lowering-/.f3276.9%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(x, s\right), \mathsf{/.f32}\left(x, s\right)\right), 4\right)\right) \]
    10. Applied egg-rr76.9%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x}{s} \cdot \frac{x}{s}} + 4} \]

    if 5.00000014e-28 < x < 4.99999998e-12

    1. Initial program 99.9%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + 2\right)\right), s\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right), 2\right)\right), s\right) \]
      3. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\left|x\right|}{s}}\right), 2\right)\right), s\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\frac{\left|x\right|}{s}} + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right), 2\right)\right), s\right) \]
      5. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right), 2\right)\right), s\right) \]
      6. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right), 2\right)\right), s\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \cosh \left(\frac{\left|x\right|}{s}\right)\right), 2\right)\right), s\right) \]
      8. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right), 2\right)\right), s\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right), 2\right)\right), s\right) \]
      10. fabs-lowering-fabs.f32100.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right), 2\right)\right), s\right) \]
    5. Applied egg-rr100.0%

      \[\leadsto \frac{\frac{1}{\color{blue}{2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right) + 2}}}{s} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right), s\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + 4\right)\right), s\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right), 4\right)\right), s\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(\frac{\left|x\right| \cdot \left|x\right|}{{s}^{2}}\right), 4\right)\right), s\right) \]
      4. sqr-absN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(\frac{x \cdot x}{{s}^{2}}\right), 4\right)\right), s\right) \]
      5. associate-/l*N/A

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \left({s}^{2}\right)\right)\right), 4\right)\right), s\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \left(s \cdot s\right)\right)\right), 4\right)\right), s\right) \]
      9. *-lowering-*.f3288.8%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \mathsf{*.f32}\left(s, s\right)\right)\right), 4\right)\right), s\right) \]
    8. Simplified88.8%

      \[\leadsto \frac{\frac{1}{\color{blue}{x \cdot \frac{x}{s \cdot s} + 4}}}{s} \]

    if 4.99999998e-12 < x

    1. Initial program 99.7%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified98.9%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f3299.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr99.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around -inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\left(1 + \left(-1 \cdot \frac{\frac{-1}{2} \cdot \left(\frac{1}{2} \cdot {\left(\left|x\right|\right)}^{3} + \left|x\right| \cdot \left(-1 \cdot {\left(\left|x\right|\right)}^{2} + \frac{1}{2} \cdot {\left(\left|x\right|\right)}^{2}\right)\right) + \frac{1}{2} \cdot \frac{\frac{-1}{2} \cdot \left({\left(\left|x\right|\right)}^{2} \cdot \left(-1 \cdot {\left(\left|x\right|\right)}^{2} + \frac{1}{2} \cdot {\left(\left|x\right|\right)}^{2}\right)\right) + \left(\frac{-1}{6} \cdot {\left(\left|x\right|\right)}^{4} + \left|x\right| \cdot \left(\frac{-1}{6} \cdot {\left(\left|x\right|\right)}^{3} + \left(\frac{1}{2} \cdot {\left(\left|x\right|\right)}^{3} + \left|x\right| \cdot \left(-1 \cdot {\left(\left|x\right|\right)}^{2} + \frac{1}{2} \cdot {\left(\left|x\right|\right)}^{2}\right)\right)\right)\right)}{s}}{{s}^{3}} + \frac{1}{2} \cdot \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)\right)}\right)\right)\right) \]
    7. Simplified33.0%

      \[\leadsto \frac{\frac{1}{s}}{2 + 2 \cdot \color{blue}{\left(\left(1 + \frac{\left(x \cdot x\right) \cdot 0.5}{s \cdot s}\right) - \frac{\frac{0.5 \cdot \left(0.25 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + \left(\left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot -0.16666666666666666 + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot -0.16666666666666666\right) + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot 0.5\right) + \left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.5\right)\right)\right)\right)}{s} + 0}{s \cdot \left(s \cdot s\right)}\right)}} \]
    8. Taylor expanded in x around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\left(\frac{1}{24} \cdot \frac{{x}^{4}}{{s}^{4}}\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\left({x}^{\left(2 \cdot 2\right)}\right), \left(\frac{1}{24} \cdot \frac{1}{{s}^{4}}\right)\right)\right)\right)\right) \]
      8. pow-sqrN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\left({x}^{2}\right), \left({x}^{2}\right)\right), \left(\color{blue}{\frac{1}{24}} \cdot \frac{1}{{s}^{4}}\right)\right)\right)\right)\right) \]
      10. unpow2N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({x}^{2}\right)\right), \left(\frac{1}{24} \cdot \frac{1}{{s}^{4}}\right)\right)\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(x \cdot x\right)\right), \left(\frac{1}{24} \cdot \frac{1}{{s}^{4}}\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f32N/A

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, x\right)\right), \left(\frac{\frac{1}{24}}{{\color{blue}{s}}^{4}}\right)\right)\right)\right)\right) \]
      16. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, x\right)\right), \mathsf{/.f32}\left(\frac{1}{24}, \color{blue}{\left({s}^{4}\right)}\right)\right)\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, x\right)\right), \mathsf{/.f32}\left(\frac{1}{24}, \left({s}^{\left(2 \cdot \color{blue}{2}\right)}\right)\right)\right)\right)\right)\right) \]
      18. pow-sqrN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, x\right)\right), \mathsf{/.f32}\left(\frac{1}{24}, \left({s}^{2} \cdot \color{blue}{{s}^{2}}\right)\right)\right)\right)\right)\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, x\right)\right), \mathsf{/.f32}\left(\frac{1}{24}, \left(\left(s \cdot s\right) \cdot {\color{blue}{s}}^{2}\right)\right)\right)\right)\right)\right) \]
      20. associate-*l*N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, x\right)\right), \mathsf{/.f32}\left(\frac{1}{24}, \left(s \cdot \color{blue}{\left(s \cdot {s}^{2}\right)}\right)\right)\right)\right)\right)\right) \]
      21. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, x\right)\right), \mathsf{/.f32}\left(\frac{1}{24}, \left(s \cdot \left(s \cdot \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right)\right)\right)\right) \]
      22. cube-multN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, x\right)\right), \mathsf{/.f32}\left(\frac{1}{24}, \mathsf{*.f32}\left(s, \color{blue}{\left({s}^{3}\right)}\right)\right)\right)\right)\right)\right) \]
      24. cube-multN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, x\right)\right), \mathsf{/.f32}\left(\frac{1}{24}, \mathsf{*.f32}\left(s, \left(s \cdot \color{blue}{\left(s \cdot s\right)}\right)\right)\right)\right)\right)\right)\right) \]
      25. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, x\right)\right), \mathsf{/.f32}\left(\frac{1}{24}, \mathsf{*.f32}\left(s, \left(s \cdot {s}^{\color{blue}{2}}\right)\right)\right)\right)\right)\right)\right) \]
      26. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, x\right)\right), \mathsf{/.f32}\left(\frac{1}{24}, \mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, \color{blue}{\left({s}^{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
      27. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, x\right)\right), \mathsf{/.f32}\left(\frac{1}{24}, \mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, \left(s \cdot \color{blue}{s}\right)\right)\right)\right)\right)\right)\right)\right) \]
      28. *-lowering-*.f3291.5%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, x\right)\right), \mathsf{/.f32}\left(\frac{1}{24}, \mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, \color{blue}{s}\right)\right)\right)\right)\right)\right)\right)\right) \]
    10. Simplified91.5%

      \[\leadsto \frac{\frac{1}{s}}{2 + 2 \cdot \color{blue}{\left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{0.041666666666666664}{s \cdot \left(s \cdot \left(s \cdot s\right)\right)}\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification83.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.000000136226006 \cdot 10^{-28}:\\ \;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\ \mathbf{elif}\;x \leq 4.999999980020986 \cdot 10^{-12}:\\ \;\;\;\;\frac{\frac{1}{4 + x \cdot \frac{x}{s \cdot s}}}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s}}{2 + 2 \cdot \left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{0.041666666666666664}{s \cdot \left(s \cdot \left(s \cdot s\right)\right)}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 81.7% accurate, 24.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 5.000000136226006 \cdot 10^{-28}:\\ \;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\ \mathbf{elif}\;x \leq 1.4999999397961872 \cdot 10^{-13}:\\ \;\;\;\;\frac{\frac{1}{4 + x \cdot \frac{x}{s \cdot s}}}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{s \cdot \left(\left(s \cdot s\right) \cdot -4\right)}{x \cdot x}}{x \cdot x}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x 5.000000136226006e-28)
   (/ (/ 1.0 s) (+ 4.0 (* (/ x s) (/ x s))))
   (if (<= x 1.4999999397961872e-13)
     (/ (/ 1.0 (+ 4.0 (* x (/ x (* s s))))) s)
     (/ (/ (* s (* (* s s) -4.0)) (* x x)) (* x x)))))
float code(float x, float s) {
	float tmp;
	if (x <= 5.000000136226006e-28f) {
		tmp = (1.0f / s) / (4.0f + ((x / s) * (x / s)));
	} else if (x <= 1.4999999397961872e-13f) {
		tmp = (1.0f / (4.0f + (x * (x / (s * s))))) / s;
	} else {
		tmp = ((s * ((s * s) * -4.0f)) / (x * x)) / (x * x);
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= 5.000000136226006e-28) then
        tmp = (1.0e0 / s) / (4.0e0 + ((x / s) * (x / s)))
    else if (x <= 1.4999999397961872e-13) then
        tmp = (1.0e0 / (4.0e0 + (x * (x / (s * s))))) / s
    else
        tmp = ((s * ((s * s) * (-4.0e0))) / (x * x)) / (x * x)
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(5.000000136226006e-28))
		tmp = Float32(Float32(Float32(1.0) / s) / Float32(Float32(4.0) + Float32(Float32(x / s) * Float32(x / s))));
	elseif (x <= Float32(1.4999999397961872e-13))
		tmp = Float32(Float32(Float32(1.0) / Float32(Float32(4.0) + Float32(x * Float32(x / Float32(s * s))))) / s);
	else
		tmp = Float32(Float32(Float32(s * Float32(Float32(s * s) * Float32(-4.0))) / Float32(x * x)) / Float32(x * x));
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(5.000000136226006e-28))
		tmp = (single(1.0) / s) / (single(4.0) + ((x / s) * (x / s)));
	elseif (x <= single(1.4999999397961872e-13))
		tmp = (single(1.0) / (single(4.0) + (x * (x / (s * s))))) / s;
	else
		tmp = ((s * ((s * s) * single(-4.0))) / (x * x)) / (x * x);
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.000000136226006 \cdot 10^{-28}:\\
\;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\

\mathbf{elif}\;x \leq 1.4999999397961872 \cdot 10^{-13}:\\
\;\;\;\;\frac{\frac{1}{4 + x \cdot \frac{x}{s \cdot s}}}{s}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{s \cdot \left(\left(s \cdot s\right) \cdot -4\right)}{x \cdot x}}{x \cdot x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 5.00000014e-28

    1. Initial program 99.8%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified99.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f3299.8%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3274.5%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified74.5%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Step-by-step derivation
      1. times-fracN/A

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(x, s\right), \left(\frac{x}{s}\right)\right), 4\right)\right) \]
      4. /-lowering-/.f3276.9%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(x, s\right), \mathsf{/.f32}\left(x, s\right)\right), 4\right)\right) \]
    10. Applied egg-rr76.9%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x}{s} \cdot \frac{x}{s}} + 4} \]

    if 5.00000014e-28 < x < 1.49999994e-13

    1. Initial program 99.9%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + 2\right)\right), s\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right), 2\right)\right), s\right) \]
      3. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\left|x\right|}{s}}\right), 2\right)\right), s\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\frac{\left|x\right|}{s}} + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right), 2\right)\right), s\right) \]
      5. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right), 2\right)\right), s\right) \]
      6. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right), 2\right)\right), s\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \cosh \left(\frac{\left|x\right|}{s}\right)\right), 2\right)\right), s\right) \]
      8. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right), 2\right)\right), s\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right), 2\right)\right), s\right) \]
      10. fabs-lowering-fabs.f32100.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right), 2\right)\right), s\right) \]
    5. Applied egg-rr100.0%

      \[\leadsto \frac{\frac{1}{\color{blue}{2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right) + 2}}}{s} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right), s\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + 4\right)\right), s\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right), 4\right)\right), s\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(\frac{\left|x\right| \cdot \left|x\right|}{{s}^{2}}\right), 4\right)\right), s\right) \]
      4. sqr-absN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(\frac{x \cdot x}{{s}^{2}}\right), 4\right)\right), s\right) \]
      5. associate-/l*N/A

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \left({s}^{2}\right)\right)\right), 4\right)\right), s\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \left(s \cdot s\right)\right)\right), 4\right)\right), s\right) \]
      9. *-lowering-*.f3295.6%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \mathsf{*.f32}\left(s, s\right)\right)\right), 4\right)\right), s\right) \]
    8. Simplified95.6%

      \[\leadsto \frac{\frac{1}{\color{blue}{x \cdot \frac{x}{s \cdot s} + 4}}}{s} \]

    if 1.49999994e-13 < x

    1. Initial program 99.7%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified99.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f3299.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr99.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3278.1%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified78.1%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{s + -4 \cdot \frac{{s}^{3}}{{x}^{2}}}{{x}^{2}}} \]
    10. Step-by-step derivation
      1. /-lowering-/.f32N/A

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \left(\frac{-4 \cdot {s}^{3}}{{x}^{2}}\right)\right), \left({x}^{2}\right)\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\left(-4 \cdot {s}^{3}\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      5. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left({s}^{3}\right), -4\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      7. cube-multN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(s \cdot \left(s \cdot s\right)\right), -4\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(s \cdot {s}^{2}\right), -4\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \left({s}^{2}\right)\right), -4\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \left(s \cdot s\right)\right), -4\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, s\right)\right), -4\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, s\right)\right), -4\right), \left(x \cdot x\right)\right)\right), \left({x}^{2}\right)\right) \]
      13. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, s\right)\right), -4\right), \mathsf{*.f32}\left(x, x\right)\right)\right), \left({x}^{2}\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, s\right)\right), -4\right), \mathsf{*.f32}\left(x, x\right)\right)\right), \left(x \cdot \color{blue}{x}\right)\right) \]
      15. *-lowering-*.f3256.5%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, s\right)\right), -4\right), \mathsf{*.f32}\left(x, x\right)\right)\right), \mathsf{*.f32}\left(x, \color{blue}{x}\right)\right) \]
    11. Simplified56.5%

      \[\leadsto \color{blue}{\frac{s + \frac{\left(s \cdot \left(s \cdot s\right)\right) \cdot -4}{x \cdot x}}{x \cdot x}} \]
    12. Taylor expanded in s around inf

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(-4 \cdot {s}^{3}\right), \left({x}^{2}\right)\right), \mathsf{*.f32}\left(\color{blue}{x}, x\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left({s}^{3} \cdot -4\right), \left({x}^{2}\right)\right), \mathsf{*.f32}\left(x, x\right)\right) \]
      4. cube-multN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\left(s \cdot \left(s \cdot s\right)\right) \cdot -4\right), \left({x}^{2}\right)\right), \mathsf{*.f32}\left(x, x\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\left(s \cdot {s}^{2}\right) \cdot -4\right), \left({x}^{2}\right)\right), \mathsf{*.f32}\left(x, x\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(s \cdot \left({s}^{2} \cdot -4\right)\right), \left({x}^{2}\right)\right), \mathsf{*.f32}\left(x, x\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(s \cdot \left(-4 \cdot {s}^{2}\right)\right), \left({x}^{2}\right)\right), \mathsf{*.f32}\left(x, x\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \left(-4 \cdot {s}^{2}\right)\right), \left({x}^{2}\right)\right), \mathsf{*.f32}\left(x, x\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \left({s}^{2} \cdot -4\right)\right), \left({x}^{2}\right)\right), \mathsf{*.f32}\left(x, x\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\left({s}^{2}\right), -4\right)\right), \left({x}^{2}\right)\right), \mathsf{*.f32}\left(x, x\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\left(s \cdot s\right), -4\right)\right), \left({x}^{2}\right)\right), \mathsf{*.f32}\left(x, x\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, s\right), -4\right)\right), \left({x}^{2}\right)\right), \mathsf{*.f32}\left(x, x\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, s\right), -4\right)\right), \left(x \cdot x\right)\right), \mathsf{*.f32}\left(x, x\right)\right) \]
      14. *-lowering-*.f3287.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, s\right), -4\right)\right), \mathsf{*.f32}\left(x, x\right)\right), \mathsf{*.f32}\left(x, x\right)\right) \]
    14. Simplified87.0%

      \[\leadsto \frac{\color{blue}{\frac{s \cdot \left(\left(s \cdot s\right) \cdot -4\right)}{x \cdot x}}}{x \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.000000136226006 \cdot 10^{-28}:\\ \;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\ \mathbf{elif}\;x \leq 1.4999999397961872 \cdot 10^{-13}:\\ \;\;\;\;\frac{\frac{1}{4 + x \cdot \frac{x}{s \cdot s}}}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{s \cdot \left(\left(s \cdot s\right) \cdot -4\right)}{x \cdot x}}{x \cdot x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 81.8% accurate, 24.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 5.000000136226006 \cdot 10^{-28}:\\ \;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\ \mathbf{elif}\;x \leq 4.999999980020986 \cdot 10^{-12}:\\ \;\;\;\;\frac{\frac{1}{4 + x \cdot \frac{x}{s \cdot s}}}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{s \cdot \left(\left(s \cdot s\right) \cdot -4\right)}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x 5.000000136226006e-28)
   (/ (/ 1.0 s) (+ 4.0 (* (/ x s) (/ x s))))
   (if (<= x 4.999999980020986e-12)
     (/ (/ 1.0 (+ 4.0 (* x (/ x (* s s))))) s)
     (/ (* s (* (* s s) -4.0)) (* (* x x) (* x x))))))
float code(float x, float s) {
	float tmp;
	if (x <= 5.000000136226006e-28f) {
		tmp = (1.0f / s) / (4.0f + ((x / s) * (x / s)));
	} else if (x <= 4.999999980020986e-12f) {
		tmp = (1.0f / (4.0f + (x * (x / (s * s))))) / s;
	} else {
		tmp = (s * ((s * s) * -4.0f)) / ((x * x) * (x * x));
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= 5.000000136226006e-28) then
        tmp = (1.0e0 / s) / (4.0e0 + ((x / s) * (x / s)))
    else if (x <= 4.999999980020986e-12) then
        tmp = (1.0e0 / (4.0e0 + (x * (x / (s * s))))) / s
    else
        tmp = (s * ((s * s) * (-4.0e0))) / ((x * x) * (x * x))
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(5.000000136226006e-28))
		tmp = Float32(Float32(Float32(1.0) / s) / Float32(Float32(4.0) + Float32(Float32(x / s) * Float32(x / s))));
	elseif (x <= Float32(4.999999980020986e-12))
		tmp = Float32(Float32(Float32(1.0) / Float32(Float32(4.0) + Float32(x * Float32(x / Float32(s * s))))) / s);
	else
		tmp = Float32(Float32(s * Float32(Float32(s * s) * Float32(-4.0))) / Float32(Float32(x * x) * Float32(x * x)));
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(5.000000136226006e-28))
		tmp = (single(1.0) / s) / (single(4.0) + ((x / s) * (x / s)));
	elseif (x <= single(4.999999980020986e-12))
		tmp = (single(1.0) / (single(4.0) + (x * (x / (s * s))))) / s;
	else
		tmp = (s * ((s * s) * single(-4.0))) / ((x * x) * (x * x));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.000000136226006 \cdot 10^{-28}:\\
\;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\

\mathbf{elif}\;x \leq 4.999999980020986 \cdot 10^{-12}:\\
\;\;\;\;\frac{\frac{1}{4 + x \cdot \frac{x}{s \cdot s}}}{s}\\

\mathbf{else}:\\
\;\;\;\;\frac{s \cdot \left(\left(s \cdot s\right) \cdot -4\right)}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 5.00000014e-28

    1. Initial program 99.8%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified99.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f3299.8%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3274.5%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified74.5%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Step-by-step derivation
      1. times-fracN/A

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(x, s\right), \left(\frac{x}{s}\right)\right), 4\right)\right) \]
      4. /-lowering-/.f3276.9%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(x, s\right), \mathsf{/.f32}\left(x, s\right)\right), 4\right)\right) \]
    10. Applied egg-rr76.9%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x}{s} \cdot \frac{x}{s}} + 4} \]

    if 5.00000014e-28 < x < 4.99999998e-12

    1. Initial program 99.9%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + 2\right)\right), s\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right), 2\right)\right), s\right) \]
      3. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\left|x\right|}{s}}\right), 2\right)\right), s\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\frac{\left|x\right|}{s}} + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right), 2\right)\right), s\right) \]
      5. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right), 2\right)\right), s\right) \]
      6. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right), 2\right)\right), s\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \cosh \left(\frac{\left|x\right|}{s}\right)\right), 2\right)\right), s\right) \]
      8. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right), 2\right)\right), s\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right), 2\right)\right), s\right) \]
      10. fabs-lowering-fabs.f32100.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right), 2\right)\right), s\right) \]
    5. Applied egg-rr100.0%

      \[\leadsto \frac{\frac{1}{\color{blue}{2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right) + 2}}}{s} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right), s\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + 4\right)\right), s\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right), 4\right)\right), s\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(\frac{\left|x\right| \cdot \left|x\right|}{{s}^{2}}\right), 4\right)\right), s\right) \]
      4. sqr-absN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(\frac{x \cdot x}{{s}^{2}}\right), 4\right)\right), s\right) \]
      5. associate-/l*N/A

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \left({s}^{2}\right)\right)\right), 4\right)\right), s\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \left(s \cdot s\right)\right)\right), 4\right)\right), s\right) \]
      9. *-lowering-*.f3288.8%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \mathsf{*.f32}\left(s, s\right)\right)\right), 4\right)\right), s\right) \]
    8. Simplified88.8%

      \[\leadsto \frac{\frac{1}{\color{blue}{x \cdot \frac{x}{s \cdot s} + 4}}}{s} \]

    if 4.99999998e-12 < x

    1. Initial program 99.7%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified98.9%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f3299.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr99.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3279.4%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified79.4%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{s + -4 \cdot \frac{{s}^{3}}{{x}^{2}}}{{x}^{2}}} \]
    10. Step-by-step derivation
      1. /-lowering-/.f32N/A

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \left(\frac{-4 \cdot {s}^{3}}{{x}^{2}}\right)\right), \left({x}^{2}\right)\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\left(-4 \cdot {s}^{3}\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      5. *-commutativeN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left({s}^{3}\right), -4\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      7. cube-multN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(s \cdot \left(s \cdot s\right)\right), -4\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\left(s \cdot {s}^{2}\right), -4\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      9. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \left({s}^{2}\right)\right), -4\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \left(s \cdot s\right)\right), -4\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      11. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, s\right)\right), -4\right), \left({x}^{2}\right)\right)\right), \left({x}^{2}\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, s\right)\right), -4\right), \left(x \cdot x\right)\right)\right), \left({x}^{2}\right)\right) \]
      13. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, s\right)\right), -4\right), \mathsf{*.f32}\left(x, x\right)\right)\right), \left({x}^{2}\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, s\right)\right), -4\right), \mathsf{*.f32}\left(x, x\right)\right)\right), \left(x \cdot \color{blue}{x}\right)\right) \]
      15. *-lowering-*.f3258.1%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{+.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(s, s\right)\right), -4\right), \mathsf{*.f32}\left(x, x\right)\right)\right), \mathsf{*.f32}\left(x, \color{blue}{x}\right)\right) \]
    11. Simplified58.1%

      \[\leadsto \color{blue}{\frac{s + \frac{\left(s \cdot \left(s \cdot s\right)\right) \cdot -4}{x \cdot x}}{x \cdot x}} \]
    12. Taylor expanded in s around inf

      \[\leadsto \color{blue}{-4 \cdot \frac{{s}^{3}}{{x}^{4}}} \]
    13. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \frac{-4 \cdot {s}^{3}}{\color{blue}{{x}^{4}}} \]
      2. /-lowering-/.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\left({s}^{3} \cdot -4\right), \left({\color{blue}{x}}^{4}\right)\right) \]
      4. cube-multN/A

        \[\leadsto \mathsf{/.f32}\left(\left(\left(s \cdot \left(s \cdot s\right)\right) \cdot -4\right), \left({x}^{4}\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\left(s \cdot {s}^{2}\right) \cdot -4\right), \left({x}^{4}\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f32}\left(\left(s \cdot \left({s}^{2} \cdot -4\right)\right), \left({\color{blue}{x}}^{4}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\left(s \cdot \left(-4 \cdot {s}^{2}\right)\right), \left({x}^{4}\right)\right) \]
      8. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \left(-4 \cdot {s}^{2}\right)\right), \left({\color{blue}{x}}^{4}\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \left({s}^{2} \cdot -4\right)\right), \left({x}^{4}\right)\right) \]
      10. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\left({s}^{2}\right), -4\right)\right), \left({x}^{4}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\left(s \cdot s\right), -4\right)\right), \left({x}^{4}\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, s\right), -4\right)\right), \left({x}^{4}\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, s\right), -4\right)\right), \left({x}^{\left(2 \cdot \color{blue}{2}\right)}\right)\right) \]
      14. pow-sqrN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, s\right), -4\right)\right), \left({x}^{2} \cdot \color{blue}{{x}^{2}}\right)\right) \]
      15. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, s\right), -4\right)\right), \mathsf{*.f32}\left(\left({x}^{2}\right), \color{blue}{\left({x}^{2}\right)}\right)\right) \]
      16. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, s\right), -4\right)\right), \mathsf{*.f32}\left(\left(x \cdot x\right), \left({\color{blue}{x}}^{2}\right)\right)\right) \]
      17. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, s\right), -4\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({\color{blue}{x}}^{2}\right)\right)\right) \]
      18. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, s\right), -4\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(x \cdot \color{blue}{x}\right)\right)\right) \]
      19. *-lowering-*.f3287.6%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{*.f32}\left(\mathsf{*.f32}\left(s, s\right), -4\right)\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(x, \color{blue}{x}\right)\right)\right) \]
    14. Simplified87.6%

      \[\leadsto \color{blue}{\frac{s \cdot \left(\left(s \cdot s\right) \cdot -4\right)}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.000000136226006 \cdot 10^{-28}:\\ \;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\ \mathbf{elif}\;x \leq 4.999999980020986 \cdot 10^{-12}:\\ \;\;\;\;\frac{\frac{1}{4 + x \cdot \frac{x}{s \cdot s}}}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{s \cdot \left(\left(s \cdot s\right) \cdot -4\right)}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 80.1% accurate, 34.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 5.000000136226006 \cdot 10^{-28}:\\ \;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{4 + x \cdot \frac{x}{s \cdot s}}}{s}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x 5.000000136226006e-28)
   (/ (/ 1.0 s) (+ 4.0 (* (/ x s) (/ x s))))
   (/ (/ 1.0 (+ 4.0 (* x (/ x (* s s))))) s)))
float code(float x, float s) {
	float tmp;
	if (x <= 5.000000136226006e-28f) {
		tmp = (1.0f / s) / (4.0f + ((x / s) * (x / s)));
	} else {
		tmp = (1.0f / (4.0f + (x * (x / (s * s))))) / s;
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= 5.000000136226006e-28) then
        tmp = (1.0e0 / s) / (4.0e0 + ((x / s) * (x / s)))
    else
        tmp = (1.0e0 / (4.0e0 + (x * (x / (s * s))))) / s
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(5.000000136226006e-28))
		tmp = Float32(Float32(Float32(1.0) / s) / Float32(Float32(4.0) + Float32(Float32(x / s) * Float32(x / s))));
	else
		tmp = Float32(Float32(Float32(1.0) / Float32(Float32(4.0) + Float32(x * Float32(x / Float32(s * s))))) / s);
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(5.000000136226006e-28))
		tmp = (single(1.0) / s) / (single(4.0) + ((x / s) * (x / s)));
	else
		tmp = (single(1.0) / (single(4.0) + (x * (x / (s * s))))) / s;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.000000136226006 \cdot 10^{-28}:\\
\;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{4 + x \cdot \frac{x}{s \cdot s}}}{s}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 5.00000014e-28

    1. Initial program 99.8%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified99.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f3299.8%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3274.5%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified74.5%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Step-by-step derivation
      1. times-fracN/A

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(x, s\right), \left(\frac{x}{s}\right)\right), 4\right)\right) \]
      4. /-lowering-/.f3276.9%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(x, s\right), \mathsf{/.f32}\left(x, s\right)\right), 4\right)\right) \]
    10. Applied egg-rr76.9%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x}{s} \cdot \frac{x}{s}} + 4} \]

    if 5.00000014e-28 < x

    1. Initial program 99.7%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified99.2%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + 2\right)\right), s\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right), 2\right)\right), s\right) \]
      3. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\left|x\right|}{s}}\right), 2\right)\right), s\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\frac{\left|x\right|}{s}} + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right), 2\right)\right), s\right) \]
      5. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right), 2\right)\right), s\right) \]
      6. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)\right), 2\right)\right), s\right) \]
      7. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \cosh \left(\frac{\left|x\right|}{s}\right)\right), 2\right)\right), s\right) \]
      8. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right), 2\right)\right), s\right) \]
      9. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right), 2\right)\right), s\right) \]
      10. fabs-lowering-fabs.f3299.2%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right), 2\right)\right), s\right) \]
    5. Applied egg-rr99.2%

      \[\leadsto \frac{\frac{1}{\color{blue}{2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right) + 2}}}{s} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right), s\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + 4\right)\right), s\right) \]
      2. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right), 4\right)\right), s\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(\frac{\left|x\right| \cdot \left|x\right|}{{s}^{2}}\right), 4\right)\right), s\right) \]
      4. sqr-absN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\left(\frac{x \cdot x}{{s}^{2}}\right), 4\right)\right), s\right) \]
      5. associate-/l*N/A

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \left({s}^{2}\right)\right)\right), 4\right)\right), s\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \left(s \cdot s\right)\right)\right), 4\right)\right), s\right) \]
      9. *-lowering-*.f3281.4%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \mathsf{*.f32}\left(s, s\right)\right)\right), 4\right)\right), s\right) \]
    8. Simplified81.4%

      \[\leadsto \frac{\frac{1}{\color{blue}{x \cdot \frac{x}{s \cdot s} + 4}}}{s} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.000000136226006 \cdot 10^{-28}:\\ \;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{4 + x \cdot \frac{x}{s \cdot s}}}{s}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 79.4% accurate, 34.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 9.999999998199587 \cdot 10^{-24}:\\ \;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \left(4 + \frac{x \cdot x}{s \cdot s}\right)}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x 9.999999998199587e-24)
   (/ (/ 1.0 s) (+ 4.0 (* (/ x s) (/ x s))))
   (/ 1.0 (* s (+ 4.0 (/ (* x x) (* s s)))))))
float code(float x, float s) {
	float tmp;
	if (x <= 9.999999998199587e-24f) {
		tmp = (1.0f / s) / (4.0f + ((x / s) * (x / s)));
	} else {
		tmp = 1.0f / (s * (4.0f + ((x * x) / (s * s))));
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= 9.999999998199587e-24) then
        tmp = (1.0e0 / s) / (4.0e0 + ((x / s) * (x / s)))
    else
        tmp = 1.0e0 / (s * (4.0e0 + ((x * x) / (s * s))))
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(9.999999998199587e-24))
		tmp = Float32(Float32(Float32(1.0) / s) / Float32(Float32(4.0) + Float32(Float32(x / s) * Float32(x / s))));
	else
		tmp = Float32(Float32(1.0) / Float32(s * Float32(Float32(4.0) + Float32(Float32(x * x) / Float32(s * s)))));
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(9.999999998199587e-24))
		tmp = (single(1.0) / s) / (single(4.0) + ((x / s) * (x / s)));
	else
		tmp = single(1.0) / (s * (single(4.0) + ((x * x) / (s * s))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.999999998199587 \cdot 10^{-24}:\\
\;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{s \cdot \left(4 + \frac{x \cdot x}{s \cdot s}\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1e-23

    1. Initial program 99.8%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified99.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f3299.8%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3274.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified74.0%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Step-by-step derivation
      1. times-fracN/A

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(x, s\right), \left(\frac{x}{s}\right)\right), 4\right)\right) \]
      4. /-lowering-/.f3276.4%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{/.f32}\left(x, s\right), \mathsf{/.f32}\left(x, s\right)\right), 4\right)\right) \]
    10. Applied egg-rr76.4%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x}{s} \cdot \frac{x}{s}} + 4} \]

    if 1e-23 < x

    1. Initial program 99.7%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified99.1%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f3299.1%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr99.1%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3279.9%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified79.9%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Step-by-step derivation
      1. associate-/l/N/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right)\right) \]
      8. *-lowering-*.f3279.9%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right)\right) \]
    10. Applied egg-rr79.9%

      \[\leadsto \color{blue}{\frac{1}{s \cdot \left(\frac{x \cdot x}{s \cdot s} + 4\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification78.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 9.999999998199587 \cdot 10^{-24}:\\ \;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x}{s} \cdot \frac{x}{s}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \left(4 + \frac{x \cdot x}{s \cdot s}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 54.6% accurate, 34.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 9.999999998199587 \cdot 10^{-24}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \left(4 + \frac{x \cdot x}{s \cdot s}\right)}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x 9.999999998199587e-24)
   (/ 0.25 s)
   (/ 1.0 (* s (+ 4.0 (/ (* x x) (* s s)))))))
float code(float x, float s) {
	float tmp;
	if (x <= 9.999999998199587e-24f) {
		tmp = 0.25f / s;
	} else {
		tmp = 1.0f / (s * (4.0f + ((x * x) / (s * s))));
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= 9.999999998199587e-24) then
        tmp = 0.25e0 / s
    else
        tmp = 1.0e0 / (s * (4.0e0 + ((x * x) / (s * s))))
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(9.999999998199587e-24))
		tmp = Float32(Float32(0.25) / s);
	else
		tmp = Float32(Float32(1.0) / Float32(s * Float32(Float32(4.0) + Float32(Float32(x * x) / Float32(s * s)))));
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(9.999999998199587e-24))
		tmp = single(0.25) / s;
	else
		tmp = single(1.0) / (s * (single(4.0) + ((x * x) / (s * s))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.999999998199587 \cdot 10^{-24}:\\
\;\;\;\;\frac{0.25}{s}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{s \cdot \left(4 + \frac{x \cdot x}{s \cdot s}\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1e-23

    1. Initial program 99.8%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in s around inf

      \[\leadsto \color{blue}{\frac{\frac{1}{4}}{s}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f3238.1%

        \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \color{blue}{s}\right) \]
    5. Simplified38.1%

      \[\leadsto \color{blue}{\frac{0.25}{s}} \]

    if 1e-23 < x

    1. Initial program 99.7%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified99.1%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f3299.1%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr99.1%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3279.9%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified79.9%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Step-by-step derivation
      1. associate-/l/N/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right)\right) \]
      8. *-lowering-*.f3279.9%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right)\right) \]
    10. Applied egg-rr79.9%

      \[\leadsto \color{blue}{\frac{1}{s \cdot \left(\frac{x \cdot x}{s \cdot s} + 4\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification56.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 9.999999998199587 \cdot 10^{-24}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \left(4 + \frac{x \cdot x}{s \cdot s}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 51.2% accurate, 38.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1.199999961918627 \cdot 10^{-19}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s}}{x \cdot \frac{x}{s \cdot s}}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x 1.199999961918627e-19)
   (/ 0.25 s)
   (/ (/ 1.0 s) (* x (/ x (* s s))))))
float code(float x, float s) {
	float tmp;
	if (x <= 1.199999961918627e-19f) {
		tmp = 0.25f / s;
	} else {
		tmp = (1.0f / s) / (x * (x / (s * s)));
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= 1.199999961918627e-19) then
        tmp = 0.25e0 / s
    else
        tmp = (1.0e0 / s) / (x * (x / (s * s)))
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(1.199999961918627e-19))
		tmp = Float32(Float32(0.25) / s);
	else
		tmp = Float32(Float32(Float32(1.0) / s) / Float32(x * Float32(x / Float32(s * s))));
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(1.199999961918627e-19))
		tmp = single(0.25) / s;
	else
		tmp = (single(1.0) / s) / (x * (x / (s * s)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.199999961918627 \cdot 10^{-19}:\\
\;\;\;\;\frac{0.25}{s}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{s}}{x \cdot \frac{x}{s \cdot s}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.19999996e-19

    1. Initial program 99.8%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in s around inf

      \[\leadsto \color{blue}{\frac{\frac{1}{4}}{s}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f3239.7%

        \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \color{blue}{s}\right) \]
    5. Simplified39.7%

      \[\leadsto \color{blue}{\frac{0.25}{s}} \]

    if 1.19999996e-19 < x

    1. Initial program 99.7%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified99.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f3299.1%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr99.1%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3279.7%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified79.7%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Taylor expanded in x around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(\frac{{x}^{2}}{{s}^{2}}\right)}\right) \]
    10. Step-by-step derivation
      1. unpow2N/A

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

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

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \color{blue}{\left({s}^{2}\right)}\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \left(s \cdot \color{blue}{s}\right)\right)\right)\right) \]
      6. *-lowering-*.f3275.1%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{*.f32}\left(x, \mathsf{/.f32}\left(x, \mathsf{*.f32}\left(s, \color{blue}{s}\right)\right)\right)\right) \]
    11. Simplified75.1%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{x \cdot \frac{x}{s \cdot s}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 17: 46.3% accurate, 51.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.0000000467443897 \cdot 10^{-7}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{x}{\frac{s}{x}}}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x 4.0000000467443897e-7) (/ 0.25 s) (/ 1.0 (/ x (/ s x)))))
float code(float x, float s) {
	float tmp;
	if (x <= 4.0000000467443897e-7f) {
		tmp = 0.25f / s;
	} else {
		tmp = 1.0f / (x / (s / x));
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= 4.0000000467443897e-7) then
        tmp = 0.25e0 / s
    else
        tmp = 1.0e0 / (x / (s / x))
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(4.0000000467443897e-7))
		tmp = Float32(Float32(0.25) / s);
	else
		tmp = Float32(Float32(1.0) / Float32(x / Float32(s / x)));
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(4.0000000467443897e-7))
		tmp = single(0.25) / s;
	else
		tmp = single(1.0) / (x / (s / x));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.0000000467443897 \cdot 10^{-7}:\\
\;\;\;\;\frac{0.25}{s}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{\frac{s}{x}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.00000005e-7

    1. Initial program 99.6%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in s around inf

      \[\leadsto \color{blue}{\frac{\frac{1}{4}}{s}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f3238.3%

        \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \color{blue}{s}\right) \]
    5. Simplified38.3%

      \[\leadsto \color{blue}{\frac{0.25}{s}} \]

    if 4.00000005e-7 < x

    1. Initial program 100.0%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f32100.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3281.1%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified81.1%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Taylor expanded in s around 0

      \[\leadsto \color{blue}{\frac{s}{{x}^{2}}} \]
    10. Step-by-step derivation
      1. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(s, \color{blue}{\left({x}^{2}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(s, \left(x \cdot \color{blue}{x}\right)\right) \]
      3. *-lowering-*.f3264.7%

        \[\leadsto \mathsf{/.f32}\left(s, \mathsf{*.f32}\left(x, \color{blue}{x}\right)\right) \]
    11. Simplified64.7%

      \[\leadsto \color{blue}{\frac{s}{x \cdot x}} \]
    12. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \frac{\frac{s}{x}}{\color{blue}{x}} \]
      2. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{x}{\frac{s}{x}}}} \]
      3. /-lowering-/.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(x, \color{blue}{\left(\frac{s}{x}\right)}\right)\right) \]
      5. /-lowering-/.f3268.5%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(x, \mathsf{/.f32}\left(s, \color{blue}{x}\right)\right)\right) \]
    13. Applied egg-rr68.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{x}{\frac{s}{x}}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 18: 45.6% accurate, 51.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.0000000467443897 \cdot 10^{-7}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{s}{x} \cdot \frac{1}{x}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x 4.0000000467443897e-7) (/ 0.25 s) (* (/ s x) (/ 1.0 x))))
float code(float x, float s) {
	float tmp;
	if (x <= 4.0000000467443897e-7f) {
		tmp = 0.25f / s;
	} else {
		tmp = (s / x) * (1.0f / x);
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= 4.0000000467443897e-7) then
        tmp = 0.25e0 / s
    else
        tmp = (s / x) * (1.0e0 / x)
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(4.0000000467443897e-7))
		tmp = Float32(Float32(0.25) / s);
	else
		tmp = Float32(Float32(s / x) * Float32(Float32(1.0) / x));
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(4.0000000467443897e-7))
		tmp = single(0.25) / s;
	else
		tmp = (s / x) * (single(1.0) / x);
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.0000000467443897 \cdot 10^{-7}:\\
\;\;\;\;\frac{0.25}{s}\\

\mathbf{else}:\\
\;\;\;\;\frac{s}{x} \cdot \frac{1}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.00000005e-7

    1. Initial program 99.6%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in s around inf

      \[\leadsto \color{blue}{\frac{\frac{1}{4}}{s}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f3238.3%

        \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \color{blue}{s}\right) \]
    5. Simplified38.3%

      \[\leadsto \color{blue}{\frac{0.25}{s}} \]

    if 4.00000005e-7 < x

    1. Initial program 100.0%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f32100.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3281.1%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified81.1%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Taylor expanded in s around 0

      \[\leadsto \color{blue}{\frac{s}{{x}^{2}}} \]
    10. Step-by-step derivation
      1. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(s, \color{blue}{\left({x}^{2}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(s, \left(x \cdot \color{blue}{x}\right)\right) \]
      3. *-lowering-*.f3264.7%

        \[\leadsto \mathsf{/.f32}\left(s, \mathsf{*.f32}\left(x, \color{blue}{x}\right)\right) \]
    11. Simplified64.7%

      \[\leadsto \color{blue}{\frac{s}{x \cdot x}} \]
    12. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \frac{\frac{s}{x}}{\color{blue}{x}} \]
      2. div-invN/A

        \[\leadsto \frac{s}{x} \cdot \color{blue}{\frac{1}{x}} \]
      3. *-lowering-*.f32N/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(s, x\right), \left(\frac{\color{blue}{1}}{x}\right)\right) \]
      5. /-lowering-/.f3264.7%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(s, x\right), \mathsf{/.f32}\left(1, \color{blue}{x}\right)\right) \]
    13. Applied egg-rr64.7%

      \[\leadsto \color{blue}{\frac{s}{x} \cdot \frac{1}{x}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 19: 45.6% accurate, 51.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.0000000467443897 \cdot 10^{-7}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;s \cdot \frac{1}{x \cdot x}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x 4.0000000467443897e-7) (/ 0.25 s) (* s (/ 1.0 (* x x)))))
float code(float x, float s) {
	float tmp;
	if (x <= 4.0000000467443897e-7f) {
		tmp = 0.25f / s;
	} else {
		tmp = s * (1.0f / (x * x));
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= 4.0000000467443897e-7) then
        tmp = 0.25e0 / s
    else
        tmp = s * (1.0e0 / (x * x))
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(4.0000000467443897e-7))
		tmp = Float32(Float32(0.25) / s);
	else
		tmp = Float32(s * Float32(Float32(1.0) / Float32(x * x)));
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(4.0000000467443897e-7))
		tmp = single(0.25) / s;
	else
		tmp = s * (single(1.0) / (x * x));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.0000000467443897 \cdot 10^{-7}:\\
\;\;\;\;\frac{0.25}{s}\\

\mathbf{else}:\\
\;\;\;\;s \cdot \frac{1}{x \cdot x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.00000005e-7

    1. Initial program 99.6%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in s around inf

      \[\leadsto \color{blue}{\frac{\frac{1}{4}}{s}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f3238.3%

        \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \color{blue}{s}\right) \]
    5. Simplified38.3%

      \[\leadsto \color{blue}{\frac{0.25}{s}} \]

    if 4.00000005e-7 < x

    1. Initial program 100.0%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f32100.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3281.1%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified81.1%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Taylor expanded in s around 0

      \[\leadsto \color{blue}{\frac{s}{{x}^{2}}} \]
    10. Step-by-step derivation
      1. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(s, \color{blue}{\left({x}^{2}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(s, \left(x \cdot \color{blue}{x}\right)\right) \]
      3. *-lowering-*.f3264.7%

        \[\leadsto \mathsf{/.f32}\left(s, \mathsf{*.f32}\left(x, \color{blue}{x}\right)\right) \]
    11. Simplified64.7%

      \[\leadsto \color{blue}{\frac{s}{x \cdot x}} \]
    12. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{x \cdot x}{s}}} \]
      2. associate-/r/N/A

        \[\leadsto \frac{1}{x \cdot x} \cdot \color{blue}{s} \]
      3. *-lowering-*.f32N/A

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \left(x \cdot x\right)\right), s\right) \]
      5. *-lowering-*.f3264.7%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(1, \mathsf{*.f32}\left(x, x\right)\right), s\right) \]
    13. Applied egg-rr64.7%

      \[\leadsto \color{blue}{\frac{1}{x \cdot x} \cdot s} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification47.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.0000000467443897 \cdot 10^{-7}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;s \cdot \frac{1}{x \cdot x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 45.6% accurate, 61.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.0000000467443897 \cdot 10^{-7}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{s}{x \cdot x}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x 4.0000000467443897e-7) (/ 0.25 s) (/ s (* x x))))
float code(float x, float s) {
	float tmp;
	if (x <= 4.0000000467443897e-7f) {
		tmp = 0.25f / s;
	} else {
		tmp = s / (x * x);
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= 4.0000000467443897e-7) then
        tmp = 0.25e0 / s
    else
        tmp = s / (x * x)
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(4.0000000467443897e-7))
		tmp = Float32(Float32(0.25) / s);
	else
		tmp = Float32(s / Float32(x * x));
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(4.0000000467443897e-7))
		tmp = single(0.25) / s;
	else
		tmp = s / (x * x);
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.0000000467443897 \cdot 10^{-7}:\\
\;\;\;\;\frac{0.25}{s}\\

\mathbf{else}:\\
\;\;\;\;\frac{s}{x \cdot x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.00000005e-7

    1. Initial program 99.6%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in s around inf

      \[\leadsto \color{blue}{\frac{\frac{1}{4}}{s}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f3238.3%

        \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \color{blue}{s}\right) \]
    5. Simplified38.3%

      \[\leadsto \color{blue}{\frac{0.25}{s}} \]

    if 4.00000005e-7 < x

    1. Initial program 100.0%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}}{s}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\left(\frac{1}{s}\right), \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)}\right) \]
      4. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\color{blue}{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)\right)\right) \]
      5. associate-+r+N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right) + \color{blue}{2}\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(2 + \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      7. +-lowering-+.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \color{blue}{\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + e^{\frac{\left|x\right|}{s}}\right)}\right)\right) \]
      8. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}} + e^{\frac{\color{blue}{\left|x\right|}}{s}}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + \color{blue}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}\right)\right)\right) \]
      10. distribute-frac-negN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(e^{\frac{\left|x\right|}{s}} + e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      11. cosh-undefN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \left(2 \cdot \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      12. *-lowering-*.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \color{blue}{\cosh \left(\frac{\left|x\right|}{s}\right)}\right)\right)\right) \]
      13. cosh-lowering-cosh.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right)\right) \]
      14. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right)\right)\right) \]
      15. fabs-lowering-fabs.f32100.0%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right)\right) \]
    5. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{\left|x\right|}{s}\right)}} \]
    6. Taylor expanded in s around inf

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \color{blue}{\left(4 + \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \left(\frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}} + \color{blue}{4}\right)\right) \]
      2. +-lowering-+.f32N/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left({\left(\left|x\right|\right)}^{2}\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(\left|x\right| \cdot \left|x\right|\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      5. sqr-absN/A

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

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left({s}^{2}\right)\right), 4\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \left(s \cdot s\right)\right), 4\right)\right) \]
      8. *-lowering-*.f3281.1%

        \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, s\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), 4\right)\right) \]
    8. Simplified81.1%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}} \]
    9. Taylor expanded in s around 0

      \[\leadsto \color{blue}{\frac{s}{{x}^{2}}} \]
    10. Step-by-step derivation
      1. /-lowering-/.f32N/A

        \[\leadsto \mathsf{/.f32}\left(s, \color{blue}{\left({x}^{2}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f32}\left(s, \left(x \cdot \color{blue}{x}\right)\right) \]
      3. *-lowering-*.f3264.7%

        \[\leadsto \mathsf{/.f32}\left(s, \mathsf{*.f32}\left(x, \color{blue}{x}\right)\right) \]
    11. Simplified64.7%

      \[\leadsto \color{blue}{\frac{s}{x \cdot x}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 21: 27.0% accurate, 206.7× speedup?

\[\begin{array}{l} \\ \frac{0.25}{s} \end{array} \]
(FPCore (x s) :precision binary32 (/ 0.25 s))
float code(float x, float s) {
	return 0.25f / s;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = 0.25e0 / s
end function
function code(x, s)
	return Float32(Float32(0.25) / s)
end
function tmp = code(x, s)
	tmp = single(0.25) / s;
end
\begin{array}{l}

\\
\frac{0.25}{s}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in s around inf

    \[\leadsto \color{blue}{\frac{\frac{1}{4}}{s}} \]
  4. Step-by-step derivation
    1. /-lowering-/.f3226.9%

      \[\leadsto \mathsf{/.f32}\left(\frac{1}{4}, \color{blue}{s}\right) \]
  5. Simplified26.9%

    \[\leadsto \color{blue}{\frac{0.25}{s}} \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2024191 
(FPCore (x s)
  :name "Logistic distribution"
  :precision binary32
  :pre (and (<= 0.0 s) (<= s 1.0651631))
  (/ (exp (/ (- (fabs x)) s)) (* (* s (+ 1.0 (exp (/ (- (fabs x)) s)))) (+ 1.0 (exp (/ (- (fabs x)) s))))))