Logistic distribution

Percentage Accurate: 99.5% → 99.4%
Time: 9.6s
Alternatives: 15
Speedup: N/A×

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 15 alternatives:

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

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.4% accurate, 1.5× speedup?

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

\\
\frac{\frac{1}{s}}{e^{\frac{\left|x\right|}{-s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}
\end{array}
Derivation
  1. Initial program 99.7%

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

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

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

Alternative 2: 99.5% accurate, 2.9× speedup?

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

\\
\begin{array}{l}
t_0 := e^{\frac{x}{s}}\\
\frac{1}{\left(1 + \frac{1}{t_0}\right) \cdot \left(s \cdot \left(1 + t_0\right)\right)}
\end{array}
\end{array}
Derivation
  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. Step-by-step derivation
    1. *-lft-identity99.7%

      \[\leadsto \color{blue}{1 \cdot \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. associate-*r/99.7%

      \[\leadsto \color{blue}{\frac{1 \cdot 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)}} \]
    3. associate-/l*99.7%

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

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

      \[\leadsto \frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}}}} \]
    6. associate-/r/99.7%

      \[\leadsto \frac{1}{\color{blue}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{1} \cdot e^{\frac{\left|x\right|}{s}}}} \]
    7. /-rgt-identity99.7%

      \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right)} \cdot e^{\frac{\left|x\right|}{s}}} \]
    8. associate-*l*99.6%

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

    \[\leadsto \color{blue}{\frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \mathsf{fma}\left(s, e^{\frac{\left|x\right|}{s}}, s\right)}} \]
  4. Step-by-step derivation
    1. fma-udef99.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot e^{\frac{\left|x\right|}{s}} + s\right)}} \]
    2. add-exp-log98.6%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s}} \cdot e^{\frac{\left|x\right|}{s}} + s\right)} \]
    3. prod-exp98.5%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s + \frac{\left|x\right|}{s}}} + s\right)} \]
    4. frac-2neg98.5%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \color{blue}{\frac{-\left|x\right|}{-s}}} + s\right)} \]
    5. add-sqr-sqrt-0.0%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}} + s\right)} \]
    6. sqrt-unprod19.8%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}} + s\right)} \]
    7. sqr-neg19.8%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\sqrt{\color{blue}{s \cdot s}}}} + s\right)} \]
    8. sqrt-unprod21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}} + s\right)} \]
    9. add-sqr-sqrt21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{s}}} + s\right)} \]
    10. prod-exp21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s} \cdot e^{\frac{-\left|x\right|}{s}}} + s\right)} \]
    11. add-exp-log22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{s} \cdot e^{\frac{-\left|x\right|}{s}} + s\right)} \]
    12. *-rgt-identity22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot e^{\frac{-\left|x\right|}{s}} + \color{blue}{s \cdot 1}\right)} \]
    13. distribute-lft-in22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot \left(e^{\frac{-\left|x\right|}{s}} + 1\right)\right)}} \]
    14. +-commutative22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot \color{blue}{\left(1 + e^{\frac{-\left|x\right|}{s}}\right)}\right)} \]
    15. *-commutative22.3%

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

    \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)}} \]
  6. Step-by-step derivation
    1. remove-double-neg27.1%

      \[\leadsto \frac{1}{\left(e^{\frac{\color{blue}{-\left(-\left|x\right|\right)}}{-s}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    2. distribute-frac-neg27.1%

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

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

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

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

      \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{s}\right)}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    7. add-sqr-sqrt26.2%

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

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{s \cdot s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    9. sqr-neg26.2%

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\sqrt{\color{blue}{\left(-s\right) \cdot \left(-s\right)}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    10. sqrt-unprod19.2%

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    11. add-sqr-sqrt82.1%

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{-s}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    12. exp-prod95.3%

      \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{e^{\left|x\right| \cdot \frac{1}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    13. div-inv95.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\color{blue}{\frac{\left|x\right|}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    14. add-sqr-sqrt48.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    15. fabs-sqr48.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    16. add-sqr-sqrt60.9%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{x}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    17. add-sqr-sqrt-0.0%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    18. sqrt-unprod58.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    19. sqr-neg58.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\sqrt{\color{blue}{s \cdot s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    20. sqrt-unprod61.5%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    21. add-sqr-sqrt61.5%

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

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

    \[\leadsto \frac{1}{\left(1 + \frac{1}{e^{\frac{x}{s}}}\right) \cdot \left(s \cdot \left(1 + e^{\frac{x}{s}}\right)\right)} \]

Alternative 3: 99.5% accurate, 2.9× speedup?

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

\\
\frac{1}{\left(s \cdot \left(1 + e^{\frac{x}{s}}\right)\right) \cdot \left(1 + e^{-\frac{x}{s}}\right)}
\end{array}
Derivation
  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. Step-by-step derivation
    1. *-lft-identity99.7%

      \[\leadsto \color{blue}{1 \cdot \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. associate-*r/99.7%

      \[\leadsto \color{blue}{\frac{1 \cdot 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)}} \]
    3. associate-/l*99.7%

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

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

      \[\leadsto \frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}}}} \]
    6. associate-/r/99.7%

      \[\leadsto \frac{1}{\color{blue}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{1} \cdot e^{\frac{\left|x\right|}{s}}}} \]
    7. /-rgt-identity99.7%

      \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right)} \cdot e^{\frac{\left|x\right|}{s}}} \]
    8. associate-*l*99.6%

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

    \[\leadsto \color{blue}{\frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \mathsf{fma}\left(s, e^{\frac{\left|x\right|}{s}}, s\right)}} \]
  4. Step-by-step derivation
    1. fma-udef99.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot e^{\frac{\left|x\right|}{s}} + s\right)}} \]
    2. add-exp-log98.6%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s}} \cdot e^{\frac{\left|x\right|}{s}} + s\right)} \]
    3. prod-exp98.5%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s + \frac{\left|x\right|}{s}}} + s\right)} \]
    4. frac-2neg98.5%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \color{blue}{\frac{-\left|x\right|}{-s}}} + s\right)} \]
    5. add-sqr-sqrt-0.0%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}} + s\right)} \]
    6. sqrt-unprod19.8%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}} + s\right)} \]
    7. sqr-neg19.8%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\sqrt{\color{blue}{s \cdot s}}}} + s\right)} \]
    8. sqrt-unprod21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}} + s\right)} \]
    9. add-sqr-sqrt21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{s}}} + s\right)} \]
    10. prod-exp21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s} \cdot e^{\frac{-\left|x\right|}{s}}} + s\right)} \]
    11. add-exp-log22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{s} \cdot e^{\frac{-\left|x\right|}{s}} + s\right)} \]
    12. *-rgt-identity22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot e^{\frac{-\left|x\right|}{s}} + \color{blue}{s \cdot 1}\right)} \]
    13. distribute-lft-in22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot \left(e^{\frac{-\left|x\right|}{s}} + 1\right)\right)}} \]
    14. +-commutative22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot \color{blue}{\left(1 + e^{\frac{-\left|x\right|}{s}}\right)}\right)} \]
    15. *-commutative22.3%

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

    \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)}} \]
  6. Step-by-step derivation
    1. remove-double-neg27.1%

      \[\leadsto \frac{1}{\left(e^{\frac{\color{blue}{-\left(-\left|x\right|\right)}}{-s}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    2. distribute-frac-neg27.1%

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

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

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

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

      \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{s}\right)}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    7. add-sqr-sqrt26.2%

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

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{s \cdot s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    9. sqr-neg26.2%

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\sqrt{\color{blue}{\left(-s\right) \cdot \left(-s\right)}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    10. sqrt-unprod19.2%

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    11. add-sqr-sqrt82.1%

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{-s}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    12. exp-prod95.3%

      \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{e^{\left|x\right| \cdot \frac{1}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    13. div-inv95.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\color{blue}{\frac{\left|x\right|}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    14. add-sqr-sqrt48.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    15. fabs-sqr48.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    16. add-sqr-sqrt60.9%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{x}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    17. add-sqr-sqrt-0.0%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    18. sqrt-unprod58.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    19. sqr-neg58.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\sqrt{\color{blue}{s \cdot s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    20. sqrt-unprod61.5%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    21. add-sqr-sqrt61.5%

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

    \[\leadsto \frac{1}{\left(\color{blue}{\frac{1}{e^{\frac{x}{s}}}} + 1\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
  8. Step-by-step derivation
    1. rec-exp61.5%

      \[\leadsto \frac{1}{\left(\color{blue}{e^{-\frac{x}{s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    2. distribute-neg-frac61.5%

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

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

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

Alternative 4: 62.7% accurate, 5.2× speedup?

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

\\
\frac{1}{\left(s \cdot \left(1 + e^{\frac{x}{s}}\right)\right) \cdot \left(1 + \frac{1}{1 + \frac{x}{s}}\right)}
\end{array}
Derivation
  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. Step-by-step derivation
    1. *-lft-identity99.7%

      \[\leadsto \color{blue}{1 \cdot \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. associate-*r/99.7%

      \[\leadsto \color{blue}{\frac{1 \cdot 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)}} \]
    3. associate-/l*99.7%

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

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

      \[\leadsto \frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}}}} \]
    6. associate-/r/99.7%

      \[\leadsto \frac{1}{\color{blue}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{1} \cdot e^{\frac{\left|x\right|}{s}}}} \]
    7. /-rgt-identity99.7%

      \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right)} \cdot e^{\frac{\left|x\right|}{s}}} \]
    8. associate-*l*99.6%

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

    \[\leadsto \color{blue}{\frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \mathsf{fma}\left(s, e^{\frac{\left|x\right|}{s}}, s\right)}} \]
  4. Step-by-step derivation
    1. fma-udef99.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot e^{\frac{\left|x\right|}{s}} + s\right)}} \]
    2. add-exp-log98.6%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s}} \cdot e^{\frac{\left|x\right|}{s}} + s\right)} \]
    3. prod-exp98.5%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s + \frac{\left|x\right|}{s}}} + s\right)} \]
    4. frac-2neg98.5%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \color{blue}{\frac{-\left|x\right|}{-s}}} + s\right)} \]
    5. add-sqr-sqrt-0.0%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}} + s\right)} \]
    6. sqrt-unprod19.8%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}} + s\right)} \]
    7. sqr-neg19.8%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\sqrt{\color{blue}{s \cdot s}}}} + s\right)} \]
    8. sqrt-unprod21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}} + s\right)} \]
    9. add-sqr-sqrt21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{s}}} + s\right)} \]
    10. prod-exp21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s} \cdot e^{\frac{-\left|x\right|}{s}}} + s\right)} \]
    11. add-exp-log22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{s} \cdot e^{\frac{-\left|x\right|}{s}} + s\right)} \]
    12. *-rgt-identity22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot e^{\frac{-\left|x\right|}{s}} + \color{blue}{s \cdot 1}\right)} \]
    13. distribute-lft-in22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot \left(e^{\frac{-\left|x\right|}{s}} + 1\right)\right)}} \]
    14. +-commutative22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot \color{blue}{\left(1 + e^{\frac{-\left|x\right|}{s}}\right)}\right)} \]
    15. *-commutative22.3%

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

    \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)}} \]
  6. Step-by-step derivation
    1. remove-double-neg27.1%

      \[\leadsto \frac{1}{\left(e^{\frac{\color{blue}{-\left(-\left|x\right|\right)}}{-s}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    2. distribute-frac-neg27.1%

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

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

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

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

      \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{s}\right)}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    7. add-sqr-sqrt26.2%

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

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{s \cdot s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    9. sqr-neg26.2%

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\sqrt{\color{blue}{\left(-s\right) \cdot \left(-s\right)}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    10. sqrt-unprod19.2%

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    11. add-sqr-sqrt82.1%

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{-s}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    12. exp-prod95.3%

      \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{e^{\left|x\right| \cdot \frac{1}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    13. div-inv95.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\color{blue}{\frac{\left|x\right|}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    14. add-sqr-sqrt48.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    15. fabs-sqr48.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    16. add-sqr-sqrt60.9%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{x}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    17. add-sqr-sqrt-0.0%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    18. sqrt-unprod58.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    19. sqr-neg58.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\sqrt{\color{blue}{s \cdot s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    20. sqrt-unprod61.5%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    21. add-sqr-sqrt61.5%

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

    \[\leadsto \frac{1}{\left(\color{blue}{\frac{1}{e^{\frac{x}{s}}}} + 1\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
  8. Taylor expanded in x around 0 61.5%

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

    \[\leadsto \frac{1}{\left(s \cdot \left(1 + e^{\frac{x}{s}}\right)\right) \cdot \left(1 + \frac{1}{1 + \frac{x}{s}}\right)} \]

Alternative 5: 61.1% accurate, 5.6× speedup?

\[\begin{array}{l} \\ \frac{\frac{1}{s}}{2 + 2 \cdot e^{\frac{x}{s}}} \end{array} \]
(FPCore (x s) :precision binary32 (/ (/ 1.0 s) (+ 2.0 (* 2.0 (exp (/ x s))))))
float code(float x, float s) {
	return (1.0f / s) / (2.0f + (2.0f * expf((x / s))));
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = (1.0e0 / s) / (2.0e0 + (2.0e0 * exp((x / s))))
end function
function code(x, s)
	return Float32(Float32(Float32(1.0) / s) / Float32(Float32(2.0) + Float32(Float32(2.0) * exp(Float32(x / s)))))
end
function tmp = code(x, s)
	tmp = (single(1.0) / s) / (single(2.0) + (single(2.0) * exp((x / s))));
end
\begin{array}{l}

\\
\frac{\frac{1}{s}}{2 + 2 \cdot e^{\frac{x}{s}}}
\end{array}
Derivation
  1. Initial program 99.7%

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

    \[\leadsto \color{blue}{\frac{\frac{1}{s}}{e^{\frac{\left|x\right|}{-s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
  3. Step-by-step derivation
    1. expm1-log1p-u98.0%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{\left|x\right|}{-s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}\right)\right)} \]
    2. expm1-udef97.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{\left|x\right|}{-s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}\right)} - 1} \]
  4. Applied egg-rr58.8%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{x}{s}} + \left(e^{\frac{x}{s}} + 2\right)}\right)} - 1} \]
  5. Step-by-step derivation
    1. expm1-def58.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{x}{s}} + \left(e^{\frac{x}{s}} + 2\right)}\right)\right)} \]
    2. expm1-log1p59.7%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{e^{\frac{x}{s}} + \left(e^{\frac{x}{s}} + 2\right)}} \]
    3. associate-+r+59.7%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\left(e^{\frac{x}{s}} + e^{\frac{x}{s}}\right) + 2}} \]
    4. count-259.7%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{2 \cdot e^{\frac{x}{s}}} + 2} \]
  6. Simplified59.7%

    \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 \cdot e^{\frac{x}{s}} + 2}} \]
  7. Final simplification59.7%

    \[\leadsto \frac{\frac{1}{s}}{2 + 2 \cdot e^{\frac{x}{s}}} \]

