Logistic distribution

Percentage Accurate: 99.5% → 99.6%
Time: 11.9s
Alternatives: 16
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 16 alternatives:

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

Initial Program: 99.5% 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, 2.9× speedup?

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

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

    \[\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}{s}}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-/l/N/A

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \left(s \cdot \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. *-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) \]
    5. 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) \]
    6. +-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) \]
    7. +-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) \]
    8. 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) \]
    9. +-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) \]
    10. 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) \]
    11. 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) \]
    12. *-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) \]
    13. 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) \]
    14. /-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) \]
    15. 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. Step-by-step derivation
    1. frac-2negN/A

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \cosh \left(\frac{\left|x\right|}{\mathsf{neg}\left(s\right)}\right)\right)\right)\right)\right) \]
    4. 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|}{\mathsf{neg}\left(s\right)}\right)\right)\right)\right)\right)\right) \]
    5. distribute-frac-neg2N/A

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

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(2, \mathsf{*.f32}\left(2, \mathsf{cosh.f32}\left(\left(\frac{-1}{\frac{s}{\left|x\right|}}\right)\right)\right)\right)\right)\right) \]
    9. /-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(-1, \left(\frac{s}{\left|x\right|}\right)\right)\right)\right)\right)\right)\right) \]
    10. /-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(-1, \mathsf{/.f32}\left(s, \left(\left|x\right|\right)\right)\right)\right)\right)\right)\right)\right) \]
    11. 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(-1, \mathsf{/.f32}\left(s, \mathsf{fabs.f32}\left(x\right)\right)\right)\right)\right)\right)\right)\right) \]
  7. Applied egg-rr99.5%

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

Alternative 2: 92.7% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 2.0000000063421537 \cdot 10^{-29}:\\
\;\;\;\;\frac{1}{s \cdot \left(4 + \frac{x}{s} \cdot \frac{x}{s}\right)}\\

\mathbf{elif}\;\left|x\right| \leq 5.999999941330714 \cdot 10^{-10}:\\
\;\;\;\;\frac{1}{s \cdot \left(4 + x \cdot \frac{x}{s \cdot s}\right)}\\

