Logistic distribution

Percentage Accurate: 99.5% → 99.6%
Time: 17.4s
Alternatives: 17
Speedup: 3.0×

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

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

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 2.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \left(2 \cdot \left(\cosh \left(\frac{\left|x\right|}{s}\right) \cdot s\right) + \color{blue}{2} \cdot s\right)\right) \]
    4. distribute-lft-outN/A

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(2, \mathsf{+.f32}\left(\left(\cosh \left(\frac{\left|x\right|}{s}\right) \cdot s\right), \color{blue}{s}\right)\right)\right) \]
  7. Applied egg-rr99.8%

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

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

Alternative 2: 99.6% accurate, 3.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \left(2 \cdot \left(\cosh \left(\frac{\left|x\right|}{s}\right) \cdot s\right) + \color{blue}{2} \cdot s\right)\right) \]
    4. distribute-lft-outN/A

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

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

      \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(2, \mathsf{+.f32}\left(\left(\cosh \left(\frac{\left|x\right|}{s}\right) \cdot s\right), \color{blue}{s}\right)\right)\right) \]
  7. Applied egg-rr99.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{0.5}{\left(\cosh \left(\frac{\left|x\right|}{s}\right) + 1\right) \cdot s}} \]
  10. Final simplification99.8%

    \[\leadsto \frac{0.5}{s \cdot \left(1 + \cosh \left(\frac{\left|x\right|}{s}\right)\right)} \]
  11. Add Preprocessing

Alternative 3: 95.0% accurate, 3.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 87.0% accurate, 29.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot x}{s}\\ \frac{\frac{-4}{\frac{t\_0}{s \cdot \frac{s}{t\_0}} + -16}}{s} \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (let* ((t_0 (/ (* x x) s))) (/ (/ -4.0 (+ (/ t_0 (* s (/ s t_0))) -16.0)) s)))
float code(float x, float s) {
	float t_0 = (x * x) / s;
	return (-4.0f / ((t_0 / (s * (s / t_0))) + -16.0f)) / s;
}
real(4) function code(x, s)
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: t_0
    t_0 = (x * x) / s
    code = ((-4.0e0) / ((t_0 / (s * (s / t_0))) + (-16.0e0))) / s
end function
function code(x, s)
	t_0 = Float32(Float32(x * x) / s)
	return Float32(Float32(Float32(-4.0) / Float32(Float32(t_0 / Float32(s * Float32(s / t_0))) + Float32(-16.0))) / s)
end
function tmp = code(x, s)
	t_0 = (x * x) / s;
	tmp = (single(-4.0) / ((t_0 / (s * (s / t_0))) + single(-16.0))) / s;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x \cdot x}{s}\\