Alternative 6: 55.7% accurate, 15.0× speedup?

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

\\
\begin{array}{l}
t_0 := 1 + \left(\frac{x}{s} + 0.5 \cdot \frac{x \cdot x}{s \cdot s}\right)\\
\mathbf{if}\;x \leq 1.5000000786160286 \cdot 10^{-23}:\\
\;\;\;\;\frac{0.25}{s}\\

\mathbf{elif}\;x \leq 200000:\\
\;\;\;\;\frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{x \cdot \left(x \cdot -0.5\right)}{s \cdot s}\right) \cdot \left(s \cdot \left(1 + t_0\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{s}}{2 + 2 \cdot t_0}\\


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

    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. Taylor expanded in s around inf 34.1%

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

    if 1.50000008e-23 < x < 2e5

    1. Initial program 99.4%

      \[\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. Step-by-step derivation
      1. *-lft-identity99.4%

        \[\leadsto \color{blue}{1 \cdot \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. associate-*r/99.4%

        \[\leadsto \color{blue}{\frac{1 \cdot 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)}} \]
      3. associate-/l*99.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{e^{\frac{-\left|x\right|}{s}}}}} \]
      4. distribute-frac-neg99.4%

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

        \[\leadsto \frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}}}} \]
      6. associate-/r/99.4%

        \[\leadsto \frac{1}{\color{blue}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{1} \cdot e^{\frac{\left|x\right|}{s}}}} \]
      7. /-rgt-identity99.4%

        \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right)} \cdot e^{\frac{\left|x\right|}{s}}} \]
      8. associate-*l*99.3%

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

      \[\leadsto \color{blue}{\frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \mathsf{fma}\left(s, e^{\frac{\left|x\right|}{s}}, s\right)}} \]
    4. Step-by-step derivation
      1. fma-udef99.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot e^{\frac{\left|x\right|}{s}} + s\right)}} \]
      2. add-exp-log98.3%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s}} \cdot e^{\frac{\left|x\right|}{s}} + s\right)} \]
      3. prod-exp98.1%

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

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \color{blue}{\frac{-\left|x\right|}{-s}}} + s\right)} \]
      5. add-sqr-sqrt-0.0%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}} + s\right)} \]
      6. sqrt-unprod17.8%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}} + s\right)} \]
      7. sqr-neg17.8%

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

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}} + s\right)} \]
      9. add-sqr-sqrt17.8%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{s}}} + s\right)} \]
      10. prod-exp17.8%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s} \cdot e^{\frac{-\left|x\right|}{s}}} + s\right)} \]
      11. add-exp-log17.8%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{s} \cdot e^{\frac{-\left|x\right|}{s}} + s\right)} \]
      12. *-rgt-identity17.8%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot e^{\frac{-\left|x\right|}{s}} + \color{blue}{s \cdot 1}\right)} \]
      13. distribute-lft-in17.8%

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

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

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

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)}} \]
    6. Step-by-step derivation
      1. remove-double-neg22.7%

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

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

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

        \[\leadsto \frac{1}{\left(\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      5. div-inv22.7%

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

        \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{s}\right)}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      7. add-sqr-sqrt19.7%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      8. sqrt-unprod19.7%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{s \cdot s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      9. sqr-neg19.7%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\sqrt{\color{blue}{\left(-s\right) \cdot \left(-s\right)}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      10. sqrt-unprod16.1%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      11. add-sqr-sqrt73.2%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{-s}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      12. exp-prod89.0%

        \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{e^{\left|x\right| \cdot \frac{1}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      13. div-inv89.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\color{blue}{\frac{\left|x\right|}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      14. add-sqr-sqrt89.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      15. fabs-sqr89.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      16. add-sqr-sqrt89.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{x}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      17. add-sqr-sqrt-0.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      18. sqrt-unprod22.7%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      19. sqr-neg22.7%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\sqrt{\color{blue}{s \cdot s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      20. sqrt-unprod22.7%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      21. add-sqr-sqrt22.7%

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

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

      \[\leadsto \frac{1}{\color{blue}{\left(-1 \cdot \frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}} + \left(2 + -1 \cdot \frac{x}{s}\right)\right)} \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
    9. Step-by-step derivation
      1. +-commutative91.0%

        \[\leadsto \frac{1}{\color{blue}{\left(\left(2 + -1 \cdot \frac{x}{s}\right) + -1 \cdot \frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right)} \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      2. mul-1-neg91.0%

        \[\leadsto \frac{1}{\left(\left(2 + -1 \cdot \frac{x}{s}\right) + \color{blue}{\left(-\frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right)}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      3. unsub-neg91.0%

        \[\leadsto \frac{1}{\color{blue}{\left(\left(2 + -1 \cdot \frac{x}{s}\right) - \frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right)} \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      4. neg-mul-191.0%

        \[\leadsto \frac{1}{\left(\left(2 + \color{blue}{\left(-\frac{x}{s}\right)}\right) - \frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      5. unsub-neg91.0%

        \[\leadsto \frac{1}{\left(\color{blue}{\left(2 - \frac{x}{s}\right)} - \frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      6. distribute-rgt-out91.0%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{\color{blue}{{x}^{2} \cdot \left(0.5 + -1\right)}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      7. unpow291.0%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{\color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + -1\right)}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      8. metadata-eval91.0%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{\left(x \cdot x\right) \cdot \color{blue}{-0.5}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      9. associate-*l*91.0%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{\color{blue}{x \cdot \left(x \cdot -0.5\right)}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      10. unpow291.0%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{x \cdot \left(x \cdot -0.5\right)}{\color{blue}{s \cdot s}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
    10. Simplified91.0%

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

      \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{x \cdot \left(x \cdot -0.5\right)}{s \cdot s}\right) \cdot \left(\left(1 + \color{blue}{\left(1 + \left(\frac{x}{s} + 0.5 \cdot \frac{{x}^{2}}{{s}^{2}}\right)\right)}\right) \cdot s\right)} \]
    12. Step-by-step derivation
      1. unpow262.5%

        \[\leadsto \frac{\frac{1}{s}}{2 \cdot \left(1 + \left(\frac{x}{s} + 0.5 \cdot \frac{\color{blue}{x \cdot x}}{{s}^{2}}\right)\right) + 2} \]
      2. unpow262.5%

        \[\leadsto \frac{\frac{1}{s}}{2 \cdot \left(1 + \left(\frac{x}{s} + 0.5 \cdot \frac{x \cdot x}{\color{blue}{s \cdot s}}\right)\right) + 2} \]
    13. Simplified68.4%

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

    if 2e5 < x

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{e^{\frac{\left|x\right|}{-s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
    3. Step-by-step derivation
      1. expm1-log1p-u100.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{\left|x\right|}{-s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}\right)\right)} \]
      2. expm1-udef100.0%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{x}{s}} + \left(e^{\frac{x}{s}} + 2\right)}\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def100.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{x}{s}} + \left(e^{\frac{x}{s}} + 2\right)}\right)\right)} \]
      2. expm1-log1p100.0%

        \[\leadsto \color{blue}{\frac{\frac{1}{s}}{e^{\frac{x}{s}} + \left(e^{\frac{x}{s}} + 2\right)}} \]
      3. associate-+r+100.0%

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\left(e^{\frac{x}{s}} + e^{\frac{x}{s}}\right) + 2}} \]
      4. count-2100.0%

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{2 \cdot e^{\frac{x}{s}}} + 2} \]
    6. Simplified100.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 \cdot e^{\frac{x}{s}} + 2}} \]
    7. Taylor expanded in x around 0 97.3%

      \[\leadsto \frac{\frac{1}{s}}{2 \cdot \color{blue}{\left(1 + \left(\frac{x}{s} + 0.5 \cdot \frac{{x}^{2}}{{s}^{2}}\right)\right)} + 2} \]
    8. Step-by-step derivation
      1. unpow297.3%

        \[\leadsto \frac{\frac{1}{s}}{2 \cdot \left(1 + \left(\frac{x}{s} + 0.5 \cdot \frac{\color{blue}{x \cdot x}}{{s}^{2}}\right)\right) + 2} \]
      2. unpow297.3%

        \[\leadsto \frac{\frac{1}{s}}{2 \cdot \left(1 + \left(\frac{x}{s} + 0.5 \cdot \frac{x \cdot x}{\color{blue}{s \cdot s}}\right)\right) + 2} \]
    9. Simplified97.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.5000000786160286 \cdot 10^{-23}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{elif}\;x \leq 200000:\\ \;\;\;\;\frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{x \cdot \left(x \cdot -0.5\right)}{s \cdot s}\right) \cdot \left(s \cdot \left(1 + \left(1 + \left(\frac{x}{s} + 0.5 \cdot \frac{x \cdot x}{s \cdot s}\right)\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s}}{2 + 2 \cdot \left(1 + \left(\frac{x}{s} + 0.5 \cdot \frac{x \cdot x}{s \cdot s}\right)\right)}\\ \end{array} \]

Alternative 7: 53.6% accurate, 22.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 - \frac{x}{s}\\ t_1 := x + s \cdot 2\\ \mathbf{if}\;x \leq 1.5000000786160286 \cdot 10^{-23}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{elif}\;x \leq 199999995904:\\ \;\;\;\;\frac{1}{\left(t_0 - \frac{x \cdot \left(x \cdot -0.5\right)}{s \cdot s}\right) \cdot t_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_0 \cdot t_1}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (let* ((t_0 (- 2.0 (/ x s))) (t_1 (+ x (* s 2.0))))
   (if (<= x 1.5000000786160286e-23)
     (/ 0.25 s)
     (if (<= x 199999995904.0)
       (/ 1.0 (* (- t_0 (/ (* x (* x -0.5)) (* s s))) t_1))
       (/ 1.0 (* t_0 t_1))))))
float code(float x, float s) {
	float t_0 = 2.0f - (x / s);
	float t_1 = x + (s * 2.0f);
	float tmp;
	if (x <= 1.5000000786160286e-23f) {
		tmp = 0.25f / s;
	} else if (x <= 199999995904.0f) {
		tmp = 1.0f / ((t_0 - ((x * (x * -0.5f)) / (s * s))) * t_1);
	} else {
		tmp = 1.0f / (t_0 * t_1);
	}
	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 = 2.0e0 - (x / s)
    t_1 = x + (s * 2.0e0)
    if (x <= 1.5000000786160286e-23) then
        tmp = 0.25e0 / s
    else if (x <= 199999995904.0e0) then
        tmp = 1.0e0 / ((t_0 - ((x * (x * (-0.5e0))) / (s * s))) * t_1)
    else
        tmp = 1.0e0 / (t_0 * t_1)
    end if
    code = tmp
end function
function code(x, s)
	t_0 = Float32(Float32(2.0) - Float32(x / s))
	t_1 = Float32(x + Float32(s * Float32(2.0)))
	tmp = Float32(0.0)
	if (x <= Float32(1.5000000786160286e-23))
		tmp = Float32(Float32(0.25) / s);
	elseif (x <= Float32(199999995904.0))
		tmp = Float32(Float32(1.0) / Float32(Float32(t_0 - Float32(Float32(x * Float32(x * Float32(-0.5))) / Float32(s * s))) * t_1));
	else
		tmp = Float32(Float32(1.0) / Float32(t_0 * t_1));
	end
	return tmp
end
function tmp_2 = code(x, s)
	t_0 = single(2.0) - (x / s);
	t_1 = x + (s * single(2.0));
	tmp = single(0.0);
	if (x <= single(1.5000000786160286e-23))
		tmp = single(0.25) / s;
	elseif (x <= single(199999995904.0))
		tmp = single(1.0) / ((t_0 - ((x * (x * single(-0.5))) / (s * s))) * t_1);
	else
		tmp = single(1.0) / (t_0 * t_1);
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 - \frac{x}{s}\\
t_1 := x + s \cdot 2\\
\mathbf{if}\;x \leq 1.5000000786160286 \cdot 10^{-23}:\\
\;\;\;\;\frac{0.25}{s}\\

\mathbf{elif}\;x \leq 199999995904:\\
\;\;\;\;\frac{1}{\left(t_0 - \frac{x \cdot \left(x \cdot -0.5\right)}{s \cdot s}\right) \cdot t_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{t_0 \cdot t_1}\\


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

    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. Taylor expanded in s around inf 34.1%

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

    if 1.50000008e-23 < x < 199999996000

    1. Initial program 99.5%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Step-by-step derivation
      1. *-lft-identity99.5%

        \[\leadsto \color{blue}{1 \cdot \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. associate-*r/99.5%

        \[\leadsto \color{blue}{\frac{1 \cdot 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)}} \]
      3. associate-/l*99.5%

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

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

        \[\leadsto \frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}}}} \]
      6. associate-/r/99.5%

        \[\leadsto \frac{1}{\color{blue}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{1} \cdot e^{\frac{\left|x\right|}{s}}}} \]
      7. /-rgt-identity99.5%

        \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right)} \cdot e^{\frac{\left|x\right|}{s}}} \]
      8. associate-*l*99.4%

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

      \[\leadsto \color{blue}{\frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \mathsf{fma}\left(s, e^{\frac{\left|x\right|}{s}}, s\right)}} \]
    4. Step-by-step derivation
      1. fma-udef99.5%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot e^{\frac{\left|x\right|}{s}} + s\right)}} \]
      2. add-exp-log98.6%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s}} \cdot e^{\frac{\left|x\right|}{s}} + s\right)} \]
      3. prod-exp98.4%

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

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \color{blue}{\frac{-\left|x\right|}{-s}}} + s\right)} \]
      5. add-sqr-sqrt-0.0%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}} + s\right)} \]
      6. sqrt-unprod15.6%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}} + s\right)} \]
      7. sqr-neg15.6%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\sqrt{\color{blue}{s \cdot s}}}} + s\right)} \]
      8. sqrt-unprod15.6%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}} + s\right)} \]
      9. add-sqr-sqrt15.6%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{s}}} + s\right)} \]
      10. prod-exp15.6%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s} \cdot e^{\frac{-\left|x\right|}{s}}} + s\right)} \]
      11. add-exp-log15.6%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{s} \cdot e^{\frac{-\left|x\right|}{s}} + s\right)} \]
      12. *-rgt-identity15.6%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot e^{\frac{-\left|x\right|}{s}} + \color{blue}{s \cdot 1}\right)} \]
      13. distribute-lft-in15.6%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot \left(e^{\frac{-\left|x\right|}{s}} + 1\right)\right)}} \]
      14. +-commutative15.6%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot \color{blue}{\left(1 + e^{\frac{-\left|x\right|}{s}}\right)}\right)} \]
      15. *-commutative15.6%

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

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)}} \]
    6. Step-by-step derivation
      1. remove-double-neg20.3%

        \[\leadsto \frac{1}{\left(e^{\frac{\color{blue}{-\left(-\left|x\right|\right)}}{-s}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      2. distribute-frac-neg20.3%

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

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

        \[\leadsto \frac{1}{\left(\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      5. div-inv20.3%

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

        \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{s}\right)}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      7. add-sqr-sqrt17.7%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      8. sqrt-unprod17.7%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{s \cdot s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      9. sqr-neg17.7%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\sqrt{\color{blue}{\left(-s\right) \cdot \left(-s\right)}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      10. sqrt-unprod13.5%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      11. add-sqr-sqrt77.5%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{-s}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      12. exp-prod90.8%

        \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{e^{\left|x\right| \cdot \frac{1}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      13. div-inv90.8%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\color{blue}{\frac{\left|x\right|}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      14. add-sqr-sqrt90.8%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      15. fabs-sqr90.8%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      16. add-sqr-sqrt90.8%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{x}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      17. add-sqr-sqrt-0.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      18. sqrt-unprod20.3%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      19. sqr-neg20.3%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\sqrt{\color{blue}{s \cdot s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      20. sqrt-unprod20.3%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      21. add-sqr-sqrt20.3%

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\left(\left(2 + -1 \cdot \frac{x}{s}\right) + -1 \cdot \frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right)} \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      2. mul-1-neg86.4%

        \[\leadsto \frac{1}{\left(\left(2 + -1 \cdot \frac{x}{s}\right) + \color{blue}{\left(-\frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right)}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      3. unsub-neg86.4%

        \[\leadsto \frac{1}{\color{blue}{\left(\left(2 + -1 \cdot \frac{x}{s}\right) - \frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right)} \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      4. neg-mul-186.4%

        \[\leadsto \frac{1}{\left(\left(2 + \color{blue}{\left(-\frac{x}{s}\right)}\right) - \frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      5. unsub-neg86.4%

        \[\leadsto \frac{1}{\left(\color{blue}{\left(2 - \frac{x}{s}\right)} - \frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      6. distribute-rgt-out86.4%

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

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{\color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + -1\right)}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      8. metadata-eval86.4%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{\left(x \cdot x\right) \cdot \color{blue}{-0.5}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      9. associate-*l*86.4%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{\color{blue}{x \cdot \left(x \cdot -0.5\right)}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      10. unpow286.4%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{x \cdot \left(x \cdot -0.5\right)}{\color{blue}{s \cdot s}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
    10. Simplified86.4%

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

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

    if 199999996000 < x

    1. Initial program 100.0%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Step-by-step derivation
      1. *-lft-identity100.0%

        \[\leadsto \color{blue}{1 \cdot \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. associate-*r/100.0%

        \[\leadsto \color{blue}{\frac{1 \cdot 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)}} \]
      3. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{e^{\frac{-\left|x\right|}{s}}}}} \]
      4. distribute-frac-neg100.0%

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

        \[\leadsto \frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}}}} \]
      6. associate-/r/100.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{1} \cdot e^{\frac{\left|x\right|}{s}}}} \]
      7. /-rgt-identity100.0%

        \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right)} \cdot e^{\frac{\left|x\right|}{s}}} \]
      8. associate-*l*100.0%

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

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

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot e^{\frac{\left|x\right|}{s}} + s\right)}} \]
      2. add-exp-log100.0%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s}} \cdot e^{\frac{\left|x\right|}{s}} + s\right)} \]
      3. prod-exp100.0%

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

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \color{blue}{\frac{-\left|x\right|}{-s}}} + s\right)} \]
      5. add-sqr-sqrt-0.0%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}} + s\right)} \]
      6. sqrt-unprod4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}} + s\right)} \]
      7. sqr-neg4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\sqrt{\color{blue}{s \cdot s}}}} + s\right)} \]
      8. sqrt-unprod4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}} + s\right)} \]
      9. add-sqr-sqrt4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{s}}} + s\right)} \]
      10. prod-exp4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s} \cdot e^{\frac{-\left|x\right|}{s}}} + s\right)} \]
      11. add-exp-log4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{s} \cdot e^{\frac{-\left|x\right|}{s}} + s\right)} \]
      12. *-rgt-identity4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot e^{\frac{-\left|x\right|}{s}} + \color{blue}{s \cdot 1}\right)} \]
      13. distribute-lft-in4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot \left(e^{\frac{-\left|x\right|}{s}} + 1\right)\right)}} \]
      14. +-commutative4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot \color{blue}{\left(1 + e^{\frac{-\left|x\right|}{s}}\right)}\right)} \]
      15. *-commutative4.4%

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

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

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(2 \cdot s + x\right)}} \]
    7. Step-by-step derivation
      1. remove-double-neg12.3%

        \[\leadsto \frac{1}{\left(e^{\frac{\color{blue}{-\left(-\left|x\right|\right)}}{-s}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      2. distribute-frac-neg12.3%

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

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

        \[\leadsto \frac{1}{\left(\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      5. div-inv12.3%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\color{blue}{\left|x\right| \cdot \frac{1}{s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      6. exp-prod12.3%

        \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{s}\right)}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      7. add-sqr-sqrt12.3%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      8. sqrt-unprod12.3%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{s \cdot s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      9. sqr-neg12.3%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\sqrt{\color{blue}{\left(-s\right) \cdot \left(-s\right)}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      10. sqrt-unprod-0.0%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      11. add-sqr-sqrt100.0%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{-s}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      12. exp-prod100.0%

        \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{e^{\left|x\right| \cdot \frac{1}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      13. div-inv100.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\color{blue}{\frac{\left|x\right|}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      14. add-sqr-sqrt100.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      15. fabs-sqr100.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      16. add-sqr-sqrt100.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{x}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      17. add-sqr-sqrt-0.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      18. sqrt-unprod12.3%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      19. sqr-neg12.3%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\sqrt{\color{blue}{s \cdot s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      20. sqrt-unprod12.3%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      21. add-sqr-sqrt12.3%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    8. Applied egg-rr12.3%

      \[\leadsto \frac{1}{\left(\color{blue}{\frac{1}{e^{\frac{x}{s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    9. Step-by-step derivation
      1. rec-exp12.3%

        \[\leadsto \frac{1}{\left(\color{blue}{e^{-\frac{x}{s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      2. distribute-neg-frac12.3%

        \[\leadsto \frac{1}{\left(e^{\color{blue}{\frac{-x}{s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    10. Simplified12.3%

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

      \[\leadsto \frac{1}{\color{blue}{\left(2 + -1 \cdot \frac{x}{s}\right)} \cdot \left(2 \cdot s + x\right)} \]
    12. Step-by-step derivation
      1. mul-1-neg98.5%

        \[\leadsto \frac{1}{\left(2 + \color{blue}{\left(-\frac{x}{s}\right)}\right) \cdot \left(2 \cdot s + x\right)} \]
      2. sub-neg98.5%

        \[\leadsto \frac{1}{\color{blue}{\left(2 - \frac{x}{s}\right)} \cdot \left(2 \cdot s + x\right)} \]
    13. Simplified98.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.5000000786160286 \cdot 10^{-23}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{elif}\;x \leq 199999995904:\\ \;\;\;\;\frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{x \cdot \left(x \cdot -0.5\right)}{s \cdot s}\right) \cdot \left(x + s \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(2 - \frac{x}{s}\right) \cdot \left(x + s \cdot 2\right)}\\ \end{array} \]

Alternative 8: 52.6% accurate, 24.6× speedup?

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

\\
\begin{array}{l}
t_0 := 2 - \frac{x}{s}\\
\mathbf{if}\;x \leq 1.5000000786160286 \cdot 10^{-23}:\\
\;\;\;\;\frac{0.25}{s}\\

\mathbf{elif}\;x \leq 4000000:\\
\;\;\;\;\frac{1}{\left(t_0 - \frac{x \cdot \left(x \cdot -0.5\right)}{s \cdot s}\right) \cdot \left(s \cdot 2\right)}\\

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


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

    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. Taylor expanded in s around inf 34.1%

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

    if 1.50000008e-23 < x < 4e6

    1. Initial program 99.4%

      \[\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. Step-by-step derivation
      1. *-lft-identity99.4%

        \[\leadsto \color{blue}{1 \cdot \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. associate-*r/99.4%

        \[\leadsto \color{blue}{\frac{1 \cdot 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)}} \]
      3. associate-/l*99.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{e^{\frac{-\left|x\right|}{s}}}}} \]
      4. distribute-frac-neg99.4%

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

        \[\leadsto \frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}}}} \]
      6. associate-/r/99.4%

        \[\leadsto \frac{1}{\color{blue}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{1} \cdot e^{\frac{\left|x\right|}{s}}}} \]
      7. /-rgt-identity99.4%

        \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right)} \cdot e^{\frac{\left|x\right|}{s}}} \]
      8. associate-*l*99.4%

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

      \[\leadsto \color{blue}{\frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \mathsf{fma}\left(s, e^{\frac{\left|x\right|}{s}}, s\right)}} \]
    4. Step-by-step derivation
      1. fma-udef99.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot e^{\frac{\left|x\right|}{s}} + s\right)}} \]
      2. add-exp-log98.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s}} \cdot e^{\frac{\left|x\right|}{s}} + s\right)} \]
      3. prod-exp98.1%

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

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \color{blue}{\frac{-\left|x\right|}{-s}}} + s\right)} \]
      5. add-sqr-sqrt-0.0%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}} + s\right)} \]
      6. sqrt-unprod17.2%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}} + s\right)} \]
      7. sqr-neg17.2%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\sqrt{\color{blue}{s \cdot s}}}} + s\right)} \]
      8. sqrt-unprod17.2%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}} + s\right)} \]
      9. add-sqr-sqrt17.2%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{s}}} + s\right)} \]
      10. prod-exp17.2%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s} \cdot e^{\frac{-\left|x\right|}{s}}} + s\right)} \]
      11. add-exp-log17.2%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{s} \cdot e^{\frac{-\left|x\right|}{s}} + s\right)} \]
      12. *-rgt-identity17.2%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot e^{\frac{-\left|x\right|}{s}} + \color{blue}{s \cdot 1}\right)} \]
      13. distribute-lft-in17.2%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot \left(e^{\frac{-\left|x\right|}{s}} + 1\right)\right)}} \]
      14. +-commutative17.2%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot \color{blue}{\left(1 + e^{\frac{-\left|x\right|}{s}}\right)}\right)} \]
      15. *-commutative17.2%

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

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)}} \]
    6. Step-by-step derivation
      1. remove-double-neg22.0%

        \[\leadsto \frac{1}{\left(e^{\frac{\color{blue}{-\left(-\left|x\right|\right)}}{-s}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      2. distribute-frac-neg22.0%

        \[\leadsto \frac{1}{\left(e^{\color{blue}{-\frac{-\left|x\right|}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      3. frac-2neg22.0%

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

        \[\leadsto \frac{1}{\left(\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      5. div-inv22.0%

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

        \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{s}\right)}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      7. add-sqr-sqrt19.1%

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

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{s \cdot s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      9. sqr-neg19.1%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\sqrt{\color{blue}{\left(-s\right) \cdot \left(-s\right)}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      10. sqrt-unprod15.3%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      11. add-sqr-sqrt74.4%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{-s}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      12. exp-prod89.5%

        \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{e^{\left|x\right| \cdot \frac{1}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      13. div-inv89.5%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\color{blue}{\frac{\left|x\right|}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      14. add-sqr-sqrt89.5%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      15. fabs-sqr89.5%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      16. add-sqr-sqrt89.5%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{x}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      17. add-sqr-sqrt-0.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      18. sqrt-unprod22.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      19. sqr-neg22.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\sqrt{\color{blue}{s \cdot s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      20. sqrt-unprod22.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      21. add-sqr-sqrt22.0%

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\left(\left(2 + -1 \cdot \frac{x}{s}\right) + -1 \cdot \frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right)} \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      2. mul-1-neg89.1%

        \[\leadsto \frac{1}{\left(\left(2 + -1 \cdot \frac{x}{s}\right) + \color{blue}{\left(-\frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right)}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      3. unsub-neg89.1%

        \[\leadsto \frac{1}{\color{blue}{\left(\left(2 + -1 \cdot \frac{x}{s}\right) - \frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right)} \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      4. neg-mul-189.1%

        \[\leadsto \frac{1}{\left(\left(2 + \color{blue}{\left(-\frac{x}{s}\right)}\right) - \frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      5. unsub-neg89.1%

        \[\leadsto \frac{1}{\left(\color{blue}{\left(2 - \frac{x}{s}\right)} - \frac{0.5 \cdot {x}^{2} + -1 \cdot {x}^{2}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      6. distribute-rgt-out89.1%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{\color{blue}{{x}^{2} \cdot \left(0.5 + -1\right)}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      7. unpow289.1%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{\color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + -1\right)}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      8. metadata-eval89.1%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{\left(x \cdot x\right) \cdot \color{blue}{-0.5}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      9. associate-*l*89.1%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{\color{blue}{x \cdot \left(x \cdot -0.5\right)}}{{s}^{2}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
      10. unpow289.1%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{x \cdot \left(x \cdot -0.5\right)}{\color{blue}{s \cdot s}}\right) \cdot \left(\left(1 + e^{\frac{x}{s}}\right) \cdot s\right)} \]
    10. Simplified89.1%

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

      \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{x \cdot \left(x \cdot -0.5\right)}{s \cdot s}\right) \cdot \color{blue}{\left(2 \cdot s\right)}} \]
    12. Step-by-step derivation
      1. *-commutative59.6%

        \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{x \cdot \left(x \cdot -0.5\right)}{s \cdot s}\right) \cdot \color{blue}{\left(s \cdot 2\right)}} \]
    13. Simplified59.6%

      \[\leadsto \frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{x \cdot \left(x \cdot -0.5\right)}{s \cdot s}\right) \cdot \color{blue}{\left(s \cdot 2\right)}} \]

    if 4e6 < x

    1. Initial program 100.0%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Step-by-step derivation
      1. *-lft-identity100.0%

        \[\leadsto \color{blue}{1 \cdot \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. associate-*r/100.0%

        \[\leadsto \color{blue}{\frac{1 \cdot 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)}} \]
      3. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{e^{\frac{-\left|x\right|}{s}}}}} \]
      4. distribute-frac-neg100.0%

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

        \[\leadsto \frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}}}} \]
      6. associate-/r/100.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{1} \cdot e^{\frac{\left|x\right|}{s}}}} \]
      7. /-rgt-identity100.0%

        \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right)} \cdot e^{\frac{\left|x\right|}{s}}} \]
      8. associate-*l*100.0%

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

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

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot e^{\frac{\left|x\right|}{s}} + s\right)}} \]
      2. add-exp-log100.0%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s}} \cdot e^{\frac{\left|x\right|}{s}} + s\right)} \]
      3. prod-exp100.0%

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

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \color{blue}{\frac{-\left|x\right|}{-s}}} + s\right)} \]
      5. add-sqr-sqrt-0.0%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}} + s\right)} \]
      6. sqrt-unprod4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}} + s\right)} \]
      7. sqr-neg4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\sqrt{\color{blue}{s \cdot s}}}} + s\right)} \]
      8. sqrt-unprod4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}} + s\right)} \]
      9. add-sqr-sqrt4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{s}}} + s\right)} \]
      10. prod-exp4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s} \cdot e^{\frac{-\left|x\right|}{s}}} + s\right)} \]
      11. add-exp-log4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{s} \cdot e^{\frac{-\left|x\right|}{s}} + s\right)} \]
      12. *-rgt-identity4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot e^{\frac{-\left|x\right|}{s}} + \color{blue}{s \cdot 1}\right)} \]
      13. distribute-lft-in4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot \left(e^{\frac{-\left|x\right|}{s}} + 1\right)\right)}} \]
      14. +-commutative4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot \color{blue}{\left(1 + e^{\frac{-\left|x\right|}{s}}\right)}\right)} \]
      15. *-commutative4.4%

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

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

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(2 \cdot s + x\right)}} \]
    7. Step-by-step derivation
      1. remove-double-neg11.9%

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

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

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

        \[\leadsto \frac{1}{\left(\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      5. div-inv11.9%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\color{blue}{\left|x\right| \cdot \frac{1}{s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      6. exp-prod11.9%

        \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{s}\right)}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      7. add-sqr-sqrt11.9%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      8. sqrt-unprod11.9%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{s \cdot s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      9. sqr-neg11.9%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\sqrt{\color{blue}{\left(-s\right) \cdot \left(-s\right)}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      10. sqrt-unprod-0.0%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      11. add-sqr-sqrt100.0%

        \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{-s}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      12. exp-prod100.0%

        \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{e^{\left|x\right| \cdot \frac{1}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      13. div-inv100.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\color{blue}{\frac{\left|x\right|}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      14. add-sqr-sqrt100.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      15. fabs-sqr100.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      16. add-sqr-sqrt100.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{x}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      17. add-sqr-sqrt-0.0%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      18. sqrt-unprod11.9%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      19. sqr-neg11.9%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\sqrt{\color{blue}{s \cdot s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      20. sqrt-unprod11.9%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      21. add-sqr-sqrt11.9%

        \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    8. Applied egg-rr11.9%

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

        \[\leadsto \frac{1}{\left(\color{blue}{e^{-\frac{x}{s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
      2. distribute-neg-frac11.9%

        \[\leadsto \frac{1}{\left(e^{\color{blue}{\frac{-x}{s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    10. Simplified11.9%

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

      \[\leadsto \frac{1}{\color{blue}{\left(2 + -1 \cdot \frac{x}{s}\right)} \cdot \left(2 \cdot s + x\right)} \]
    12. Step-by-step derivation
      1. mul-1-neg96.0%

        \[\leadsto \frac{1}{\left(2 + \color{blue}{\left(-\frac{x}{s}\right)}\right) \cdot \left(2 \cdot s + x\right)} \]
      2. sub-neg96.0%

        \[\leadsto \frac{1}{\color{blue}{\left(2 - \frac{x}{s}\right)} \cdot \left(2 \cdot s + x\right)} \]
    13. Simplified96.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.5000000786160286 \cdot 10^{-23}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{elif}\;x \leq 4000000:\\ \;\;\;\;\frac{1}{\left(\left(2 - \frac{x}{s}\right) - \frac{x \cdot \left(x \cdot -0.5\right)}{s \cdot s}\right) \cdot \left(s \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(2 - \frac{x}{s}\right) \cdot \left(x + s \cdot 2\right)}\\ \end{array} \]

Alternative 9: 54.1% accurate, 24.7× speedup?

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

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

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


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

    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. Taylor expanded in s around inf 34.1%

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

    if 1.50000008e-23 < x

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{e^{\frac{\left|x\right|}{-s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
    3. Step-by-step derivation
      1. expm1-log1p-u99.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{\left|x\right|}{-s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}\right)\right)} \]
      2. expm1-udef99.3%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{\left|x\right|}{-s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}\right)} - 1} \]
    4. Applied egg-rr96.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{x}{s}} + \left(e^{\frac{x}{s}} + 2\right)}\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def96.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{x}{s}} + \left(e^{\frac{x}{s}} + 2\right)}\right)\right)} \]
      2. expm1-log1p96.0%

        \[\leadsto \color{blue}{\frac{\frac{1}{s}}{e^{\frac{x}{s}} + \left(e^{\frac{x}{s}} + 2\right)}} \]
      3. associate-+r+96.0%

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\left(e^{\frac{x}{s}} + e^{\frac{x}{s}}\right) + 2}} \]
      4. count-296.0%

        \[\leadsto \frac{\frac{1}{s}}{\color{blue}{2 \cdot e^{\frac{x}{s}}} + 2} \]
    6. Simplified96.0%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 \cdot e^{\frac{x}{s}} + 2}} \]
    7. Taylor expanded in x around 0 83.8%

      \[\leadsto \frac{\frac{1}{s}}{2 \cdot \color{blue}{\left(1 + \left(\frac{x}{s} + 0.5 \cdot \frac{{x}^{2}}{{s}^{2}}\right)\right)} + 2} \]
    8. Step-by-step derivation
      1. unpow283.8%

        \[\leadsto \frac{\frac{1}{s}}{2 \cdot \left(1 + \left(\frac{x}{s} + 0.5 \cdot \frac{\color{blue}{x \cdot x}}{{s}^{2}}\right)\right) + 2} \]
      2. unpow283.8%

        \[\leadsto \frac{\frac{1}{s}}{2 \cdot \left(1 + \left(\frac{x}{s} + 0.5 \cdot \frac{x \cdot x}{\color{blue}{s \cdot s}}\right)\right) + 2} \]
    9. Simplified83.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.5000000786160286 \cdot 10^{-23}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{s}}{2 + 2 \cdot \left(1 + \left(\frac{x}{s} + 0.5 \cdot \frac{x \cdot x}{s \cdot s}\right)\right)}\\ \end{array} \]

Alternative 10: 64.4% accurate, 47.7× speedup?

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

\\
\frac{1}{\left(2 - \frac{x}{s}\right) \cdot \left(x + s \cdot 2\right)}
\end{array}
Derivation
  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. Step-by-step derivation
    1. *-lft-identity99.7%

      \[\leadsto \color{blue}{1 \cdot \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. associate-*r/99.7%

      \[\leadsto \color{blue}{\frac{1 \cdot 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)}} \]
    3. associate-/l*99.7%

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

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

      \[\leadsto \frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}}}} \]
    6. associate-/r/99.7%

      \[\leadsto \frac{1}{\color{blue}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{1} \cdot e^{\frac{\left|x\right|}{s}}}} \]
    7. /-rgt-identity99.7%

      \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right)} \cdot e^{\frac{\left|x\right|}{s}}} \]
    8. associate-*l*99.6%

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

    \[\leadsto \color{blue}{\frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \mathsf{fma}\left(s, e^{\frac{\left|x\right|}{s}}, s\right)}} \]
  4. Step-by-step derivation
    1. fma-udef99.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot e^{\frac{\left|x\right|}{s}} + s\right)}} \]
    2. add-exp-log98.6%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s}} \cdot e^{\frac{\left|x\right|}{s}} + s\right)} \]
    3. prod-exp98.5%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s + \frac{\left|x\right|}{s}}} + s\right)} \]
    4. frac-2neg98.5%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \color{blue}{\frac{-\left|x\right|}{-s}}} + s\right)} \]
    5. add-sqr-sqrt-0.0%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}} + s\right)} \]
    6. sqrt-unprod19.8%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}} + s\right)} \]
    7. sqr-neg19.8%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\sqrt{\color{blue}{s \cdot s}}}} + s\right)} \]
    8. sqrt-unprod21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}} + s\right)} \]
    9. add-sqr-sqrt21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{s}}} + s\right)} \]
    10. prod-exp21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s} \cdot e^{\frac{-\left|x\right|}{s}}} + s\right)} \]
    11. add-exp-log22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{s} \cdot e^{\frac{-\left|x\right|}{s}} + s\right)} \]
    12. *-rgt-identity22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot e^{\frac{-\left|x\right|}{s}} + \color{blue}{s \cdot 1}\right)} \]
    13. distribute-lft-in22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot \left(e^{\frac{-\left|x\right|}{s}} + 1\right)\right)}} \]
    14. +-commutative22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot \color{blue}{\left(1 + e^{\frac{-\left|x\right|}{s}}\right)}\right)} \]
    15. *-commutative22.3%

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

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

    \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(2 \cdot s + x\right)}} \]
  7. Step-by-step derivation
    1. remove-double-neg27.1%

      \[\leadsto \frac{1}{\left(e^{\frac{\color{blue}{-\left(-\left|x\right|\right)}}{-s}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    2. distribute-frac-neg27.1%

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

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

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

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

      \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{s}\right)}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    7. add-sqr-sqrt26.2%

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

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{s \cdot s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    9. sqr-neg26.2%

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\sqrt{\color{blue}{\left(-s\right) \cdot \left(-s\right)}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    10. sqrt-unprod19.2%

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    11. add-sqr-sqrt82.1%

      \[\leadsto \frac{1}{\left(\frac{1}{{\left(e^{\left|x\right|}\right)}^{\left(\frac{1}{\color{blue}{-s}}\right)}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    12. exp-prod95.3%

      \[\leadsto \frac{1}{\left(\frac{1}{\color{blue}{e^{\left|x\right| \cdot \frac{1}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    13. div-inv95.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\color{blue}{\frac{\left|x\right|}{-s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    14. add-sqr-sqrt48.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    15. fabs-sqr48.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    16. add-sqr-sqrt60.9%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{\color{blue}{x}}{-s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    17. add-sqr-sqrt-0.0%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    18. sqrt-unprod58.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    19. sqr-neg58.3%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\sqrt{\color{blue}{s \cdot s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    20. sqrt-unprod61.5%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    21. add-sqr-sqrt61.5%

      \[\leadsto \frac{1}{\left(\frac{1}{e^{\frac{x}{\color{blue}{s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
  8. Applied egg-rr61.5%

    \[\leadsto \frac{1}{\left(\color{blue}{\frac{1}{e^{\frac{x}{s}}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
  9. Step-by-step derivation
    1. rec-exp61.5%

      \[\leadsto \frac{1}{\left(\color{blue}{e^{-\frac{x}{s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
    2. distribute-neg-frac61.5%

      \[\leadsto \frac{1}{\left(e^{\color{blue}{\frac{-x}{s}}} + 1\right) \cdot \left(2 \cdot s + x\right)} \]
  10. Simplified61.5%

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

    \[\leadsto \frac{1}{\color{blue}{\left(2 + -1 \cdot \frac{x}{s}\right)} \cdot \left(2 \cdot s + x\right)} \]
  12. Step-by-step derivation
    1. mul-1-neg63.6%

      \[\leadsto \frac{1}{\left(2 + \color{blue}{\left(-\frac{x}{s}\right)}\right) \cdot \left(2 \cdot s + x\right)} \]
    2. sub-neg63.6%

      \[\leadsto \frac{1}{\color{blue}{\left(2 - \frac{x}{s}\right)} \cdot \left(2 \cdot s + x\right)} \]
  13. Simplified63.6%

    \[\leadsto \frac{1}{\color{blue}{\left(2 - \frac{x}{s}\right)} \cdot \left(2 \cdot s + x\right)} \]
  14. Final simplification63.6%

    \[\leadsto \frac{1}{\left(2 - \frac{x}{s}\right) \cdot \left(x + s \cdot 2\right)} \]

Alternative 11: 29.0% accurate, 55.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.003000000026077032:\\
\;\;\;\;\frac{0.25}{s}\\

\mathbf{else}:\\
\;\;\;\;\frac{0.5}{x} - \frac{s}{x \cdot x}\\


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

    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. Taylor expanded in s around inf 33.8%

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

    if 0.00300000003 < x

    1. Initial program 100.0%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Step-by-step derivation
      1. *-lft-identity100.0%

        \[\leadsto \color{blue}{1 \cdot \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. associate-*r/100.0%

        \[\leadsto \color{blue}{\frac{1 \cdot 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)}} \]
      3. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{e^{\frac{-\left|x\right|}{s}}}}} \]
      4. distribute-frac-neg100.0%

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

        \[\leadsto \frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}}}} \]
      6. associate-/r/100.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{1} \cdot e^{\frac{\left|x\right|}{s}}}} \]
      7. /-rgt-identity100.0%

        \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right)} \cdot e^{\frac{\left|x\right|}{s}}} \]
      8. associate-*l*100.0%

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

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

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot e^{\frac{\left|x\right|}{s}} + s\right)}} \]
      2. add-exp-log100.0%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s}} \cdot e^{\frac{\left|x\right|}{s}} + s\right)} \]
      3. prod-exp100.0%

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

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \color{blue}{\frac{-\left|x\right|}{-s}}} + s\right)} \]
      5. add-sqr-sqrt-0.0%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}} + s\right)} \]
      6. sqrt-unprod4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}} + s\right)} \]
      7. sqr-neg4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\sqrt{\color{blue}{s \cdot s}}}} + s\right)} \]
      8. sqrt-unprod4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}} + s\right)} \]
      9. add-sqr-sqrt4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{s}}} + s\right)} \]
      10. prod-exp4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s} \cdot e^{\frac{-\left|x\right|}{s}}} + s\right)} \]
      11. add-exp-log4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{s} \cdot e^{\frac{-\left|x\right|}{s}} + s\right)} \]
      12. *-rgt-identity4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot e^{\frac{-\left|x\right|}{s}} + \color{blue}{s \cdot 1}\right)} \]
      13. distribute-lft-in4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot \left(e^{\frac{-\left|x\right|}{s}} + 1\right)\right)}} \]
      14. +-commutative4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot \color{blue}{\left(1 + e^{\frac{-\left|x\right|}{s}}\right)}\right)} \]
      15. *-commutative4.4%

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

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

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

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

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

        \[\leadsto \color{blue}{0.5 \cdot \frac{1}{x} + -1 \cdot \frac{s}{{x}^{2}}} \]
      2. mul-1-neg10.9%

        \[\leadsto 0.5 \cdot \frac{1}{x} + \color{blue}{\left(-\frac{s}{{x}^{2}}\right)} \]
      3. unsub-neg10.9%

        \[\leadsto \color{blue}{0.5 \cdot \frac{1}{x} - \frac{s}{{x}^{2}}} \]
      4. associate-*r/10.9%

        \[\leadsto \color{blue}{\frac{0.5 \cdot 1}{x}} - \frac{s}{{x}^{2}} \]
      5. metadata-eval10.9%

        \[\leadsto \frac{\color{blue}{0.5}}{x} - \frac{s}{{x}^{2}} \]
      6. unpow210.9%

        \[\leadsto \frac{0.5}{x} - \frac{s}{\color{blue}{x \cdot x}} \]
    10. Simplified10.9%

      \[\leadsto \color{blue}{\frac{0.5}{x} - \frac{s}{x \cdot x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification26.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.003000000026077032:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{x} - \frac{s}{x \cdot x}\\ \end{array} \]

Alternative 12: 51.0% accurate, 56.4× speedup?

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

\\
\frac{\frac{1}{s}}{2 \cdot \frac{x}{s} + 4}
\end{array}
Derivation
  1. Initial program 99.7%

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

    \[\leadsto \color{blue}{\frac{\frac{1}{s}}{e^{\frac{\left|x\right|}{-s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}} \]
  3. Step-by-step derivation
    1. expm1-log1p-u98.0%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{\left|x\right|}{-s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}\right)\right)} \]
    2. expm1-udef97.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{\left|x\right|}{-s}} + \left(e^{\frac{\left|x\right|}{s}} + 2\right)}\right)} - 1} \]
  4. Applied egg-rr58.8%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{x}{s}} + \left(e^{\frac{x}{s}} + 2\right)}\right)} - 1} \]
  5. Step-by-step derivation
    1. expm1-def58.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{s}}{e^{\frac{x}{s}} + \left(e^{\frac{x}{s}} + 2\right)}\right)\right)} \]
    2. expm1-log1p59.7%

      \[\leadsto \color{blue}{\frac{\frac{1}{s}}{e^{\frac{x}{s}} + \left(e^{\frac{x}{s}} + 2\right)}} \]
    3. associate-+r+59.7%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{\left(e^{\frac{x}{s}} + e^{\frac{x}{s}}\right) + 2}} \]
    4. count-259.7%

      \[\leadsto \frac{\frac{1}{s}}{\color{blue}{2 \cdot e^{\frac{x}{s}}} + 2} \]
  6. Simplified59.7%

    \[\leadsto \color{blue}{\frac{\frac{1}{s}}{2 \cdot e^{\frac{x}{s}} + 2}} \]
  7. Taylor expanded in x around 0 51.3%

    \[\leadsto \frac{\frac{1}{s}}{\color{blue}{2 \cdot \frac{x}{s} + 4}} \]
  8. Final simplification51.3%

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

