Logistic distribution

Percentage Accurate: 99.5% → 99.6%
Time: 14.1s
Alternatives: 7
Speedup: 1.1×

Specification

?
\[0 \leq s \land s \leq 1.0651631\]
\[\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} \]
(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)
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}
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}

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 7 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} 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} \]
(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)
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}
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}

Alternative 1: 99.6% accurate, 1.1× speedup?

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

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

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

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

Alternative 2: 99.6% accurate, 1.1× speedup?

\[\begin{array}{l} t_0 := \frac{-\left|x\right|}{s}\\ t_1 := \mathsf{expm1}\left(t\_0\right)\\ \frac{e^{t\_0}}{\mathsf{fma}\left(3 + t\_1, \mathsf{fma}\left(t\_1, s, s\right), s\right)} \end{array} \]
(FPCore (x s)
  :precision binary32
  (let* ((t_0 (/ (- (fabs x)) s)) (t_1 (expm1 t_0)))
  (/ (exp t_0) (fma (+ 3.0 t_1) (fma t_1 s s) s))))
float code(float x, float s) {
	float t_0 = -fabsf(x) / s;
	float t_1 = expm1f(t_0);
	return expf(t_0) / fmaf((3.0f + t_1), fmaf(t_1, s, s), s);
}
function code(x, s)
	t_0 = Float32(Float32(-abs(x)) / s)
	t_1 = expm1(t_0)
	return Float32(exp(t_0) / fma(Float32(Float32(3.0) + t_1), fma(t_1, s, s), s))
end
\begin{array}{l}
t_0 := \frac{-\left|x\right|}{s}\\
t_1 := \mathsf{expm1}\left(t\_0\right)\\
\frac{e^{t\_0}}{\mathsf{fma}\left(3 + t\_1, \mathsf{fma}\left(t\_1, s, s\right), s\right)}
\end{array}
Derivation
  1. Initial program 99.5%

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

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

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

Alternative 3: 99.5% accurate, 1.1× speedup?

\[\begin{array}{l} t_0 := \frac{-\left|x\right|}{s}\\ t_1 := -2 - \mathsf{expm1}\left(t\_0\right)\\ \frac{e^{t\_0}}{\left(t\_1 \cdot t\_1\right) \cdot s} \end{array} \]
(FPCore (x s)
  :precision binary32
  (let* ((t_0 (/ (- (fabs x)) s)) (t_1 (- -2.0 (expm1 t_0))))
  (/ (exp t_0) (* (* t_1 t_1) s))))
float code(float x, float s) {
	float t_0 = -fabsf(x) / s;
	float t_1 = -2.0f - expm1f(t_0);
	return expf(t_0) / ((t_1 * t_1) * s);
}
function code(x, s)
	t_0 = Float32(Float32(-abs(x)) / s)
	t_1 = Float32(Float32(-2.0) - expm1(t_0))
	return Float32(exp(t_0) / Float32(Float32(t_1 * t_1) * s))
end
\begin{array}{l}
t_0 := \frac{-\left|x\right|}{s}\\
t_1 := -2 - \mathsf{expm1}\left(t\_0\right)\\
\frac{e^{t\_0}}{\left(t\_1 \cdot t\_1\right) \cdot s}
\end{array}
Derivation
  1. Initial program 99.5%

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

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

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

Alternative 4: 98.6% accurate, 1.2× speedup?

\[\begin{array}{l} t_0 := \mathsf{expm1}\left(\frac{-\left|x\right|}{s}\right)\\ t_1 := t\_0 - -2\\ \frac{t\_0 - -1}{\left(t\_1 \cdot s\right) \cdot t\_1} \end{array} \]
(FPCore (x s)
  :precision binary32
  (let* ((t_0 (expm1 (/ (- (fabs x)) s))) (t_1 (- t_0 -2.0)))
  (/ (- t_0 -1.0) (* (* t_1 s) t_1))))
float code(float x, float s) {
	float t_0 = expm1f((-fabsf(x) / s));
	float t_1 = t_0 - -2.0f;
	return (t_0 - -1.0f) / ((t_1 * s) * t_1);
}
function code(x, s)
	t_0 = expm1(Float32(Float32(-abs(x)) / s))
	t_1 = Float32(t_0 - Float32(-2.0))
	return Float32(Float32(t_0 - Float32(-1.0)) / Float32(Float32(t_1 * s) * t_1))