\mathbf{else}:\\
\;\;\;\;e^{\frac{\left|x\right|}{-s}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (fabs.f32 x) < 2.00000001e-29

    1. Initial program 97.2%

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

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

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \left(s \cdot \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. *-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) \]
      5. 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) \]
      6. +-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) \]
      7. +-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) \]
      8. 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) \]
      9. +-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) \]
      10. 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) \]
      11. 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) \]
      12. *-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) \]
      13. 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) \]
      14. /-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) \]
      15. fabs-lowering-fabs.f3297.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-rr97.5%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(x \cdot x\right), \left({s}^{2}\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}^{2}\right)\right), 4\right)\right)\right) \]
      8. unpow2N/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) \]
      9. *-lowering-*.f3253.7%

        \[\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) \]
    8. Simplified53.7%

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

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

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

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

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

      \[\leadsto \frac{1}{s \cdot \left(\color{blue}{\frac{x}{s} \cdot \frac{x}{s}} + 4\right)} \]

    if 2.00000001e-29 < (fabs.f32 x) < 5.99999994e-10

    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. Simplified99.9%

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

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \left(s \cdot \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. *-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) \]
      5. 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) \]
      6. +-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) \]
      7. +-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) \]
      8. 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) \]
      9. +-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) \]
      10. 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) \]
      11. 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) \]
      12. *-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) \]
      13. 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) \]
      14. /-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) \]
      15. fabs-lowering-fabs.f3299.9%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(x \cdot x\right), \left({s}^{2}\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}^{2}\right)\right), 4\right)\right)\right) \]
      8. unpow2N/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) \]
      9. *-lowering-*.f3284.2%

        \[\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) \]
    8. Simplified84.2%

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

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

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

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

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

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

      \[\leadsto \frac{1}{s \cdot \left(\color{blue}{\frac{x}{s \cdot s} \cdot x} + 4\right)} \]

    if 5.99999994e-10 < (fabs.f32 x)

    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. 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-*.f3298.0%

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

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

        \[\leadsto \frac{\frac{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}{s}}{\color{blue}{4}} \]
      2. clear-numN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(4, \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)\right)\right) \]
      11. neg-lowering-neg.f3298.0%

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(4, \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)\right)\right) \]
    7. Applied egg-rr98.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{4}{\frac{e^{\frac{\left|x\right|}{-s}}}{s}}}} \]
    8. Step-by-step derivation
      1. clear-numN/A

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

        \[\leadsto \frac{e^{\frac{\left|x\right|}{\mathsf{neg}\left(s\right)}}}{\color{blue}{4 \cdot s}} \]
      3. metadata-evalN/A

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

        \[\leadsto \frac{e^{\frac{\left|x\right|}{\mathsf{neg}\left(s\right)}}}{\frac{1}{\color{blue}{\frac{\frac{1}{4}}{s}}}} \]
      5. clear-numN/A

        \[\leadsto \frac{e^{\frac{\left|x\right|}{\mathsf{neg}\left(s\right)}}}{\frac{s}{\color{blue}{\frac{1}{4}}}} \]
      6. rem-exp-logN/A

        \[\leadsto \frac{e^{\frac{\left|x\right|}{\mathsf{neg}\left(s\right)}}}{e^{\log \left(\frac{s}{\frac{1}{4}}\right)}} \]
      7. div-expN/A

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

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

        \[\leadsto \mathsf{exp.f32}\left(\mathsf{\_.f32}\left(\left(\frac{\left|x\right|}{\mathsf{neg}\left(s\right)}\right), \log \left(\frac{s}{\frac{1}{4}}\right)\right)\right) \]
      10. distribute-frac-neg2N/A

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

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

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

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

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

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

        \[\leadsto \mathsf{exp.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(-1, \mathsf{/.f32}\left(s, \mathsf{fabs.f32}\left(x\right)\right)\right), \log \left(\frac{s}{\frac{1}{4}}\right)\right)\right) \]
      17. rem-exp-logN/A

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

        \[\leadsto \mathsf{exp.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(-1, \mathsf{/.f32}\left(s, \mathsf{fabs.f32}\left(x\right)\right)\right), \mathsf{log.f32}\left(\left(e^{\log \left(\frac{s}{\frac{1}{4}}\right)}\right)\right)\right)\right) \]
      19. rem-exp-logN/A

        \[\leadsto \mathsf{exp.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(-1, \mathsf{/.f32}\left(s, \mathsf{fabs.f32}\left(x\right)\right)\right), \mathsf{log.f32}\left(\left(\frac{s}{\frac{1}{4}}\right)\right)\right)\right) \]
      20. /-lowering-/.f3298.0%

        \[\leadsto \mathsf{exp.f32}\left(\mathsf{\_.f32}\left(\mathsf{/.f32}\left(-1, \mathsf{/.f32}\left(s, \mathsf{fabs.f32}\left(x\right)\right)\right), \mathsf{log.f32}\left(\mathsf{/.f32}\left(s, \frac{1}{4}\right)\right)\right)\right) \]
    9. Applied egg-rr98.0%

      \[\leadsto \color{blue}{e^{\frac{-1}{\frac{s}{\left|x\right|}} - \log \left(\frac{s}{0.25}\right)}} \]
    10. Taylor expanded in s around 0

      \[\leadsto \mathsf{exp.f32}\left(\color{blue}{\left(-1 \cdot \frac{\left|x\right|}{s}\right)}\right) \]
    11. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{exp.f32}\left(\left(\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f32}\left(\left(0 - \frac{\left|x\right|}{s}\right)\right) \]
      3. --lowering--.f32N/A

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

        \[\leadsto \mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(\left(\left|x\right|\right), s\right)\right)\right) \]
      5. fabs-lowering-fabs.f3297.3%

        \[\leadsto \mathsf{exp.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right) \]
    12. Simplified97.3%

      \[\leadsto e^{\color{blue}{0 - \frac{\left|x\right|}{s}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification93.9%

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

Alternative 3: 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.5%

    \[\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}{s}}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-/l/N/A

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \left(s \cdot \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. *-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) \]
    5. 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) \]
    6. +-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) \]
    7. +-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) \]
    8. 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) \]
    9. +-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) \]
    10. 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) \]
    11. 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) \]
    12. *-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) \]
    13. 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) \]
    14. /-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) \]
    15. 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 4: 96.4% accurate, 3.0× speedup?

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