Alternative 13: 29.4% accurate, 68.9× speedup?

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

\\
\frac{1}{2 \cdot \left(x + s \cdot 2\right)}
\end{array}
Derivation
  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. Step-by-step derivation
    1. *-lft-identity99.7%

      \[\leadsto \color{blue}{1 \cdot \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. associate-*r/99.7%

      \[\leadsto \color{blue}{\frac{1 \cdot 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)}} \]
    3. associate-/l*99.7%

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

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

      \[\leadsto \frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}}}} \]
    6. associate-/r/99.7%

      \[\leadsto \frac{1}{\color{blue}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{1} \cdot e^{\frac{\left|x\right|}{s}}}} \]
    7. /-rgt-identity99.7%

      \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right)} \cdot e^{\frac{\left|x\right|}{s}}} \]
    8. associate-*l*99.6%

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

    \[\leadsto \color{blue}{\frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \mathsf{fma}\left(s, e^{\frac{\left|x\right|}{s}}, s\right)}} \]
  4. Step-by-step derivation
    1. fma-udef99.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot e^{\frac{\left|x\right|}{s}} + s\right)}} \]
    2. add-exp-log98.6%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s}} \cdot e^{\frac{\left|x\right|}{s}} + s\right)} \]
    3. prod-exp98.5%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s + \frac{\left|x\right|}{s}}} + s\right)} \]
    4. frac-2neg98.5%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \color{blue}{\frac{-\left|x\right|}{-s}}} + s\right)} \]
    5. add-sqr-sqrt-0.0%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}} + s\right)} \]
    6. sqrt-unprod19.8%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}} + s\right)} \]
    7. sqr-neg19.8%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\sqrt{\color{blue}{s \cdot s}}}} + s\right)} \]
    8. sqrt-unprod21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}} + s\right)} \]
    9. add-sqr-sqrt21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{s}}} + s\right)} \]
    10. prod-exp21.7%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s} \cdot e^{\frac{-\left|x\right|}{s}}} + s\right)} \]
    11. add-exp-log22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{s} \cdot e^{\frac{-\left|x\right|}{s}} + s\right)} \]
    12. *-rgt-identity22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot e^{\frac{-\left|x\right|}{s}} + \color{blue}{s \cdot 1}\right)} \]
    13. distribute-lft-in22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot \left(e^{\frac{-\left|x\right|}{s}} + 1\right)\right)}} \]
    14. +-commutative22.3%

      \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot \color{blue}{\left(1 + e^{\frac{-\left|x\right|}{s}}\right)}\right)} \]
    15. *-commutative22.3%

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

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

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

    \[\leadsto \frac{1}{\color{blue}{2} \cdot \left(2 \cdot s + x\right)} \]
  8. Final simplification26.3%

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