end
\begin{array}{l}
t_0 := \mathsf{expm1}\left(\frac{-\left|x\right|}{s}\right)\\
t_1 := t\_0 - -2\\
\frac{t\_0 - -1}{\left(t\_1 \cdot s\right) \cdot t\_1}
\end{array}
Derivation
  1. Initial program 99.5%

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

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

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

    \[\leadsto \frac{3 - \left(3 - \left(1 - \left(-\mathsf{expm1}\left(\frac{-\left|x\right|}{s}\right)\right)\right)\right)}{\left(s \cdot \left(1 + \left(3 - \left(3 - \left(1 - \left(-\mathsf{expm1}\left(\frac{-\left|x\right|}{s}\right)\right)\right)\right)\right)\right)\right) \cdot \left(1 + \color{blue}{\left(3 - \left(3 - \left(1 - \left(-\mathsf{expm1}\left(\frac{-\left|x\right|}{s}\right)\right)\right)\right)\right)}\right)} \]
  5. Applied rewrites98.6%

    \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(\frac{-\left|x\right|}{s}\right) - -1}{\left(\left(\mathsf{expm1}\left(\frac{-\left|x\right|}{s}\right) - -2\right) \cdot s\right) \cdot \left(\mathsf{expm1}\left(\frac{-\left|x\right|}{s}\right) - -2\right)}} \]
  6. Add Preprocessing

Alternative 5: 96.5% accurate, 1.5× speedup?

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

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

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

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

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

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

    Alternative 6: 95.1% accurate, 2.7× speedup?

    \[\frac{e^{\frac{-\left|x\right|}{s}}}{4 \cdot s} \]
    (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);
    }
    
    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
    
    \frac{e^{\frac{-\left|x\right|}{s}}}{4 \cdot s}
    
    Derivation
    1. Initial program 99.5%

      \[\frac{e^{\frac{-\left|x\right|}{s}}}{\left(s \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)\right) \cdot \left(1 + e^{\frac{-\left|x\right|}{s}}\right)} \]
    2. 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-*.f3295.1%

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

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

    Alternative 7: 26.7% accurate, 5.1× speedup?

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\left(2 \cdot s\right) \cdot \left(1 + \color{blue}{1}\right)} \]
      3. Step-by-step derivation
        1. Applied rewrites26.7%

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

            \[\leadsto \frac{1}{\color{blue}{\left(2 \cdot s\right) \cdot \left(1 + 1\right)}} \]
          2. *-commutativeN/A

            \[\leadsto \frac{1}{\color{blue}{\left(1 + 1\right) \cdot \left(2 \cdot s\right)}} \]
          3. lower-*.f3226.7%

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

            \[\leadsto \frac{1}{\color{blue}{\left(1 + 1\right)} \cdot \left(2 \cdot s\right)} \]
          5. +-commutativeN/A

            \[\leadsto \frac{1}{\color{blue}{\left(1 + 1\right)} \cdot \left(2 \cdot s\right)} \]
          6. add-flipN/A

            \[\leadsto \frac{1}{\color{blue}{\left(1 - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(2 \cdot s\right)} \]
          7. metadata-evalN/A

            \[\leadsto \frac{1}{\left(1 - \color{blue}{-1}\right) \cdot \left(2 \cdot s\right)} \]
          8. lower--.f3226.7%

            \[\leadsto \frac{1}{\color{blue}{\left(1 - -1\right)} \cdot \left(2 \cdot s\right)} \]
          9. lift-*.f32N/A

            \[\leadsto \frac{1}{\left(1 - -1\right) \cdot \left(2 \cdot \color{blue}{s}\right)} \]
          10. count-2-revN/A

            \[\leadsto \frac{1}{\left(1 - -1\right) \cdot \left(s + \color{blue}{s}\right)} \]
          11. lower-+.f3226.7%

            \[\leadsto \frac{1}{\left(1 - -1\right) \cdot \left(s + \color{blue}{s}\right)} \]
        3. Applied rewrites26.7%

          \[\leadsto \frac{1}{\color{blue}{\left(1 - -1\right) \cdot \left(s + s\right)}} \]
        4. Add Preprocessing

        Reproduce

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