Logistic distribution

Percentage Accurate: 99.6% → 99.7%
Time: 3.5s
Alternatives: 8
Speedup: 1.3×

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);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(x, s)
use fmin_fmax_functions
    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}

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

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

Initial Program: 99.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{\frac{-\left|x\right|}{s}}\\ t_1 := 1 + t\_0\\ \frac{t\_0}{\left(s \cdot t\_1\right) \cdot t\_1} \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (let* ((t_0 (exp (/ (- (fabs x)) s))) (t_1 (+ 1.0 t_0)))
   (/ t_0 (* (* s t_1) t_1))))
float code(float x, float s) {
	float t_0 = expf((-fabsf(x) / s));
	float t_1 = 1.0f + t_0;
	return t_0 / ((s * t_1) * t_1);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(x, s)
use fmin_fmax_functions
    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.7% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\mathsf{fma}\left(s, 1, s \cdot e^{-\color{blue}{\frac{\left|x\right|}{s}}}\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    16. lift-fabs.f3299.6

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\color{blue}{\left(\frac{\left|x\right|}{s}\right)}}}{e^{\frac{\left|x\right|}{-s}} + 1}}{\mathsf{fma}\left(e^{\frac{\left|x\right|}{-s}}, s, s\right)} \]
    11. lift-fabs.f3299.6

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

    \[\leadsto \frac{\frac{\color{blue}{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}}{e^{\frac{\left|x\right|}{-s}} + 1}}{\mathsf{fma}\left(e^{\frac{\left|x\right|}{-s}}, s, s\right)} \]
  7. Step-by-step derivation
    1. lift-exp.f32N/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{{\left(e^{-1}\right)}^{\color{blue}{\left(\frac{\left|x\right|}{s}\right)}} + 1}}{\mathsf{fma}\left(e^{\frac{\left|x\right|}{-s}}, s, s\right)} \]
    11. lift-fabs.f3299.6

      \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{{\left(e^{-1}\right)}^{\left(\frac{\color{blue}{\left|x\right|}}{s}\right)} + 1}}{\mathsf{fma}\left(e^{\frac{\left|x\right|}{-s}}, s, s\right)} \]
  8. Applied rewrites99.6%

    \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{\color{blue}{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}} + 1}}{\mathsf{fma}\left(e^{\frac{\left|x\right|}{-s}}, s, s\right)} \]
  9. Step-by-step derivation
    1. lift-exp.f32N/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)} + 1}}{\mathsf{fma}\left({\left(e^{-1}\right)}^{\color{blue}{\left(\frac{\left|x\right|}{s}\right)}}, s, s\right)} \]
    11. lift-fabs.f3299.6

      \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)} + 1}}{\mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{\color{blue}{\left|x\right|}}{s}\right)}, s, s\right)} \]
  10. Applied rewrites99.6%

    \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)} + 1}}{\mathsf{fma}\left(\color{blue}{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}, s, s\right)} \]
  11. Step-by-step derivation
    1. lift-pow.f32N/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(e^{-1 \cdot \frac{\color{blue}{\frac{\left|x\right|}{s}}}{2}}\right)}^{2}}{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)} + 1}}{\mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}, s, s\right)} \]
    13. lift-fabs.f3299.6

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(e^{-1 \cdot \frac{\frac{\left|x\right|}{s}}{2}}\right)}^{2}}{{\left(e^{-1 \cdot \frac{\color{blue}{\frac{\left|x\right|}{s}}}{2}}\right)}^{2} + 1}}{\mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}, s, s\right)} \]
    13. lift-fabs.f3299.6

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(e^{-1 \cdot \frac{\frac{\left|x\right|}{s}}{2}}\right)}^{2}}{{\left(e^{-1 \cdot \frac{\frac{\left|x\right|}{s}}{2}}\right)}^{2} + 1}}{\mathsf{fma}\left({\left(e^{-1 \cdot \frac{\color{blue}{\frac{\left|x\right|}{s}}}{2}}\right)}^{2}, s, s\right)} \]
    13. lift-fabs.f3299.7

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

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