Alternative 14: 29.0% accurate, 121.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.003000000026077032:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{x}\\ \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (if (<= x 0.003000000026077032) (/ 0.25 s) (/ 0.5 x)))
float code(float x, float s) {
	float tmp;
	if (x <= 0.003000000026077032f) {
		tmp = 0.25f / s;
	} else {
		tmp = 0.5f / x;
	}
	return tmp;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: tmp
    if (x <= 0.003000000026077032e0) then
        tmp = 0.25e0 / s
    else
        tmp = 0.5e0 / x
    end if
    code = tmp
end function
function code(x, s)
	tmp = Float32(0.0)
	if (x <= Float32(0.003000000026077032))
		tmp = Float32(Float32(0.25) / s);
	else
		tmp = Float32(Float32(0.5) / x);
	end
	return tmp
end
function tmp_2 = code(x, s)
	tmp = single(0.0);
	if (x <= single(0.003000000026077032))
		tmp = single(0.25) / s;
	else
		tmp = single(0.5) / x;
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.003000000026077032:\\
\;\;\;\;\frac{0.25}{s}\\

\mathbf{else}:\\
\;\;\;\;\frac{0.5}{x}\\


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

    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. Taylor expanded in s around inf 33.8%

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

    if 0.00300000003 < x

    1. Initial program 100.0%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. Step-by-step derivation
      1. *-lft-identity100.0%

        \[\leadsto \color{blue}{1 \cdot \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. associate-*r/100.0%

        \[\leadsto \color{blue}{\frac{1 \cdot 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)}} \]
      3. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{e^{\frac{-\left|x\right|}{s}}}}} \]
      4. distribute-frac-neg100.0%

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

        \[\leadsto \frac{1}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{\color{blue}{\frac{1}{e^{\frac{\left|x\right|}{s}}}}}} \]
      6. associate-/r/100.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)}{1} \cdot e^{\frac{\left|x\right|}{s}}}} \]
      7. /-rgt-identity100.0%

        \[\leadsto \frac{1}{\color{blue}{\left(\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right)} \cdot e^{\frac{\left|x\right|}{s}}} \]
      8. associate-*l*100.0%

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

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

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot e^{\frac{\left|x\right|}{s}} + s\right)}} \]
      2. add-exp-log100.0%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s}} \cdot e^{\frac{\left|x\right|}{s}} + s\right)} \]
      3. prod-exp100.0%

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

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \color{blue}{\frac{-\left|x\right|}{-s}}} + s\right)} \]
      5. add-sqr-sqrt-0.0%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{-s} \cdot \sqrt{-s}}}} + s\right)} \]
      6. sqrt-unprod4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{\left(-s\right) \cdot \left(-s\right)}}}} + s\right)} \]
      7. sqr-neg4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\sqrt{\color{blue}{s \cdot s}}}} + s\right)} \]
      8. sqrt-unprod4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{\sqrt{s} \cdot \sqrt{s}}}} + s\right)} \]
      9. add-sqr-sqrt4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(e^{\log s + \frac{-\left|x\right|}{\color{blue}{s}}} + s\right)} \]
      10. prod-exp4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{e^{\log s} \cdot e^{\frac{-\left|x\right|}{s}}} + s\right)} \]
      11. add-exp-log4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(\color{blue}{s} \cdot e^{\frac{-\left|x\right|}{s}} + s\right)} \]
      12. *-rgt-identity4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot e^{\frac{-\left|x\right|}{s}} + \color{blue}{s \cdot 1}\right)} \]
      13. distribute-lft-in4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \color{blue}{\left(s \cdot \left(e^{\frac{-\left|x\right|}{s}} + 1\right)\right)}} \]
      14. +-commutative4.4%

        \[\leadsto \frac{1}{\left(e^{\frac{\left|x\right|}{-s}} + 1\right) \cdot \left(s \cdot \color{blue}{\left(1 + e^{\frac{-\left|x\right|}{s}}\right)}\right)} \]
      15. *-commutative4.4%

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.5}{x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification26.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.003000000026077032:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{x}\\ \end{array} \]

Alternative 15: 27.4% accurate, 206.7× speedup?

\[\begin{array}{l} \\ \frac{0.25}{s} \end{array} \]
(FPCore (x s) :precision binary32 (/ 0.25 s))
float code(float x, float s) {
	return 0.25f / s;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = 0.25e0 / s
end function
function code(x, s)
	return Float32(Float32(0.25) / s)
end
function tmp = code(x, s)
	tmp = single(0.25) / s;
end
\begin{array}{l}

\\
\frac{0.25}{s}
\end{array}
Derivation
  1. Initial program 99.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. Taylor expanded in s around inf 24.4%

    \[\leadsto \color{blue}{\frac{0.25}{s}} \]
  3. Final simplification24.4%

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

Reproduce

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