Logistic distribution

Percentage Accurate: 99.4% → 99.5%
Time: 13.6s
Alternatives: 11
Speedup: 1.1×

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 11 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.4% 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.5% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -\frac{\left|x\right|}{s}\\ \frac{e^{\mathsf{fma}\left(-2, \mathsf{log1p}\left(e^{t\_0}\right), t\_0\right)}}{s} \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (let* ((t_0 (- (/ (fabs x) s))))
   (/ (exp (fma -2.0 (log1p (exp t_0)) t_0)) s)))
float code(float x, float s) {
	float t_0 = -(fabsf(x) / s);
	return expf(fmaf(-2.0f, log1pf(expf(t_0)), t_0)) / s;
}
function code(x, s)
	t_0 = Float32(-Float32(abs(x) / s))
	return Float32(exp(fma(Float32(-2.0), log1p(exp(t_0)), t_0)) / s)
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -\frac{\left|x\right|}{s}\\
\frac{e^{\mathsf{fma}\left(-2, \mathsf{log1p}\left(e^{t\_0}\right), t\_0\right)}}{s}
\end{array}
\end{array}
Derivation
  1. Initial program 99.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{s} \cdot e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}{\left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right) \cdot \left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right)}} \]
  4. Applied rewrites99.7%

    \[\leadsto \color{blue}{\frac{\frac{1}{s} \cdot e^{-\frac{\left|x\right|}{s}}}{{\left(e^{-\frac{\left|x\right|}{s}} + 1\right)}^{2}}} \]
  5. Step-by-step derivation
    1. lift-/.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + 1\right)}^{-2} \cdot \color{blue}{\frac{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}}{s}} \]
  6. Applied rewrites99.7%

    \[\leadsto \color{blue}{\frac{e^{\mathsf{fma}\left(-2, \mathsf{log1p}\left(e^{-\frac{\left|x\right|}{s}}\right), -\frac{\left|x\right|}{s}\right)}}{s}} \]
  7. Add Preprocessing

Alternative 2: 97.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-\frac{\left|x\right|}{s}}\\ t_1 := 1 + t\_0\\ \mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 0:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \frac{x}{s}, 4\right)}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (let* ((t_0 (exp (- (/ (fabs x) s)))) (t_1 (+ 1.0 t_0)))
   (if (<= (/ t_0 (* t_1 (* s t_1))) 0.0)
     t_0
     (/ 1.0 (* s (fma (/ x s) (/ x s) 4.0))))))
float code(float x, float s) {
	float t_0 = expf(-(fabsf(x) / s));
	float t_1 = 1.0f + t_0;
	float tmp;
	if ((t_0 / (t_1 * (s * t_1))) <= 0.0f) {
		tmp = t_0;
	} else {
		tmp = 1.0f / (s * fmaf((x / s), (x / s), 4.0f));
	}
	return tmp;
}
function code(x, s)
	t_0 = exp(Float32(-Float32(abs(x) / s)))
	t_1 = Float32(Float32(1.0) + t_0)
	tmp = Float32(0.0)
	if (Float32(t_0 / Float32(t_1 * Float32(s * t_1))) <= Float32(0.0))
		tmp = t_0;
	else
		tmp = Float32(Float32(1.0) / Float32(s * fma(Float32(x / s), Float32(x / s), Float32(4.0))));
	end
	return tmp