\frac{\frac{-4}{\frac{t\_0}{s \cdot \frac{s}{t\_0}} + -16}}{s}
\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. Simplified99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(\frac{x \cdot x}{s \cdot s} - 4\right), \left(\frac{x \cdot x}{s \cdot s} \cdot \frac{x \cdot x}{s \cdot s} - 4 \cdot 4\right)\right), s\right) \]
    4. sub-negN/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), \mathsf{*.f32}\left(s, s\right)\right), -4\right), \mathsf{+.f32}\left(\left(\frac{x \cdot x}{s \cdot s} \cdot \frac{x \cdot x}{s \cdot s}\right), \left(\mathsf{neg}\left(4 \cdot 4\right)\right)\right)\right), s\right) \]
  8. Applied egg-rr28.8%

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

    \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\color{blue}{-4}, \mathsf{+.f32}\left(\mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), s\right), \mathsf{*.f32}\left(s, \mathsf{/.f32}\left(s, \mathsf{/.f32}\left(\mathsf{*.f32}\left(x, x\right), s\right)\right)\right)\right), -16\right)\right), s\right) \]
  10. Step-by-step derivation
    1. Simplified87.6%

      \[\leadsto \frac{\frac{\color{blue}{-4}}{\frac{\frac{x \cdot x}{s}}{s \cdot \frac{s}{\frac{x \cdot x}{s}}} + -16}}{s} \]
    2. Add Preprocessing

    Alternative 5: 80.6% accurate, 31.0× speedup?

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

      1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 1.99999996e-31 < x

      1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{\color{blue}{\frac{x \cdot x}{s \cdot s} + 4}}}{s} \]
      7. Step-by-step derivation
        1. frac-2negN/A

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{neg.f32}\left(x\right), \mathsf{*.f32}\left(x, \left(\frac{-1}{\mathsf{neg}\left(\left(\mathsf{neg}\left(s \cdot s\right)\right)\right)}\right)\right)\right), 4\right)\right), s\right) \]
        10. remove-double-negN/A

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

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

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

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

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

    Alternative 6: 80.3% accurate, 34.4× speedup?

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

      1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 1.99999996e-31 < x

      1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 7: 74.9% accurate, 34.4× speedup?

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

      1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 1.99999996e-31 < x

      1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 8: 74.9% accurate, 34.4× speedup?

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

      1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 1.99999996e-31 < x

      1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \left(2 \cdot \left(\cosh \left(\frac{\left|x\right|}{s}\right) \cdot s\right) + \color{blue}{2} \cdot s\right)\right) \]
        4. distribute-lft-outN/A

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{*.f32}\left(2, \mathsf{+.f32}\left(\left(\cosh \left(\frac{\left|x\right|}{s}\right) \cdot s\right), \color{blue}{s}\right)\right)\right) \]
      7. Applied egg-rr99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 9: 77.8% accurate, 38.7× speedup?

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

      1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 1.23999997e-23 < s

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 10: 50.5% accurate, 38.7× speedup?

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

      1. Initial program 99.7%

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

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

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

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

      if 5.00000008e-17 < x

      1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 11: 49.5% accurate, 44.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 5.0000000843119176 \cdot 10^{-17}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{s \cdot s}{x}}{x}}{s}\\ \end{array} \end{array} \]
    (FPCore (x s)
     :precision binary32
     (if (<= x 5.0000000843119176e-17) (/ 0.25 s) (/ (/ (/ (* s s) x) x) s)))
    float code(float x, float s) {
    	float tmp;
    	if (x <= 5.0000000843119176e-17f) {
    		tmp = 0.25f / s;
    	} else {
    		tmp = (((s * s) / x) / x) / s;
    	}
    	return tmp;
    }
    
    real(4) function code(x, s)
        real(4), intent (in) :: x
        real(4), intent (in) :: s
        real(4) :: tmp
        if (x <= 5.0000000843119176e-17) then
            tmp = 0.25e0 / s
        else
            tmp = (((s * s) / x) / x) / s
        end if
        code = tmp
    end function
    
    function code(x, s)
    	tmp = Float32(0.0)
    	if (x <= Float32(5.0000000843119176e-17))
    		tmp = Float32(Float32(0.25) / s);
    	else
    		tmp = Float32(Float32(Float32(Float32(s * s) / x) / x) / s);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, s)
    	tmp = single(0.0);
    	if (x <= single(5.0000000843119176e-17))
    		tmp = single(0.25) / s;
    	else
    		tmp = (((s * s) / x) / x) / s;
    	end
    	tmp_2 = tmp;
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 5.0000000843119176 \cdot 10^{-17}:\\
    \;\;\;\;\frac{0.25}{s}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{\frac{s \cdot s}{x}}{x}}{s}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 5.00000008e-17

      1. Initial program 99.7%

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

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

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

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

      if 5.00000008e-17 < x

      1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 12: 49.6% accurate, 44.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 5.0000000843119176 \cdot 10^{-17}:\\ \;\;\;\;\frac{0.25}{s}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{s \cdot s}{x \cdot x}}{s}\\ \end{array} \end{array} \]
    (FPCore (x s)
     :precision binary32
     (if (<= x 5.0000000843119176e-17) (/ 0.25 s) (/ (/ (* s s) (* x x)) s)))
    float code(float x, float s) {
    	float tmp;
    	if (x <= 5.0000000843119176e-17f) {
    		tmp = 0.25f / s;
    	} else {
    		tmp = ((s * s) / (x * x)) / s;
    	}
    	return tmp;
    }
    
    real(4) function code(x, s)
        real(4), intent (in) :: x
        real(4), intent (in) :: s
        real(4) :: tmp
        if (x <= 5.0000000843119176e-17) then
            tmp = 0.25e0 / s
        else
            tmp = ((s * s) / (x * x)) / s
        end if
        code = tmp
    end function
    
    function code(x, s)
    	tmp = Float32(0.0)
    	if (x <= Float32(5.0000000843119176e-17))
    		tmp = Float32(Float32(0.25) / s);
    	else
    		tmp = Float32(Float32(Float32(s * s) / Float32(x * x)) / s);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, s)
    	tmp = single(0.0);
    	if (x <= single(5.0000000843119176e-17))
    		tmp = single(0.25) / s;
    	else
    		tmp = ((s * s) / (x * x)) / s;
    	end
    	tmp_2 = tmp;
    end
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 5.0000000843119176 \cdot 10^{-17}:\\
    \;\;\;\;\frac{0.25}{s}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{s \cdot s}{x \cdot x}}{s}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 5.00000008e-17

      1. Initial program 99.7%

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

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

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

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

      if 5.00000008e-17 < x

      1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 13: 45.3% accurate, 51.5× speedup?

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

      1. Initial program 99.6%

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

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

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

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

      if 9.99999994e-9 < x

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\frac{s}{x}}{\color{blue}{x}} \]
        2. clear-numN/A

          \[\leadsto \frac{1}{\color{blue}{\frac{x}{\frac{s}{x}}}} \]
        3. /-lowering-/.f32N/A

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

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

          \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(x, \mathsf{/.f32}\left(s, \color{blue}{x}\right)\right)\right) \]
      11. Applied egg-rr75.1%

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

    Alternative 14: 44.6% accurate, 51.5× speedup?

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

      1. Initial program 99.6%

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

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

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

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

      if 9.99999994e-9 < x

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\frac{s}{x}}{\color{blue}{x}} \]
        2. div-invN/A

          \[\leadsto \frac{s}{x} \cdot \color{blue}{\frac{1}{x}} \]
        3. *-lowering-*.f32N/A

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

          \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(s, x\right), \left(\frac{\color{blue}{1}}{x}\right)\right) \]
        5. /-lowering-/.f3273.9%

          \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(s, x\right), \mathsf{/.f32}\left(1, \color{blue}{x}\right)\right) \]
      11. Applied egg-rr73.9%

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

    Alternative 15: 44.6% accurate, 61.8× speedup?

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

      1. Initial program 99.6%

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

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

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

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

      if 9.99999994e-9 < x

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f32}\left(\left(\frac{s}{x}\right), \color{blue}{x}\right) \]
        3. /-lowering-/.f3273.9%

          \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(s, x\right), x\right) \]
      11. Applied egg-rr73.9%

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

    Alternative 16: 44.6% accurate, 61.8× speedup?

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

      1. Initial program 99.6%

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

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

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

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

      if 9.99999994e-9 < x

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 17: 27.5% 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. Add Preprocessing
    3. Taylor expanded in s around inf

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

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

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

    Reproduce

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