Alternative 2: 99.6% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\mathsf{fma}\left(s, 1, s \cdot e^{-\color{blue}{\frac{\left|x\right|}{s}}}\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    16. lift-fabs.f3299.6

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\color{blue}{\left(\frac{\left|x\right|}{s}\right)}}}{e^{\frac{\left|x\right|}{-s}} + 1}}{\mathsf{fma}\left(e^{\frac{\left|x\right|}{-s}}, s, s\right)} \]
    11. lift-fabs.f3299.6

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

    \[\leadsto \frac{\frac{\color{blue}{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}}{e^{\frac{\left|x\right|}{-s}} + 1}}{\mathsf{fma}\left(e^{\frac{\left|x\right|}{-s}}, s, s\right)} \]
  7. Step-by-step derivation
    1. lift-exp.f32N/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{{\left(e^{-1}\right)}^{\color{blue}{\left(\frac{\left|x\right|}{s}\right)}} + 1}}{\mathsf{fma}\left(e^{\frac{\left|x\right|}{-s}}, s, s\right)} \]
    11. lift-fabs.f3299.6

      \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{{\left(e^{-1}\right)}^{\left(\frac{\color{blue}{\left|x\right|}}{s}\right)} + 1}}{\mathsf{fma}\left(e^{\frac{\left|x\right|}{-s}}, s, s\right)} \]
  8. Applied rewrites99.6%

    \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{\color{blue}{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}} + 1}}{\mathsf{fma}\left(e^{\frac{\left|x\right|}{-s}}, s, s\right)} \]
  9. Step-by-step derivation
    1. lift-exp.f32N/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)} + 1}}{\mathsf{fma}\left({\left(e^{-1}\right)}^{\color{blue}{\left(\frac{\left|x\right|}{s}\right)}}, s, s\right)} \]
    11. lift-fabs.f3299.6

      \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)} + 1}}{\mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{\color{blue}{\left|x\right|}}{s}\right)}, s, s\right)} \]
  10. Applied rewrites99.6%

    \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)} + 1}}{\mathsf{fma}\left(\color{blue}{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}, s, s\right)} \]
  11. Step-by-step derivation
    1. lift-pow.f32N/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{e^{\color{blue}{\frac{\left|x\right|}{-s}}} + 1}}{\mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}, s, s\right)} \]
    11. lift-fabs.f3299.6

      \[\leadsto \frac{\frac{{\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}}{e^{\frac{\color{blue}{\left|x\right|}}{-s}} + 1}}{\mathsf{fma}\left({\left(e^{-1}\right)}^{\left(\frac{\left|x\right|}{s}\right)}, s, s\right)} \]
  12. Applied rewrites99.6%

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

Alternative 3: 99.6% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\mathsf{fma}\left(s, 1, s \cdot e^{-\color{blue}{\frac{\left|x\right|}{s}}}\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    16. lift-fabs.f3299.6

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

    \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\color{blue}{\mathsf{fma}\left(s, 1, s \cdot e^{-\frac{\left|x\right|}{s}}\right)} \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
  4. Add Preprocessing

Alternative 4: 99.6% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\mathsf{fma}\left(s, 1, s \cdot e^{-\color{blue}{\frac{\left|x\right|}{s}}}\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    16. lift-fabs.f3299.6

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

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

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

Alternative 5: 99.6% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\left|x\right|}{-s}\\ \frac{e^{t\_0 - \log \left(e^{t\_0} + 1\right) \cdot 2}}{s} \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (let* ((t_0 (/ (fabs x) (- s))))
   (/ (exp (- t_0 (* (log (+ (exp t_0) 1.0)) 2.0))) s)))
float code(float x, float s) {
	float t_0 = fabsf(x) / -s;
	return expf((t_0 - (logf((expf(t_0) + 1.0f)) * 2.0f))) / s;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(x, s)
use fmin_fmax_functions
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: t_0
    t_0 = abs(x) / -s
    code = exp((t_0 - (log((exp(t_0) + 1.0e0)) * 2.0e0))) / s
end function
function code(x, s)
	t_0 = Float32(abs(x) / Float32(-s))
	return Float32(exp(Float32(t_0 - Float32(log(Float32(exp(t_0) + Float32(1.0))) * Float32(2.0)))) / s)
end
function tmp = code(x, s)
	t_0 = abs(x) / -s;
	tmp = exp((t_0 - (log((exp(t_0) + single(1.0))) * single(2.0)))) / s;
end
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\mathsf{fma}\left(s, 1, s \cdot e^{-\color{blue}{\frac{\left|x\right|}{s}}}\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    16. lift-fabs.f3299.6

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

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

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

Alternative 6: 96.2% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 - \frac{\left|x\right|}{s}\\ \frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot t\_0\right) \cdot t\_0} \end{array} \end{array} \]
(FPCore (x s)
 :precision binary32
 (let* ((t_0 (- 2.0 (/ (fabs x) s))))
   (/ (exp (/ (- (fabs x)) s)) (* (* s t_0) t_0))))