end
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) < 0.0

    1. Initial program 99.8%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Add Preprocessing
    3. Applied rewrites100.0%

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

      \[\leadsto e^{\color{blue}{-1 \cdot \frac{\left|x\right|}{s}}} \]
    5. Step-by-step derivation
      1. neg-mul-1N/A

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

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

        \[\leadsto e^{\mathsf{neg}\left(\color{blue}{\frac{\left|x\right|}{s}}\right)} \]
      4. lower-fabs.f3299.8

        \[\leadsto e^{-\frac{\color{blue}{\left|x\right|}}{s}} \]
    6. Applied rewrites99.8%

      \[\leadsto e^{\color{blue}{-\frac{\left|x\right|}{s}}} \]

    if 0.0 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))))

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{s \cdot \frac{\left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right) \cdot \left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right)}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}}} \]
    4. Applied rewrites99.3%

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

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

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

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

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

        \[\leadsto \frac{1}{s \cdot \left(4 - \color{blue}{\frac{-4 \cdot \left|x\right| + \left(-1 \cdot \frac{-4 \cdot {\left(\left|x\right|\right)}^{2} + \left(4 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}\right)}{s} + 4 \cdot \left|x\right|\right)}{s}}\right)} \]
    7. Applied rewrites93.0%

      \[\leadsto \frac{1}{s \cdot \color{blue}{\left(4 - \frac{\left(-\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right) + 0}{s}\right)}} \]
    8. Step-by-step derivation
      1. Applied rewrites94.1%

        \[\leadsto \frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \color{blue}{\frac{x}{s}}, 4\right)} \]
    9. Recombined 2 regimes into one program.
    10. Final simplification98.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{e^{-\frac{\left|x\right|}{s}}}{\left(1 + e^{-\frac{\left|x\right|}{s}}\right) \cdot \left(s \cdot \left(1 + e^{-\frac{\left|x\right|}{s}}\right)\right)} \leq 0:\\ \;\;\;\;e^{-\frac{\left|x\right|}{s}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \frac{x}{s}, 4\right)}\\ \end{array} \]
    11. Add Preprocessing

    Alternative 3: 87.2% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-\frac{\left|x\right|}{s}}\\ t_1 := 1 + t\_0\\ \mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 0:\\ \;\;\;\;\frac{1}{s \cdot \left(x \cdot \left(x \cdot \left(\frac{1}{s \cdot s} + \frac{4}{x \cdot x}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \frac{x}{s}, 4\right)}\\ \end{array} \end{array} \]
    (FPCore (x s)
     :precision binary32
     (let* ((t_0 (exp (- (/ (fabs x) s)))) (t_1 (+ 1.0 t_0)))
       (if (<= (/ t_0 (* t_1 (* s t_1))) 0.0)
         (/ 1.0 (* s (* x (* x (+ (/ 1.0 (* s s)) (/ 4.0 (* x x)))))))
         (/ 1.0 (* s (fma (/ x s) (/ x s) 4.0))))))
    float code(float x, float s) {
    	float t_0 = expf(-(fabsf(x) / s));
    	float t_1 = 1.0f + t_0;
    	float tmp;
    	if ((t_0 / (t_1 * (s * t_1))) <= 0.0f) {
    		tmp = 1.0f / (s * (x * (x * ((1.0f / (s * s)) + (4.0f / (x * x))))));
    	} else {
    		tmp = 1.0f / (s * fmaf((x / s), (x / s), 4.0f));
    	}
    	return tmp;
    }
    
    function code(x, s)
    	t_0 = exp(Float32(-Float32(abs(x) / s)))
    	t_1 = Float32(Float32(1.0) + t_0)
    	tmp = Float32(0.0)
    	if (Float32(t_0 / Float32(t_1 * Float32(s * t_1))) <= Float32(0.0))
    		tmp = Float32(Float32(1.0) / Float32(s * Float32(x * Float32(x * Float32(Float32(Float32(1.0) / Float32(s * s)) + Float32(Float32(4.0) / Float32(x * x)))))));
    	else
    		tmp = Float32(Float32(1.0) / Float32(s * fma(Float32(x / s), Float32(x / s), Float32(4.0))));
    	end
    	return tmp
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := e^{-\frac{\left|x\right|}{s}}\\
    t_1 := 1 + t\_0\\
    \mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 0:\\
    \;\;\;\;\frac{1}{s \cdot \left(x \cdot \left(x \cdot \left(\frac{1}{s \cdot s} + \frac{4}{x \cdot x}\right)\right)\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \frac{x}{s}, 4\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) < 0.0

      1. Initial program 99.8%

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

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

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

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

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

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

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

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

          \[\leadsto \frac{1}{\color{blue}{s \cdot \frac{\left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right) \cdot \left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right)}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}}} \]
      4. Applied rewrites99.8%

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

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

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

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

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

          \[\leadsto \frac{1}{s \cdot \left(4 - \color{blue}{\frac{-4 \cdot \left|x\right| + \left(-1 \cdot \frac{-4 \cdot {\left(\left|x\right|\right)}^{2} + \left(4 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}\right)}{s} + 4 \cdot \left|x\right|\right)}{s}}\right)} \]
      7. Applied rewrites69.4%

        \[\leadsto \frac{1}{s \cdot \color{blue}{\left(4 - \frac{\left(-\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right) + 0}{s}\right)}} \]
      8. Taylor expanded in x around inf

        \[\leadsto \frac{1}{s \cdot \left({x}^{2} \cdot \color{blue}{\left(\frac{1}{{s}^{2}} + 4 \cdot \frac{1}{{x}^{2}}\right)}\right)} \]
      9. Step-by-step derivation
        1. Applied rewrites82.7%

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

        if 0.0 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))))

        1. Initial program 99.3%

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1}{\color{blue}{s \cdot \frac{\left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right) \cdot \left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right)}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}}} \]
        4. Applied rewrites99.3%

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

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

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

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

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

            \[\leadsto \frac{1}{s \cdot \left(4 - \color{blue}{\frac{-4 \cdot \left|x\right| + \left(-1 \cdot \frac{-4 \cdot {\left(\left|x\right|\right)}^{2} + \left(4 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}\right)}{s} + 4 \cdot \left|x\right|\right)}{s}}\right)} \]
        7. Applied rewrites93.0%

          \[\leadsto \frac{1}{s \cdot \color{blue}{\left(4 - \frac{\left(-\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right) + 0}{s}\right)}} \]
        8. Step-by-step derivation
          1. Applied rewrites94.1%

            \[\leadsto \frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \color{blue}{\frac{x}{s}}, 4\right)} \]
        9. Recombined 2 regimes into one program.
        10. Final simplification86.1%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{e^{-\frac{\left|x\right|}{s}}}{\left(1 + e^{-\frac{\left|x\right|}{s}}\right) \cdot \left(s \cdot \left(1 + e^{-\frac{\left|x\right|}{s}}\right)\right)} \leq 0:\\ \;\;\;\;\frac{1}{s \cdot \left(x \cdot \left(x \cdot \left(\frac{1}{s \cdot s} + \frac{4}{x \cdot x}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \frac{x}{s}, 4\right)}\\ \end{array} \]
        11. Add Preprocessing

        Alternative 4: 85.6% accurate, 0.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-\frac{\left|x\right|}{s}}\\ t_1 := 1 + t\_0\\ \mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 50:\\ \;\;\;\;\frac{\frac{1}{s}}{\mathsf{fma}\left(x, \frac{x}{s \cdot s}, 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \frac{x}{s}, 4\right)}\\ \end{array} \end{array} \]
        (FPCore (x s)
         :precision binary32
         (let* ((t_0 (exp (- (/ (fabs x) s)))) (t_1 (+ 1.0 t_0)))
           (if (<= (/ t_0 (* t_1 (* s t_1))) 50.0)
             (/ (/ 1.0 s) (fma x (/ x (* s s)) 4.0))
             (/ 1.0 (* s (fma (/ x s) (/ x s) 4.0))))))
        float code(float x, float s) {
        	float t_0 = expf(-(fabsf(x) / s));
        	float t_1 = 1.0f + t_0;
        	float tmp;
        	if ((t_0 / (t_1 * (s * t_1))) <= 50.0f) {
        		tmp = (1.0f / s) / fmaf(x, (x / (s * s)), 4.0f);
        	} else {
        		tmp = 1.0f / (s * fmaf((x / s), (x / s), 4.0f));
        	}
        	return tmp;
        }
        
        function code(x, s)
        	t_0 = exp(Float32(-Float32(abs(x) / s)))
        	t_1 = Float32(Float32(1.0) + t_0)
        	tmp = Float32(0.0)
        	if (Float32(t_0 / Float32(t_1 * Float32(s * t_1))) <= Float32(50.0))
        		tmp = Float32(Float32(Float32(1.0) / s) / fma(x, Float32(x / Float32(s * s)), Float32(4.0)));
        	else
        		tmp = Float32(Float32(1.0) / Float32(s * fma(Float32(x / s), Float32(x / s), Float32(4.0))));
        	end
        	return tmp
        end
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := e^{-\frac{\left|x\right|}{s}}\\
        t_1 := 1 + t\_0\\
        \mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 50:\\
        \;\;\;\;\frac{\frac{1}{s}}{\mathsf{fma}\left(x, \frac{x}{s \cdot s}, 4\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \frac{x}{s}, 4\right)}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) < 50

          1. Initial program 99.8%

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

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

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

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

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

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

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

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

              \[\leadsto \frac{1}{\color{blue}{s \cdot \frac{\left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right) \cdot \left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right)}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}}} \]
          4. Applied rewrites99.8%

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

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

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

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

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

              \[\leadsto \frac{1}{s \cdot \left(4 - \color{blue}{\frac{-4 \cdot \left|x\right| + \left(-1 \cdot \frac{-4 \cdot {\left(\left|x\right|\right)}^{2} + \left(4 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}\right)}{s} + 4 \cdot \left|x\right|\right)}{s}}\right)} \]
          7. Applied rewrites70.9%

            \[\leadsto \frac{1}{s \cdot \color{blue}{\left(4 - \frac{\left(-\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right) + 0}{s}\right)}} \]
          8. Step-by-step derivation
            1. lift-/.f32N/A

              \[\leadsto \color{blue}{\frac{1}{s \cdot \left(4 - \frac{\left(\mathsf{neg}\left(\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right)\right) + 0}{s}\right)}} \]
            2. lift-*.f32N/A

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

              \[\leadsto \color{blue}{\frac{\frac{1}{s}}{4 - \frac{\left(\mathsf{neg}\left(\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right)\right) + 0}{s}}} \]
            4. lower-/.f32N/A

              \[\leadsto \color{blue}{\frac{\frac{1}{s}}{4 - \frac{\left(\mathsf{neg}\left(\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right)\right) + 0}{s}}} \]
            5. lower-/.f3270.9

              \[\leadsto \frac{\color{blue}{\frac{1}{s}}}{4 - \frac{\left(-\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right) + 0}{s}} \]
          9. Applied rewrites81.0%

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

          if 50 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))))

          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. Step-by-step derivation
            1. lift-/.f32N/A

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

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

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

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

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

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

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

              \[\leadsto \frac{1}{\color{blue}{s \cdot \frac{\left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right) \cdot \left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right)}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}}} \]
          4. Applied rewrites99.3%

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

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

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

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

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

              \[\leadsto \frac{1}{s \cdot \left(4 - \color{blue}{\frac{-4 \cdot \left|x\right| + \left(-1 \cdot \frac{-4 \cdot {\left(\left|x\right|\right)}^{2} + \left(4 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}\right)}{s} + 4 \cdot \left|x\right|\right)}{s}}\right)} \]
          7. Applied rewrites92.3%

            \[\leadsto \frac{1}{s \cdot \color{blue}{\left(4 - \frac{\left(-\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right) + 0}{s}\right)}} \]
          8. Step-by-step derivation
            1. Applied rewrites93.5%

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{e^{-\frac{\left|x\right|}{s}}}{\left(1 + e^{-\frac{\left|x\right|}{s}}\right) \cdot \left(s \cdot \left(1 + e^{-\frac{\left|x\right|}{s}}\right)\right)} \leq 50:\\ \;\;\;\;\frac{\frac{1}{s}}{\mathsf{fma}\left(x, \frac{x}{s \cdot s}, 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \frac{x}{s}, 4\right)}\\ \end{array} \]
          11. Add Preprocessing

          Alternative 5: 85.8% accurate, 0.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-\frac{\left|x\right|}{s}}\\ t_1 := 1 + t\_0\\ \mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 0:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(x, \frac{x}{s \cdot s}, 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \frac{x}{s}, 4\right)}\\ \end{array} \end{array} \]
          (FPCore (x s)
           :precision binary32
           (let* ((t_0 (exp (- (/ (fabs x) s)))) (t_1 (+ 1.0 t_0)))
             (if (<= (/ t_0 (* t_1 (* s t_1))) 0.0)
               (/ 1.0 (* s (fma x (/ x (* s s)) 4.0)))
               (/ 1.0 (* s (fma (/ x s) (/ x s) 4.0))))))
          float code(float x, float s) {
          	float t_0 = expf(-(fabsf(x) / s));
          	float t_1 = 1.0f + t_0;
          	float tmp;
          	if ((t_0 / (t_1 * (s * t_1))) <= 0.0f) {
          		tmp = 1.0f / (s * fmaf(x, (x / (s * s)), 4.0f));
          	} else {
          		tmp = 1.0f / (s * fmaf((x / s), (x / s), 4.0f));
          	}
          	return tmp;
          }
          
          function code(x, s)
          	t_0 = exp(Float32(-Float32(abs(x) / s)))
          	t_1 = Float32(Float32(1.0) + t_0)
          	tmp = Float32(0.0)
          	if (Float32(t_0 / Float32(t_1 * Float32(s * t_1))) <= Float32(0.0))
          		tmp = Float32(Float32(1.0) / Float32(s * fma(x, Float32(x / Float32(s * s)), Float32(4.0))));
          	else
          		tmp = Float32(Float32(1.0) / Float32(s * fma(Float32(x / s), Float32(x / s), Float32(4.0))));
          	end
          	return tmp
          end
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := e^{-\frac{\left|x\right|}{s}}\\
          t_1 := 1 + t\_0\\
          \mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 0:\\
          \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(x, \frac{x}{s \cdot s}, 4\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \frac{x}{s}, 4\right)}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) < 0.0

            1. Initial program 99.8%

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

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

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

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

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

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

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

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

                \[\leadsto \frac{1}{\color{blue}{s \cdot \frac{\left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right) \cdot \left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right)}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}}} \]
            4. Applied rewrites99.8%

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

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

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

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

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

                \[\leadsto \frac{1}{s \cdot \left(4 - \color{blue}{\frac{-4 \cdot \left|x\right| + \left(-1 \cdot \frac{-4 \cdot {\left(\left|x\right|\right)}^{2} + \left(4 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}\right)}{s} + 4 \cdot \left|x\right|\right)}{s}}\right)} \]
            7. Applied rewrites69.4%

              \[\leadsto \frac{1}{s \cdot \color{blue}{\left(4 - \frac{\left(-\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right) + 0}{s}\right)}} \]
            8. Taylor expanded in s around -inf

              \[\leadsto \frac{1}{s \cdot \color{blue}{\left(4 + -1 \cdot \frac{-4 \cdot \left|x\right| + \left(-1 \cdot \frac{-4 \cdot {\left(\left|x\right|\right)}^{2} + \left(4 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}\right)}{s} + 4 \cdot \left|x\right|\right)}{s}\right)}} \]
            9. Applied rewrites80.0%

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

            if 0.0 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))))

            1. Initial program 99.3%

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

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

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

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

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

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

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

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

                \[\leadsto \frac{1}{\color{blue}{s \cdot \frac{\left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right) \cdot \left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right)}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}}} \]
            4. Applied rewrites99.3%

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

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

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

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

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

                \[\leadsto \frac{1}{s \cdot \left(4 - \color{blue}{\frac{-4 \cdot \left|x\right| + \left(-1 \cdot \frac{-4 \cdot {\left(\left|x\right|\right)}^{2} + \left(4 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}\right)}{s} + 4 \cdot \left|x\right|\right)}{s}}\right)} \]
            7. Applied rewrites93.0%

              \[\leadsto \frac{1}{s \cdot \color{blue}{\left(4 - \frac{\left(-\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right) + 0}{s}\right)}} \]
            8. Step-by-step derivation
              1. Applied rewrites94.1%

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{e^{-\frac{\left|x\right|}{s}}}{\left(1 + e^{-\frac{\left|x\right|}{s}}\right) \cdot \left(s \cdot \left(1 + e^{-\frac{\left|x\right|}{s}}\right)\right)} \leq 0:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(x, \frac{x}{s \cdot s}, 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\frac{x}{s}, \frac{x}{s}, 4\right)}\\ \end{array} \]
            11. Add Preprocessing

            Alternative 6: 85.6% accurate, 0.9× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-\frac{\left|x\right|}{s}}\\ t_1 := 1 + t\_0\\ \mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 7999999895928832:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(x, \frac{x}{s \cdot s}, 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{s}, \frac{x \cdot -0.0625}{s}, 0.25\right)}{s}\\ \end{array} \end{array} \]
            (FPCore (x s)
             :precision binary32
             (let* ((t_0 (exp (- (/ (fabs x) s)))) (t_1 (+ 1.0 t_0)))
               (if (<= (/ t_0 (* t_1 (* s t_1))) 7999999895928832.0)
                 (/ 1.0 (* s (fma x (/ x (* s s)) 4.0)))
                 (/ (fma (/ x s) (/ (* x -0.0625) s) 0.25) s))))
            float code(float x, float s) {
            	float t_0 = expf(-(fabsf(x) / s));
            	float t_1 = 1.0f + t_0;
            	float tmp;
            	if ((t_0 / (t_1 * (s * t_1))) <= 7999999895928832.0f) {
            		tmp = 1.0f / (s * fmaf(x, (x / (s * s)), 4.0f));
            	} else {
            		tmp = fmaf((x / s), ((x * -0.0625f) / s), 0.25f) / s;
            	}
            	return tmp;
            }
            
            function code(x, s)
            	t_0 = exp(Float32(-Float32(abs(x) / s)))
            	t_1 = Float32(Float32(1.0) + t_0)
            	tmp = Float32(0.0)
            	if (Float32(t_0 / Float32(t_1 * Float32(s * t_1))) <= Float32(7999999895928832.0))
            		tmp = Float32(Float32(1.0) / Float32(s * fma(x, Float32(x / Float32(s * s)), Float32(4.0))));
            	else
            		tmp = Float32(fma(Float32(x / s), Float32(Float32(x * Float32(-0.0625)) / s), Float32(0.25)) / s);
            	end
            	return tmp
            end
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := e^{-\frac{\left|x\right|}{s}}\\
            t_1 := 1 + t\_0\\
            \mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 7999999895928832:\\
            \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(x, \frac{x}{s \cdot s}, 4\right)}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{s}, \frac{x \cdot -0.0625}{s}, 0.25\right)}{s}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) < 7.9999999e15

              1. Initial program 99.7%

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{1}{\color{blue}{s \cdot \frac{\left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right) \cdot \left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right)}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}}} \]
              4. Applied rewrites99.7%

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

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

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

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

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

                  \[\leadsto \frac{1}{s \cdot \left(4 - \color{blue}{\frac{-4 \cdot \left|x\right| + \left(-1 \cdot \frac{-4 \cdot {\left(\left|x\right|\right)}^{2} + \left(4 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}\right)}{s} + 4 \cdot \left|x\right|\right)}{s}}\right)} \]
              7. Applied rewrites75.0%

                \[\leadsto \frac{1}{s \cdot \color{blue}{\left(4 - \frac{\left(-\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right) + 0}{s}\right)}} \]
              8. Taylor expanded in s around -inf

                \[\leadsto \frac{1}{s \cdot \color{blue}{\left(4 + -1 \cdot \frac{-4 \cdot \left|x\right| + \left(-1 \cdot \frac{-4 \cdot {\left(\left|x\right|\right)}^{2} + \left(4 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}\right)}{s} + 4 \cdot \left|x\right|\right)}{s}\right)}} \]
              9. Applied rewrites83.1%

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

              if 7.9999999e15 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))))

              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. Step-by-step derivation
                1. lift-/.f32N/A

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\frac{\frac{1}{s} \cdot e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}{\left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right) \cdot \left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right)}} \]
              4. Applied rewrites99.5%

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

                \[\leadsto \color{blue}{\frac{\left(\frac{1}{4} + \frac{1}{8} \cdot \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right) - \frac{1}{16} \cdot \frac{2 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}}{{s}^{2}}}{s}} \]
              6. Step-by-step derivation
                1. lower-/.f32N/A

                  \[\leadsto \color{blue}{\frac{\left(\frac{1}{4} + \frac{1}{8} \cdot \frac{{\left(\left|x\right|\right)}^{2}}{{s}^{2}}\right) - \frac{1}{16} \cdot \frac{2 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}}{{s}^{2}}}{s}} \]
              7. Applied rewrites55.0%

                \[\leadsto \color{blue}{\frac{0.25 + \frac{\left(x \cdot x\right) \cdot -0.0625}{s \cdot s}}{s}} \]
              8. Step-by-step derivation
                1. Applied rewrites95.8%

                  \[\leadsto \frac{\mathsf{fma}\left(\frac{x}{s}, \frac{x \cdot -0.0625}{s}, 0.25\right)}{s} \]
              9. Recombined 2 regimes into one program.
              10. Final simplification84.2%

                \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{e^{-\frac{\left|x\right|}{s}}}{\left(1 + e^{-\frac{\left|x\right|}{s}}\right) \cdot \left(s \cdot \left(1 + e^{-\frac{\left|x\right|}{s}}\right)\right)} \leq 7999999895928832:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(x, \frac{x}{s \cdot s}, 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{s}, \frac{x \cdot -0.0625}{s}, 0.25\right)}{s}\\ \end{array} \]
              11. Add Preprocessing

              Alternative 7: 85.5% accurate, 0.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-\frac{\left|x\right|}{s}}\\ t_1 := 1 + t\_0\\ \mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 1.0000000200408773 \cdot 10^{+21}:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(x, \frac{x}{s \cdot s}, 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25}{s}\\ \end{array} \end{array} \]
              (FPCore (x s)
               :precision binary32
               (let* ((t_0 (exp (- (/ (fabs x) s)))) (t_1 (+ 1.0 t_0)))
                 (if (<= (/ t_0 (* t_1 (* s t_1))) 1.0000000200408773e+21)
                   (/ 1.0 (* s (fma x (/ x (* s s)) 4.0)))
                   (/ 0.25 s))))
              float code(float x, float s) {
              	float t_0 = expf(-(fabsf(x) / s));
              	float t_1 = 1.0f + t_0;
              	float tmp;
              	if ((t_0 / (t_1 * (s * t_1))) <= 1.0000000200408773e+21f) {
              		tmp = 1.0f / (s * fmaf(x, (x / (s * s)), 4.0f));
              	} else {
              		tmp = 0.25f / s;
              	}
              	return tmp;
              }
              
              function code(x, s)
              	t_0 = exp(Float32(-Float32(abs(x) / s)))
              	t_1 = Float32(Float32(1.0) + t_0)
              	tmp = Float32(0.0)
              	if (Float32(t_0 / Float32(t_1 * Float32(s * t_1))) <= Float32(1.0000000200408773e+21))
              		tmp = Float32(Float32(1.0) / Float32(s * fma(x, Float32(x / Float32(s * s)), Float32(4.0))));
              	else
              		tmp = Float32(Float32(0.25) / s);
              	end
              	return tmp
              end
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := e^{-\frac{\left|x\right|}{s}}\\
              t_1 := 1 + t\_0\\
              \mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 1.0000000200408773 \cdot 10^{+21}:\\
              \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(x, \frac{x}{s \cdot s}, 4\right)}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{0.25}{s}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) < 1.00000002e21

                1. Initial program 99.6%

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{1}{\color{blue}{s \cdot \frac{\left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right) \cdot \left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right)}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}}} \]
                4. Applied rewrites99.7%

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

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

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

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

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

                    \[\leadsto \frac{1}{s \cdot \left(4 - \color{blue}{\frac{-4 \cdot \left|x\right| + \left(-1 \cdot \frac{-4 \cdot {\left(\left|x\right|\right)}^{2} + \left(4 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}\right)}{s} + 4 \cdot \left|x\right|\right)}{s}}\right)} \]
                7. Applied rewrites76.1%

                  \[\leadsto \frac{1}{s \cdot \color{blue}{\left(4 - \frac{\left(-\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right) + 0}{s}\right)}} \]
                8. Taylor expanded in s around -inf

                  \[\leadsto \frac{1}{s \cdot \color{blue}{\left(4 + -1 \cdot \frac{-4 \cdot \left|x\right| + \left(-1 \cdot \frac{-4 \cdot {\left(\left|x\right|\right)}^{2} + \left(4 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}\right)}{s} + 4 \cdot \left|x\right|\right)}{s}\right)}} \]
                9. Applied rewrites83.9%

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

                if 1.00000002e21 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))))

                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. Add Preprocessing
                3. Taylor expanded in s around inf

                  \[\leadsto \color{blue}{\frac{\frac{1}{4}}{s}} \]
                4. Step-by-step derivation
                  1. lower-/.f3288.2

                    \[\leadsto \color{blue}{\frac{0.25}{s}} \]
                5. Applied rewrites88.2%

                  \[\leadsto \color{blue}{\frac{0.25}{s}} \]
              3. Recombined 2 regimes into one program.
              4. Final simplification84.1%

                \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{e^{-\frac{\left|x\right|}{s}}}{\left(1 + e^{-\frac{\left|x\right|}{s}}\right) \cdot \left(s \cdot \left(1 + e^{-\frac{\left|x\right|}{s}}\right)\right)} \leq 1.0000000200408773 \cdot 10^{+21}:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(x, \frac{x}{s \cdot s}, 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25}{s}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 8: 81.6% accurate, 0.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-\frac{\left|x\right|}{s}}\\ t_1 := 1 + t\_0\\ \mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 0:\\ \;\;\;\;\frac{1}{s \cdot \frac{x \cdot x}{s \cdot s}}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25}{s}\\ \end{array} \end{array} \]
              (FPCore (x s)
               :precision binary32
               (let* ((t_0 (exp (- (/ (fabs x) s)))) (t_1 (+ 1.0 t_0)))
                 (if (<= (/ t_0 (* t_1 (* s t_1))) 0.0)
                   (/ 1.0 (* s (/ (* x x) (* s s))))
                   (/ 0.25 s))))
              float code(float x, float s) {
              	float t_0 = expf(-(fabsf(x) / s));
              	float t_1 = 1.0f + t_0;
              	float tmp;
              	if ((t_0 / (t_1 * (s * t_1))) <= 0.0f) {
              		tmp = 1.0f / (s * ((x * x) / (s * s)));
              	} else {
              		tmp = 0.25f / s;
              	}
              	return tmp;
              }
              
              real(4) function code(x, s)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: s
                  real(4) :: t_0
                  real(4) :: t_1
                  real(4) :: tmp
                  t_0 = exp(-(abs(x) / s))
                  t_1 = 1.0e0 + t_0
                  if ((t_0 / (t_1 * (s * t_1))) <= 0.0e0) then
                      tmp = 1.0e0 / (s * ((x * x) / (s * s)))
                  else
                      tmp = 0.25e0 / s
                  end if
                  code = tmp
              end function
              
              function code(x, s)
              	t_0 = exp(Float32(-Float32(abs(x) / s)))
              	t_1 = Float32(Float32(1.0) + t_0)
              	tmp = Float32(0.0)
              	if (Float32(t_0 / Float32(t_1 * Float32(s * t_1))) <= Float32(0.0))
              		tmp = Float32(Float32(1.0) / Float32(s * Float32(Float32(x * x) / Float32(s * s))));
              	else
              		tmp = Float32(Float32(0.25) / s);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, s)
              	t_0 = exp(-(abs(x) / s));
              	t_1 = single(1.0) + t_0;
              	tmp = single(0.0);
              	if ((t_0 / (t_1 * (s * t_1))) <= single(0.0))
              		tmp = single(1.0) / (s * ((x * x) / (s * s)));
              	else
              		tmp = single(0.25) / s;
              	end
              	tmp_2 = tmp;
              end
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := e^{-\frac{\left|x\right|}{s}}\\
              t_1 := 1 + t\_0\\
              \mathbf{if}\;\frac{t\_0}{t\_1 \cdot \left(s \cdot t\_1\right)} \leq 0:\\
              \;\;\;\;\frac{1}{s \cdot \frac{x \cdot x}{s \cdot s}}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{0.25}{s}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s))))) < 0.0

                1. Initial program 99.8%

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{1}{\color{blue}{s \cdot \frac{\left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right) \cdot \left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right)}{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}}} \]
                4. Applied rewrites99.8%

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

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

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

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

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

                    \[\leadsto \frac{1}{s \cdot \left(4 - \color{blue}{\frac{-4 \cdot \left|x\right| + \left(-1 \cdot \frac{-4 \cdot {\left(\left|x\right|\right)}^{2} + \left(4 \cdot {\left(\left|x\right|\right)}^{2} + {\left(\left|x\right|\right)}^{2}\right)}{s} + 4 \cdot \left|x\right|\right)}{s}}\right)} \]
                7. Applied rewrites69.4%

                  \[\leadsto \frac{1}{s \cdot \color{blue}{\left(4 - \frac{\left(-\frac{\mathsf{fma}\left(x, x, 0\right)}{s}\right) + 0}{s}\right)}} \]
                8. Taylor expanded in x around inf

                  \[\leadsto \frac{1}{s \cdot \frac{{x}^{2}}{\color{blue}{{s}^{2}}}} \]
                9. Step-by-step derivation
                  1. Applied rewrites77.2%

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

                  if 0.0 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))))

                  1. Initial program 99.3%

                    \[\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. lower-/.f3289.7

                      \[\leadsto \color{blue}{\frac{0.25}{s}} \]
                  5. Applied rewrites89.7%

                    \[\leadsto \color{blue}{\frac{0.25}{s}} \]
                10. Recombined 2 regimes into one program.
                11. Final simplification81.0%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{e^{-\frac{\left|x\right|}{s}}}{\left(1 + e^{-\frac{\left|x\right|}{s}}\right) \cdot \left(s \cdot \left(1 + e^{-\frac{\left|x\right|}{s}}\right)\right)} \leq 0:\\ \;\;\;\;\frac{1}{s \cdot \frac{x \cdot x}{s \cdot s}}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25}{s}\\ \end{array} \]
                12. Add Preprocessing

                Alternative 9: 97.2% accurate, 1.5× speedup?

                \[\begin{array}{l} \\ \frac{e^{\mathsf{fma}\left(-2, \log 2, \frac{x \cdot 0.25}{s} \cdot \frac{x}{-s}\right)}}{s} \end{array} \]
                (FPCore (x s)
                 :precision binary32
                 (/ (exp (fma -2.0 (log 2.0) (* (/ (* x 0.25) s) (/ x (- s))))) s))
                float code(float x, float s) {
                	return expf(fmaf(-2.0f, logf(2.0f), (((x * 0.25f) / s) * (x / -s)))) / s;
                }
                
                function code(x, s)
                	return Float32(exp(fma(Float32(-2.0), log(Float32(2.0)), Float32(Float32(Float32(x * Float32(0.25)) / s) * Float32(x / Float32(-s))))) / s)
                end
                
                \begin{array}{l}
                
                \\
                \frac{e^{\mathsf{fma}\left(-2, \log 2, \frac{x \cdot 0.25}{s} \cdot \frac{x}{-s}\right)}}{s}
                \end{array}
                
                Derivation
                1. Initial program 99.6%

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\frac{\frac{1}{s} \cdot e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}{\left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right) \cdot \left(1 + e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}\right)}} \]
                4. Applied rewrites99.7%

                  \[\leadsto \color{blue}{\frac{\frac{1}{s} \cdot e^{-\frac{\left|x\right|}{s}}}{{\left(e^{-\frac{\left|x\right|}{s}} + 1\right)}^{2}}} \]
                5. Step-by-step derivation
                  1. lift-/.f32N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto {\left(e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)} + 1\right)}^{-2} \cdot \color{blue}{\frac{e^{\mathsf{neg}\left(\frac{\left|x\right|}{s}\right)}}{s}} \]
                6. Applied rewrites99.7%

                  \[\leadsto \color{blue}{\frac{e^{\mathsf{fma}\left(-2, \mathsf{log1p}\left(e^{-\frac{\left|x\right|}{s}}\right), -\frac{\left|x\right|}{s}\right)}}{s}} \]
                7. Taylor expanded in s around inf

                  \[\leadsto \frac{e^{\color{blue}{-2 \cdot \log 2 + -1 \cdot \frac{\frac{-1}{4} \cdot {\left(\left|x\right|\right)}^{2} + \frac{1}{2} \cdot {\left(\left|x\right|\right)}^{2}}{{s}^{2}}}}}{s} \]
                8. Step-by-step derivation
                  1. lower-fma.f32N/A

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

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

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

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

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, \mathsf{neg}\left(\color{blue}{\frac{\frac{-1}{4} \cdot {\left(\left|x\right|\right)}^{2} + \frac{1}{2} \cdot {\left(\left|x\right|\right)}^{2}}{{s}^{2}}}\right)\right)}}{s} \]
                  6. distribute-rgt-outN/A

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, \mathsf{neg}\left(\frac{\color{blue}{{\left(\left|x\right|\right)}^{2} \cdot \left(\frac{-1}{4} + \frac{1}{2}\right)}}{{s}^{2}}\right)\right)}}{s} \]
                  7. unpow2N/A

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, \mathsf{neg}\left(\frac{\color{blue}{\left(\left|x\right| \cdot \left|x\right|\right)} \cdot \left(\frac{-1}{4} + \frac{1}{2}\right)}{{s}^{2}}\right)\right)}}{s} \]
                  8. sqr-absN/A

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, \mathsf{neg}\left(\frac{\color{blue}{\left(x \cdot x\right)} \cdot \left(\frac{-1}{4} + \frac{1}{2}\right)}{{s}^{2}}\right)\right)}}{s} \]
                  9. unpow2N/A

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

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, \mathsf{neg}\left(\frac{{x}^{2} \cdot \color{blue}{\frac{1}{4}}}{{s}^{2}}\right)\right)}}{s} \]
                  11. metadata-evalN/A

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

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

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

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

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

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, \mathsf{neg}\left(\frac{\color{blue}{\left(\frac{1}{2} \cdot \frac{1}{2}\right) \cdot {x}^{2}}}{{s}^{2}}\right)\right)}}{s} \]
                  17. metadata-evalN/A

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, \mathsf{neg}\left(\frac{\color{blue}{\frac{1}{4}} \cdot {x}^{2}}{{s}^{2}}\right)\right)}}{s} \]
                  18. lower-*.f32N/A

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, \mathsf{neg}\left(\frac{\color{blue}{\frac{1}{4} \cdot {x}^{2}}}{{s}^{2}}\right)\right)}}{s} \]
                  19. unpow2N/A

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, \mathsf{neg}\left(\frac{\frac{1}{4} \cdot \color{blue}{\left(x \cdot x\right)}}{{s}^{2}}\right)\right)}}{s} \]
                  20. lower-*.f32N/A

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, \mathsf{neg}\left(\frac{\frac{1}{4} \cdot \color{blue}{\left(x \cdot x\right)}}{{s}^{2}}\right)\right)}}{s} \]
                  21. unpow2N/A

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, \mathsf{neg}\left(\frac{\frac{1}{4} \cdot \left(x \cdot x\right)}{\color{blue}{s \cdot s}}\right)\right)}}{s} \]
                  22. lower-*.f3292.0

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, -\frac{0.25 \cdot \left(x \cdot x\right)}{\color{blue}{s \cdot s}}\right)}}{s} \]
                9. Applied rewrites92.0%

                  \[\leadsto \frac{e^{\color{blue}{\mathsf{fma}\left(-2, \log 2, -\frac{0.25 \cdot \left(x \cdot x\right)}{s \cdot s}\right)}}}{s} \]
                10. Step-by-step derivation
                  1. Applied rewrites98.1%

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, -\frac{x \cdot 0.25}{s} \cdot \frac{x}{s}\right)}}{s} \]
                  2. Final simplification98.1%

                    \[\leadsto \frac{e^{\mathsf{fma}\left(-2, \log 2, \frac{x \cdot 0.25}{s} \cdot \frac{x}{-s}\right)}}{s} \]
                  3. Add Preprocessing

                  Alternative 10: 94.6% accurate, 2.8× 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(-Float32(abs(x) / 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.6%

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

                    \[\leadsto \frac{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}{\color{blue}{4 \cdot s}} \]
                  4. Step-by-step derivation
                    1. *-commutativeN/A

                      \[\leadsto \frac{e^{\frac{\mathsf{neg}\left(\left|x\right|\right)}{s}}}{\color{blue}{s \cdot 4}} \]
                    2. lower-*.f3295.0

                      \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\color{blue}{s \cdot 4}} \]
                  5. Applied rewrites95.0%

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

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

                  Alternative 11: 28.1% accurate, 31.1× 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.6%

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

                    \[\leadsto \color{blue}{\frac{\frac{1}{4}}{s}} \]
                  4. Step-by-step derivation
                    1. lower-/.f3230.4

                      \[\leadsto \color{blue}{\frac{0.25}{s}} \]
                  5. Applied rewrites30.4%

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

                  Reproduce

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