\\
\frac{\frac{1}{3 + e^{\frac{\left|x\right|}{s}}}}{s}
\end{array}
Derivation
  1. Initial program 99.5%

    \[\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}{s}}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-/l/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \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), 2\right), \left(e^{\frac{\left|x\right|}{s}}\right)\right)\right), s\right) \]
    15. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \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), 2\right), \left(e^{\frac{\left|x\right|}{s}}\right)\right)\right), s\right) \]
    16. exp-lowering-exp.f32N/A

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \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), 2\right), \mathsf{exp.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right), s\right) \]
  7. Applied egg-rr99.5%

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

    \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\color{blue}{3}, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{fabs.f32}\left(x\right), s\right)\right)\right)\right), s\right) \]
  9. Step-by-step derivation
    1. Simplified96.0%

      \[\leadsto \frac{\frac{1}{\color{blue}{3} + e^{\frac{\left|x\right|}{s}}}}{s} \]
    2. Add Preprocessing

    Alternative 5: 94.7% accurate, 3.0× speedup?

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

      \[\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-*.f3294.9%

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

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

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

    Alternative 6: 94.7% accurate, 3.0× speedup?

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

      \[\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-*.f3294.9%

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

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

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

        \[\leadsto e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} \cdot \frac{1}{s \cdot 4} \]
      3. exp-negN/A

        \[\leadsto \frac{1}{e^{\frac{\left|x\right|}{s}}} \cdot \frac{\color{blue}{1}}{s \cdot 4} \]
      4. associate-*l/N/A

        \[\leadsto \frac{1 \cdot \frac{1}{s \cdot 4}}{\color{blue}{e^{\frac{\left|x\right|}{s}}}} \]
      5. div-invN/A

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

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

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

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

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

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

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

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

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

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

    Alternative 7: 83.8% accurate, 5.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 2.0000000390829628 \cdot 10^{-25}:\\ \;\;\;\;\frac{1}{s \cdot \left(4 + \frac{x}{s} \cdot \frac{x}{s}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \left(4 + \frac{1}{s \cdot s} \cdot \left(x \cdot x\right)\right)}\\ \end{array} \end{array} \]
    (FPCore (x s)
     :precision binary32
     (if (<= (fabs x) 2.0000000390829628e-25)
       (/ 1.0 (* s (+ 4.0 (* (/ x s) (/ x s)))))
       (/ 1.0 (* s (+ 4.0 (* (/ 1.0 (* s s)) (* x x)))))))
    float code(float x, float s) {
    	float tmp;
    	if (fabsf(x) <= 2.0000000390829628e-25f) {
    		tmp = 1.0f / (s * (4.0f + ((x / s) * (x / s))));
    	} else {
    		tmp = 1.0f / (s * (4.0f + ((1.0f / (s * 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 (abs(x) <= 2.0000000390829628e-25) then
            tmp = 1.0e0 / (s * (4.0e0 + ((x / s) * (x / s))))
        else
            tmp = 1.0e0 / (s * (4.0e0 + ((1.0e0 / (s * s)) * (x * x))))
        end if
        code = tmp
    end function
    
    function code(x, s)
    	tmp = Float32(0.0)
    	if (abs(x) <= Float32(2.0000000390829628e-25))
    		tmp = Float32(Float32(1.0) / Float32(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(Float32(1.0) / Float32(s * s)) * Float32(x * x)))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, s)
    	tmp = single(0.0);
    	if (abs(x) <= single(2.0000000390829628e-25))
    		tmp = single(1.0) / (s * (single(4.0) + ((x / s) * (x / s))));
    	else
    		tmp = single(1.0) / (s * (single(4.0) + ((single(1.0) / (s * s)) * (x * x))));
    	end
    	tmp_2 = tmp;
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\left|x\right| \leq 2.0000000390829628 \cdot 10^{-25}:\\
    \;\;\;\;\frac{1}{s \cdot \left(4 + \frac{x}{s} \cdot \frac{x}{s}\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{s \cdot \left(4 + \frac{1}{s \cdot s} \cdot \left(x \cdot x\right)\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (fabs.f32 x) < 2.00000004e-25

      1. Initial program 97.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. Simplified97.8%

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(s \cdot \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. *-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) \]
        5. 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) \]
        6. +-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) \]
        7. +-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) \]
        8. 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) \]
        9. +-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) \]
        10. 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) \]
        11. 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) \]
        12. *-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) \]
        13. 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) \]
        14. /-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) \]
        15. fabs-lowering-fabs.f3297.9%

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(x \cdot x\right), \left({s}^{2}\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}^{2}\right)\right), 4\right)\right)\right) \]
        8. unpow2N/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) \]
        9. *-lowering-*.f3252.0%

          \[\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) \]
      8. Simplified52.0%

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

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

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

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

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

        \[\leadsto \frac{1}{s \cdot \left(\color{blue}{\frac{x}{s} \cdot \frac{x}{s}} + 4\right)} \]

      if 2.00000004e-25 < (fabs.f32 x)

      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. Simplified99.9%

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(s \cdot \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. *-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) \]
        5. 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) \]
        6. +-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) \]
        7. +-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) \]
        8. 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) \]
        9. +-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) \]
        10. 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) \]
        11. 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) \]
        12. *-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) \]
        13. 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) \]
        14. /-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) \]
        15. fabs-lowering-fabs.f3299.9%

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(x \cdot x\right), \left({s}^{2}\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}^{2}\right)\right), 4\right)\right)\right) \]
        8. unpow2N/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) \]
        9. *-lowering-*.f3283.6%

          \[\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) \]
      8. Simplified83.6%

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(\frac{x \cdot x}{s \cdot s} + 4\right)}} \]
      9. Step-by-step derivation
        1. clear-numN/A

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

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

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

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

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

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

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

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

    Alternative 8: 80.5% accurate, 34.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 2.0000000063421537 \cdot 10^{-29}:\\ \;\;\;\;\frac{1}{s \cdot \left(4 + \frac{x}{s} \cdot \frac{x}{s}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \left(4 + x \cdot \frac{x}{s \cdot s}\right)}\\ \end{array} \end{array} \]
    (FPCore (x s)
     :precision binary32
     (if (<= x 2.0000000063421537e-29)
       (/ 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 <= 2.0000000063421537e-29f) {
    		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 <= 2.0000000063421537e-29) 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(2.0000000063421537e-29))
    		tmp = Float32(Float32(1.0) / Float32(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(x * Float32(x / Float32(s * s))))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, s)
    	tmp = single(0.0);
    	if (x <= single(2.0000000063421537e-29))
    		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 2.0000000063421537 \cdot 10^{-29}:\\
    \;\;\;\;\frac{1}{s \cdot \left(4 + \frac{x}{s} \cdot \frac{x}{s}\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{s \cdot \left(4 + x \cdot \frac{x}{s \cdot s}\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 2.00000001e-29

      1. Initial program 99.1%

        \[\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}{s}}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. Add Preprocessing
      4. Step-by-step derivation
        1. associate-/l/N/A

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(s \cdot \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. *-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) \]
        5. 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) \]
        6. +-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) \]
        7. +-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) \]
        8. 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) \]
        9. +-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) \]
        10. 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) \]
        11. 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) \]
        12. *-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) \]
        13. 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) \]
        14. /-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) \]
        15. fabs-lowering-fabs.f3299.2%

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(x \cdot x\right), \left({s}^{2}\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}^{2}\right)\right), 4\right)\right)\right) \]
        8. unpow2N/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) \]
        9. *-lowering-*.f3273.8%

          \[\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) \]
      8. Simplified73.8%

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

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

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

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

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

        \[\leadsto \frac{1}{s \cdot \left(\color{blue}{\frac{x}{s} \cdot \frac{x}{s}} + 4\right)} \]

      if 2.00000001e-29 < x

      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. Simplified99.9%

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(s \cdot \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. *-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) \]
        5. 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) \]
        6. +-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) \]
        7. +-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) \]
        8. 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) \]
        9. +-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) \]
        10. 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) \]
        11. 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) \]
        12. *-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) \]
        13. 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) \]
        14. /-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) \]
        15. fabs-lowering-fabs.f3299.9%

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(x \cdot x\right), \left({s}^{2}\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}^{2}\right)\right), 4\right)\right)\right) \]
        8. unpow2N/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) \]
        9. *-lowering-*.f3282.2%

          \[\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) \]
      8. Simplified82.2%

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

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

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

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

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

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

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

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

    Alternative 9: 69.9% accurate, 38.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1.9000000043279782 \cdot 10^{-19}:\\ \;\;\;\;\frac{1}{\frac{x \cdot x}{s} - \frac{s}{-0.25}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{x \cdot x}{s \cdot s}}}{s}\\ \end{array} \end{array} \]
    (FPCore (x s)
     :precision binary32
     (if (<= x 1.9000000043279782e-19)
       (/ 1.0 (- (/ (* x x) s) (/ s -0.25)))
       (/ (/ 1.0 (/ (* x x) (* s s))) s)))
    float code(float x, float s) {
    	float tmp;
    	if (x <= 1.9000000043279782e-19f) {
    		tmp = 1.0f / (((x * x) / s) - (s / -0.25f));
    	} else {
    		tmp = (1.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 <= 1.9000000043279782e-19) then
            tmp = 1.0e0 / (((x * x) / s) - (s / (-0.25e0)))
        else
            tmp = (1.0e0 / ((x * x) / (s * s))) / s
        end if
        code = tmp
    end function
    
    function code(x, s)
    	tmp = Float32(0.0)
    	if (x <= Float32(1.9000000043279782e-19))
    		tmp = Float32(Float32(1.0) / Float32(Float32(Float32(x * x) / s) - Float32(s / Float32(-0.25))));
    	else
    		tmp = Float32(Float32(Float32(1.0) / Float32(Float32(x * x) / Float32(s * s))) / s);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, s)
    	tmp = single(0.0);
    	if (x <= single(1.9000000043279782e-19))
    		tmp = single(1.0) / (((x * x) / s) - (s / single(-0.25)));
    	else
    		tmp = (single(1.0) / ((x * x) / (s * s))) / s;
    	end
    	tmp_2 = tmp;
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 1.9000000043279782 \cdot 10^{-19}:\\
    \;\;\;\;\frac{1}{\frac{x \cdot x}{s} - \frac{s}{-0.25}}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{1}{\frac{x \cdot x}{s \cdot s}}}{s}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 1.9e-19

      1. Initial program 99.1%

        \[\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}{s}}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
      3. Add Preprocessing
      4. Step-by-step derivation
        1. associate-/l/N/A

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(s \cdot \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. *-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) \]
        5. 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) \]
        6. +-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) \]
        7. +-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) \]
        8. 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) \]
        9. +-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) \]
        10. 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) \]
        11. 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) \]
        12. *-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) \]
        13. 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) \]
        14. /-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) \]
        15. fabs-lowering-fabs.f3299.3%

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(x \cdot x\right), \left({s}^{2}\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}^{2}\right)\right), 4\right)\right)\right) \]
        8. unpow2N/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) \]
        9. *-lowering-*.f3274.7%

          \[\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) \]
      8. Simplified74.7%

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(\frac{x \cdot x}{s \cdot s} + 4\right)}} \]
      9. Step-by-step derivation
        1. distribute-lft-inN/A

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(\mathsf{fma}\left(s, \color{blue}{\frac{x \cdot x}{s \cdot s}}, \frac{s}{\frac{1}{4}}\right)\right)\right) \]
        5. frac-2negN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\mathsf{fma}\left(s, \frac{x \cdot x}{s \cdot s}, \frac{\mathsf{neg}\left(s\right)}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right)\right) \]
        6. distribute-frac-negN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\mathsf{fma}\left(s, \frac{x \cdot x}{s \cdot s}, \mathsf{neg}\left(\frac{s}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right)\right)\right) \]
        7. fmm-undefN/A

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(\frac{x \cdot x}{s \cdot s} \cdot s - \frac{\color{blue}{s}}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right) \]
        9. div-invN/A

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(x \cdot x\right) \cdot \left(\frac{1}{s \cdot s} \cdot s\right) - \frac{\color{blue}{s}}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right) \]
        11. pow2N/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(x \cdot x\right) \cdot \left(\frac{1}{{s}^{2}} \cdot s\right) - \frac{s}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right) \]
        12. pow-flipN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(x \cdot x\right) \cdot \left({s}^{\left(\mathsf{neg}\left(2\right)\right)} \cdot s\right) - \frac{s}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right) \]
        13. pow-plusN/A

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(x \cdot x\right) \cdot {s}^{-1} - \frac{s}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right) \]
        16. inv-powN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(x \cdot x\right) \cdot \frac{1}{s} - \frac{s}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right) \]
        17. div-invN/A

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), s\right), \mathsf{/.f32}\left(s, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{4}\right)\right)}\right)\right)\right) \]
        22. metadata-eval67.8%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{x \cdot x}{s} - \frac{s}{-0.25}}} \]

      if 1.9e-19 < x

      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. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \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), 2\right), \left(e^{\frac{\left|x\right|}{s}}\right)\right)\right), s\right) \]
        15. neg-lowering-neg.f32N/A

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \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), 2\right), \left(e^{\frac{\left|x\right|}{s}}\right)\right)\right), s\right) \]
        16. exp-lowering-exp.f32N/A

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \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), 2\right), \mathsf{exp.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right), s\right) \]
      7. Applied egg-rr99.9%

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{\_.f32}\left(4, \left(\frac{\left|x\right| + \left(-1 \cdot \left|x\right| + -1 \cdot \frac{-1 \cdot \frac{\frac{-1}{6} \cdot {\left(\left|x\right|\right)}^{3} + \frac{1}{6} \cdot {\left(\left|x\right|\right)}^{3}}{s} + {\left(\left|x\right|\right)}^{2}}{s}\right)}{s}\right)\right)\right), s\right) \]
      10. Simplified72.5%

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

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

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

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

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

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

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

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

    Alternative 10: 68.0% accurate, 38.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 9.99999993922529 \cdot 10^{-9}:\\ \;\;\;\;\frac{1}{\frac{x \cdot x}{s} - \frac{s}{-0.25}}\\ \mathbf{else}:\\ \;\;\;\;\frac{s \cdot \frac{s}{x \cdot x}}{s}\\ \end{array} \end{array} \]
    (FPCore (x s)
     :precision binary32
     (if (<= x 9.99999993922529e-9)
       (/ 1.0 (- (/ (* x x) s) (/ s -0.25)))
       (/ (* s (/ s (* x x))) s)))
    float code(float x, float s) {
    	float tmp;
    	if (x <= 9.99999993922529e-9f) {
    		tmp = 1.0f / (((x * x) / s) - (s / -0.25f));
    	} else {
    		tmp = (s * (s / (x * x))) / 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.99999993922529e-9) then
            tmp = 1.0e0 / (((x * x) / s) - (s / (-0.25e0)))
        else
            tmp = (s * (s / (x * x))) / s
        end if
        code = tmp
    end function
    
    function code(x, s)
    	tmp = Float32(0.0)
    	if (x <= Float32(9.99999993922529e-9))
    		tmp = Float32(Float32(1.0) / Float32(Float32(Float32(x * x) / s) - Float32(s / Float32(-0.25))));
    	else
    		tmp = Float32(Float32(s * Float32(s / Float32(x * x))) / s);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, s)
    	tmp = single(0.0);
    	if (x <= single(9.99999993922529e-9))
    		tmp = single(1.0) / (((x * x) / s) - (s / single(-0.25)));
    	else
    		tmp = (s * (s / (x * x))) / s;
    	end
    	tmp_2 = tmp;
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 9.99999993922529 \cdot 10^{-9}:\\
    \;\;\;\;\frac{1}{\frac{x \cdot x}{s} - \frac{s}{-0.25}}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{s \cdot \frac{s}{x \cdot x}}{s}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 9.99999994e-9

      1. Initial program 99.2%

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(s \cdot \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. *-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) \]
        5. 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) \]
        6. +-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) \]
        7. +-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) \]
        8. 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) \]
        9. +-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) \]
        10. 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) \]
        11. 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) \]
        12. *-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) \]
        13. 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) \]
        14. /-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) \]
        15. fabs-lowering-fabs.f3299.3%

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(x \cdot x\right), \left({s}^{2}\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}^{2}\right)\right), 4\right)\right)\right) \]
        8. unpow2N/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) \]
        9. *-lowering-*.f3274.8%

          \[\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) \]
      8. Simplified74.8%

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(\frac{x \cdot x}{s \cdot s} + 4\right)}} \]
      9. Step-by-step derivation
        1. distribute-lft-inN/A

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(\mathsf{fma}\left(s, \color{blue}{\frac{x \cdot x}{s \cdot s}}, \frac{s}{\frac{1}{4}}\right)\right)\right) \]
        5. frac-2negN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\mathsf{fma}\left(s, \frac{x \cdot x}{s \cdot s}, \frac{\mathsf{neg}\left(s\right)}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right)\right) \]
        6. distribute-frac-negN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\mathsf{fma}\left(s, \frac{x \cdot x}{s \cdot s}, \mathsf{neg}\left(\frac{s}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right)\right)\right) \]
        7. fmm-undefN/A

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(\frac{x \cdot x}{s \cdot s} \cdot s - \frac{\color{blue}{s}}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right) \]
        9. div-invN/A

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(x \cdot x\right) \cdot \left(\frac{1}{s \cdot s} \cdot s\right) - \frac{\color{blue}{s}}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right) \]
        11. pow2N/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(x \cdot x\right) \cdot \left(\frac{1}{{s}^{2}} \cdot s\right) - \frac{s}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right) \]
        12. pow-flipN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(x \cdot x\right) \cdot \left({s}^{\left(\mathsf{neg}\left(2\right)\right)} \cdot s\right) - \frac{s}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right) \]
        13. pow-plusN/A

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(x \cdot x\right) \cdot {s}^{-1} - \frac{s}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right) \]
        16. inv-powN/A

          \[\leadsto \mathsf{/.f32}\left(1, \left(\left(x \cdot x\right) \cdot \frac{1}{s} - \frac{s}{\mathsf{neg}\left(\frac{1}{4}\right)}\right)\right) \]
        17. div-invN/A

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{\_.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), s\right), \mathsf{/.f32}\left(s, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{4}\right)\right)}\right)\right)\right) \]
        22. metadata-eval62.7%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{x \cdot x}{s} - \frac{s}{-0.25}}} \]

      if 9.99999994e-9 < 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. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \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), 2\right), \left(e^{\frac{\left|x\right|}{s}}\right)\right)\right), s\right) \]
        15. neg-lowering-neg.f32N/A

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \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), 2\right), \left(e^{\frac{\left|x\right|}{s}}\right)\right)\right), s\right) \]
        16. exp-lowering-exp.f32N/A

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \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), 2\right), \mathsf{exp.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right), s\right) \]
      7. Applied egg-rr100.0%

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{\_.f32}\left(4, \left(\frac{\left|x\right| + \left(-1 \cdot \left|x\right| + -1 \cdot \frac{-1 \cdot \frac{\frac{-1}{6} \cdot {\left(\left|x\right|\right)}^{3} + \frac{1}{6} \cdot {\left(\left|x\right|\right)}^{3}}{s} + {\left(\left|x\right|\right)}^{2}}{s}\right)}{s}\right)\right)\right), s\right) \]
      10. Simplified83.5%

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{/.f32}\left(s, \mathsf{*.f32}\left(x, x\right)\right)\right), s\right) \]
      13. Simplified73.4%

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

    Alternative 11: 49.0% accurate, 44.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 9.99999993922529 \cdot 10^{-9}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{s \cdot \frac{s}{x \cdot x}}{s}\\ \end{array} \end{array} \]
    (FPCore (x s)
     :precision binary32
     (if (<= x 9.99999993922529e-9) (/ 0.25 s) (/ (* s (/ s (* x x))) s)))
    float code(float x, float s) {
    	float tmp;
    	if (x <= 9.99999993922529e-9f) {
    		tmp = 0.25f / s;
    	} else {
    		tmp = (s * (s / (x * x))) / 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.99999993922529e-9) then
            tmp = 0.25e0 / s
        else
            tmp = (s * (s / (x * x))) / s
        end if
        code = tmp
    end function
    
    function code(x, s)
    	tmp = Float32(0.0)
    	if (x <= Float32(9.99999993922529e-9))
    		tmp = Float32(Float32(0.25) / s);
    	else
    		tmp = Float32(Float32(s * Float32(s / Float32(x * x))) / s);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, s)
    	tmp = single(0.0);
    	if (x <= single(9.99999993922529e-9))
    		tmp = single(0.25) / s;
    	else
    		tmp = (s * (s / (x * x))) / s;
    	end
    	tmp_2 = tmp;
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 9.99999993922529 \cdot 10^{-9}:\\
    \;\;\;\;\frac{0.25}{s}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{s \cdot \frac{s}{x \cdot x}}{s}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 9.99999994e-9

      1. Initial program 99.2%

        \[\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-/.f3237.1%

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

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

      if 9.99999994e-9 < 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. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \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), 2\right), \left(e^{\frac{\left|x\right|}{s}}\right)\right)\right), s\right) \]
        15. neg-lowering-neg.f32N/A

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \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), 2\right), \left(e^{\frac{\left|x\right|}{s}}\right)\right)\right), s\right) \]
        16. exp-lowering-exp.f32N/A

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \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), 2\right), \mathsf{exp.f32}\left(\left(\frac{\left|x\right|}{s}\right)\right)\right)\right), s\right) \]
      7. Applied egg-rr100.0%

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{\_.f32}\left(4, \left(\frac{\left|x\right| + \left(-1 \cdot \left|x\right| + -1 \cdot \frac{-1 \cdot \frac{\frac{-1}{6} \cdot {\left(\left|x\right|\right)}^{3} + \frac{1}{6} \cdot {\left(\left|x\right|\right)}^{3}}{s} + {\left(\left|x\right|\right)}^{2}}{s}\right)}{s}\right)\right)\right), s\right) \]
      10. Simplified83.5%

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(\mathsf{*.f32}\left(s, \mathsf{/.f32}\left(s, \mathsf{*.f32}\left(x, x\right)\right)\right), s\right) \]
      13. Simplified73.4%

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

    Alternative 12: 45.8% accurate, 44.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 9.99999993922529 \cdot 10^{-9}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2 \cdot \frac{x \cdot x}{s}}\\ \end{array} \end{array} \]
    (FPCore (x s)
     :precision binary32
     (if (<= x 9.99999993922529e-9) (/ 0.25 s) (/ 1.0 (* 2.0 (/ (* x x) s)))))
    float code(float x, float s) {
    	float tmp;
    	if (x <= 9.99999993922529e-9f) {
    		tmp = 0.25f / s;
    	} else {
    		tmp = 1.0f / (2.0f * ((x * x) / 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.99999993922529e-9) then
            tmp = 0.25e0 / s
        else
            tmp = 1.0e0 / (2.0e0 * ((x * x) / s))
        end if
        code = tmp
    end function
    
    function code(x, s)
    	tmp = Float32(0.0)
    	if (x <= Float32(9.99999993922529e-9))
    		tmp = Float32(Float32(0.25) / s);
    	else
    		tmp = Float32(Float32(1.0) / Float32(Float32(2.0) * Float32(Float32(x * x) / s)));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, s)
    	tmp = single(0.0);
    	if (x <= single(9.99999993922529e-9))
    		tmp = single(0.25) / s;
    	else
    		tmp = single(1.0) / (single(2.0) * ((x * x) / s));
    	end
    	tmp_2 = tmp;
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 9.99999993922529 \cdot 10^{-9}:\\
    \;\;\;\;\frac{0.25}{s}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{2 \cdot \frac{x \cdot x}{s}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 9.99999994e-9

      1. Initial program 99.2%

        \[\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-/.f3237.1%

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

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

      if 9.99999994e-9 < 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. 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-*.f3298.3%

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

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

          \[\leadsto \frac{\frac{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}{s}}{\color{blue}{4}} \]
        2. clear-numN/A

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(4, \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)\right)\right) \]
        11. neg-lowering-neg.f3298.3%

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(4, \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)\right)\right) \]
      7. Applied egg-rr98.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{4}{\frac{e^{\frac{\left|x\right|}{-s}}}{s}}}} \]
      8. Taylor expanded in s around inf

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(2, \mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), s\right)\right)\right) \]
      12. Simplified58.1%

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

    Alternative 13: 76.9% accurate, 47.7× speedup?

    \[\begin{array}{l} \\ \frac{1}{s \cdot \left(4 + \frac{x}{s} \cdot \frac{x}{s}\right)} \end{array} \]
    (FPCore (x s) :precision binary32 (/ 1.0 (* s (+ 4.0 (* (/ x s) (/ x s))))))
    float code(float x, float s) {
    	return 1.0f / (s * (4.0f + ((x / s) * (x / s))));
    }
    
    real(4) function code(x, s)
        real(4), intent (in) :: x
        real(4), intent (in) :: s
        code = 1.0e0 / (s * (4.0e0 + ((x / s) * (x / s))))
    end function
    
    function code(x, s)
    	return Float32(Float32(1.0) / Float32(s * Float32(Float32(4.0) + Float32(Float32(x / s) * Float32(x / s)))))
    end
    
    function tmp = code(x, s)
    	tmp = single(1.0) / (s * (single(4.0) + ((x / s) * (x / s))));
    end
    
    \begin{array}{l}
    
    \\
    \frac{1}{s \cdot \left(4 + \frac{x}{s} \cdot \frac{x}{s}\right)}
    \end{array}
    
    Derivation
    1. Initial program 99.5%

      \[\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}{s}}{e^{-\frac{\left|x\right|}{s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-/l/N/A

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \left(s \cdot \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. *-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) \]
      5. 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) \]
      6. +-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) \]
      7. +-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) \]
      8. 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) \]
      9. +-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) \]
      10. 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) \]
      11. 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) \]
      12. *-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) \]
      13. 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) \]
      14. /-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) \]
      15. 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. Taylor expanded in s around inf

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(x \cdot x\right), \left({s}^{2}\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}^{2}\right)\right), 4\right)\right)\right) \]
      8. unpow2N/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) \]
      9. *-lowering-*.f3277.5%

        \[\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) \]
    8. Simplified77.5%

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

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

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

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

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

      \[\leadsto \frac{1}{s \cdot \left(\color{blue}{\frac{x}{s} \cdot \frac{x}{s}} + 4\right)} \]
    11. Final simplification74.8%

      \[\leadsto \frac{1}{s \cdot \left(4 + \frac{x}{s} \cdot \frac{x}{s}\right)} \]
    12. Add Preprocessing

    Alternative 14: 45.7% accurate, 51.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 9.99999993922529 \cdot 10^{-9}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{x \cdot x}{s}}\\ \end{array} \end{array} \]
    (FPCore (x s)
     :precision binary32
     (if (<= x 9.99999993922529e-9) (/ 0.25 s) (/ 1.0 (/ (* x x) s))))
    float code(float x, float s) {
    	float tmp;
    	if (x <= 9.99999993922529e-9f) {
    		tmp = 0.25f / s;
    	} else {
    		tmp = 1.0f / ((x * x) / 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.99999993922529e-9) then
            tmp = 0.25e0 / s
        else
            tmp = 1.0e0 / ((x * x) / s)
        end if
        code = tmp
    end function
    
    function code(x, s)
    	tmp = Float32(0.0)
    	if (x <= Float32(9.99999993922529e-9))
    		tmp = Float32(Float32(0.25) / s);
    	else
    		tmp = Float32(Float32(1.0) / Float32(Float32(x * x) / s));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, s)
    	tmp = single(0.0);
    	if (x <= single(9.99999993922529e-9))
    		tmp = single(0.25) / s;
    	else
    		tmp = single(1.0) / ((x * x) / s);
    	end
    	tmp_2 = tmp;
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 9.99999993922529 \cdot 10^{-9}:\\
    \;\;\;\;\frac{0.25}{s}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{\frac{x \cdot x}{s}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 9.99999994e-9

      1. Initial program 99.2%

        \[\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-/.f3237.1%

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

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

      if 9.99999994e-9 < 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. Simplified99.9%

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(s \cdot \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. *-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) \]
        5. 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) \]
        6. +-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) \]
        7. +-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) \]
        8. 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) \]
        9. +-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) \]
        10. 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) \]
        11. 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) \]
        12. *-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) \]
        13. 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) \]
        14. /-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) \]
        15. fabs-lowering-fabs.f32100.0%

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(x \cdot x\right), \left({s}^{2}\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}^{2}\right)\right), 4\right)\right)\right) \]
        8. unpow2N/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) \]
        9. *-lowering-*.f3283.5%

          \[\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) \]
      8. Simplified83.5%

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(\frac{x \cdot x}{s \cdot s} + 4\right)}} \]
      9. Taylor expanded in s around 0

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

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

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

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

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

    Alternative 15: 45.0% accurate, 61.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 9.99999993922529 \cdot 10^{-9}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{s}{x \cdot x}\\ \end{array} \end{array} \]
    (FPCore (x s)
     :precision binary32
     (if (<= x 9.99999993922529e-9) (/ 0.25 s) (/ s (* x x))))
    float code(float x, float s) {
    	float tmp;
    	if (x <= 9.99999993922529e-9f) {
    		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 <= 9.99999993922529e-9) 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(9.99999993922529e-9))
    		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(9.99999993922529e-9))
    		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 9.99999993922529 \cdot 10^{-9}:\\
    \;\;\;\;\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 < 9.99999994e-9

      1. Initial program 99.2%

        \[\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-/.f3237.1%

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

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

      if 9.99999994e-9 < 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. Simplified99.9%

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(s \cdot \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. *-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) \]
        5. 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) \]
        6. +-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) \]
        7. +-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) \]
        8. 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) \]
        9. +-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) \]
        10. 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) \]
        11. 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) \]
        12. *-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) \]
        13. 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) \]
        14. /-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) \]
        15. fabs-lowering-fabs.f32100.0%

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(s, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\left(x \cdot x\right), \left({s}^{2}\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}^{2}\right)\right), 4\right)\right)\right) \]
        8. unpow2N/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) \]
        9. *-lowering-*.f3283.5%

          \[\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) \]
      8. Simplified83.5%

        \[\leadsto \frac{1}{\color{blue}{s \cdot \left(\frac{x \cdot x}{s \cdot s} + 4\right)}} \]
      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-*.f3254.2%

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

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

    Alternative 16: 27.1% 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.5%

      \[\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-/.f3227.6%

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

      \[\leadsto \color{blue}{\frac{0.25}{s}} \]
    6. Add Preprocessing

    Reproduce

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