float code(float x, float s) {
	float t_0 = 2.0f - (fabsf(x) / s);
	return expf((-fabsf(x) / s)) / ((s * t_0) * t_0);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(x, s)
use fmin_fmax_functions
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    real(4) :: t_0
    t_0 = 2.0e0 - (abs(x) / s)
    code = exp((-abs(x) / s)) / ((s * t_0) * t_0)
end function
function code(x, s)
	t_0 = Float32(Float32(2.0) - Float32(abs(x) / s))
	return Float32(exp(Float32(Float32(-abs(x)) / s)) / Float32(Float32(s * t_0) * t_0))
end
function tmp = code(x, s)
	t_0 = single(2.0) - (abs(x) / s);
	tmp = exp((-abs(x) / s)) / ((s * t_0) * t_0);
end
\begin{array}{l}

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

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

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

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

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

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

      \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(2 + \left(-\frac{\left|x\right|}{s}\right)\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    5. lift-fabs.f3295.9

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

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

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

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

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

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

      \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(2 + \left(-\frac{\left|x\right|}{s}\right)\right)\right) \cdot \left(2 + \left(-\frac{\left|x\right|}{s}\right)\right)} \]
    5. lift-fabs.f3296.2

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

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

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

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

      \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(2 - \frac{\left|x\right|}{s}\right)\right) \cdot \left(2 + \left(-\frac{\left|x\right|}{s}\right)\right)} \]
    3. lift-fabs.f3296.2

      \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(2 - \frac{\left|x\right|}{s}\right)\right) \cdot \left(2 + \left(-\frac{\left|x\right|}{s}\right)\right)} \]
  10. Applied rewrites96.2%

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

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

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

      \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(2 - \frac{\left|x\right|}{s}\right)\right) \cdot \left(2 - \frac{\left|x\right|}{s}\right)} \]
    3. lift-fabs.f3296.2

      \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(2 - \frac{\left|x\right|}{s}\right)\right) \cdot \left(2 - \frac{\left|x\right|}{s}\right)} \]
  13. Applied rewrites96.2%

    \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(2 - \frac{\left|x\right|}{s}\right)\right) \cdot \left(2 - \color{blue}{\frac{\left|x\right|}{s}}\right)} \]
  14. Add Preprocessing

Alternative 7: 94.6% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \frac{e^{\frac{-\left|x\right|}{s}}}{4 \cdot s} \end{array} \]
(FPCore (x s) :precision binary32 (/ (exp (/ (- (fabs x)) s)) (* 4.0 s)))
float code(float x, float s) {
	return expf((-fabsf(x) / s)) / (4.0f * s);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(x, s)
use fmin_fmax_functions
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = exp((-abs(x) / s)) / (4.0e0 * s)
end function
function code(x, s)
	return Float32(exp(Float32(Float32(-abs(x)) / s)) / Float32(Float32(4.0) * s))
end
function tmp = code(x, s)
	tmp = exp((-abs(x) / s)) / (single(4.0) * s);
end
\begin{array}{l}

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

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

    \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{\color{blue}{4 \cdot s}} \]
  3. Step-by-step derivation
    1. lower-*.f3294.6

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

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

Alternative 8: 26.9% accurate, 13.8× 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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(4) function code(x, s)
use fmin_fmax_functions
    real(4), intent (in) :: x
    real(4), intent (in) :: s
    code = 0.25e0 / s
end function
function code(x, s)
	return Float32(Float32(0.25) / s)
end
function tmp = code(x, s)
	tmp = single(0.25) / s;
end
\begin{array}{l}

\\
\frac{0.25}{s}
\end{array}
Derivation
  1. Initial program 99.6%

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

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

      \[\leadsto \frac{0.25}{\color{blue}{s}} \]
  4. Applied rewrites26.9%

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

Reproduce

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