Logistic distribution

Percentage Accurate: 99.6% → 99.6%
Time: 4.5s
Alternatives: 18
Speedup: 1.4×

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
  :pre (and (<= 0.0 s) (<= s 1.0651631))
  (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 18 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?

\[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
  :pre (and (<= 0.0 s) (<= s 1.0651631))
  (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.4× speedup?

\[0 \leq s \land s \leq 1.0651631\]
\[\frac{1}{\left(1 + e^{\frac{-\left|x\right|}{s}}\right) \cdot \mathsf{fma}\left(e^{\frac{\left|x\right|}{s}}, s, s\right)} \]
(FPCore (x s)
  :precision binary32
  :pre (and (<= 0.0 s) (<= s 1.0651631))
  (/
 1.0
 (* (+ 1.0 (exp (/ (- (fabs x)) s))) (fma (exp (/ (fabs x) s)) s s))))
float code(float x, float s) {
	return 1.0f / ((1.0f + expf((-fabsf(x) / s))) * fmaf(expf((fabsf(x) / s)), s, s));
}
function code(x, s)
	return Float32(Float32(1.0) / Float32(Float32(Float32(1.0) + exp(Float32(Float32(-abs(x)) / s))) * fma(exp(Float32(abs(x) / s)), s, s)))
end
\frac{1}{\left(1 + e^{\frac{-\left|x\right|}{s}}\right) \cdot \mathsf{fma}\left(e^{\frac{\left|x\right|}{s}}, s, s\right)}
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. Applied rewrites99.6%

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

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

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

      Alternative 2: 96.0% accurate, 1.8× speedup?

      \[0 \leq s \land s \leq 1.0651631\]
      \[\begin{array}{l} t_0 := \frac{\left|x\right|}{s}\\ \frac{-1}{\left(\left(t\_0 - 2\right) \cdot s\right) \cdot \left(e^{t\_0} - -1\right)} \end{array} \]
      (FPCore (x s)
        :precision binary32
        :pre (and (<= 0.0 s) (<= s 1.0651631))
        (let* ((t_0 (/ (fabs x) s)))
        (/ -1.0 (* (* (- t_0 2.0) s) (- (exp t_0) -1.0)))))
      float code(float x, float s) {
      	float t_0 = fabsf(x) / s;
      	return -1.0f / (((t_0 - 2.0f) * s) * (expf(t_0) - -1.0f));
      }
      
      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 = (-1.0e0) / (((t_0 - 2.0e0) * s) * (exp(t_0) - (-1.0e0)))
      end function
      
      function code(x, s)
      	t_0 = Float32(abs(x) / s)
      	return Float32(Float32(-1.0) / Float32(Float32(Float32(t_0 - Float32(2.0)) * s) * Float32(exp(t_0) - Float32(-1.0))))
      end
      
      function tmp = code(x, s)
      	t_0 = abs(x) / s;
      	tmp = single(-1.0) / (((t_0 - single(2.0)) * s) * (exp(t_0) - single(-1.0)));
      end
      
      \begin{array}{l}
      t_0 := \frac{\left|x\right|}{s}\\
      \frac{-1}{\left(\left(t\_0 - 2\right) \cdot s\right) \cdot \left(e^{t\_0} - -1\right)}
      \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. Applied rewrites99.6%

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

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

          \[\leadsto \frac{-1}{\left(\left(\frac{\left|x\right|}{s} - 2\right) \cdot s\right) \cdot \left(e^{\frac{\left|x\right|}{s}} - -1\right)} \]
        4. Step-by-step derivation
          1. Applied rewrites96.0%

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

          Alternative 3: 95.7% accurate, 1.9× speedup?

          \[0 \leq s \land s \leq 1.0651631\]
          \[\frac{e^{\frac{-\left|x\right|}{s}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
          (FPCore (x s)
            :precision binary32
            :pre (and (<= 0.0 s) (<= s 1.0651631))
            (/ (exp (/ (- (fabs x)) s)) (* s (+ 4.0 (* -4.0 (/ (fabs x) s))))))
          float code(float x, float s) {
          	return expf((-fabsf(x) / s)) / (s * (4.0f + (-4.0f * (fabsf(x) / 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)) / (s * (4.0e0 + ((-4.0e0) * (abs(x) / s))))
          end function
          
          function code(x, s)
          	return Float32(exp(Float32(Float32(-abs(x)) / s)) / Float32(s * Float32(Float32(4.0) + Float32(Float32(-4.0) * Float32(abs(x) / s)))))
          end
          
          function tmp = code(x, s)
          	tmp = exp((-abs(x) / s)) / (s * (single(4.0) + (single(-4.0) * (abs(x) / s))));
          end
          
          \frac{e^{\frac{-\left|x\right|}{s}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)}
          
          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}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
          3. Step-by-step derivation
            1. Applied rewrites95.7%

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

            Alternative 4: 95.6% accurate, 2.2× speedup?

            \[0 \leq s \land s \leq 1.0651631\]
            \[\frac{e^{\frac{-\left|x\right|}{s}}}{\mathsf{fma}\left(-4, \left|x\right|, 4 \cdot s\right)} \]
            (FPCore (x s)
              :precision binary32
              :pre (and (<= 0.0 s) (<= s 1.0651631))
              (/ (exp (/ (- (fabs x)) s)) (fma -4.0 (fabs x) (* 4.0 s))))
            float code(float x, float s) {
            	return expf((-fabsf(x) / s)) / fmaf(-4.0f, fabsf(x), (4.0f * s));
            }
            
            function code(x, s)
            	return Float32(exp(Float32(Float32(-abs(x)) / s)) / fma(Float32(-4.0), abs(x), Float32(Float32(4.0) * s)))
            end
            
            \frac{e^{\frac{-\left|x\right|}{s}}}{\mathsf{fma}\left(-4, \left|x\right|, 4 \cdot s\right)}
            
            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}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
            3. Step-by-step derivation
              1. Applied rewrites95.7%

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

                \[\leadsto \frac{e^{\frac{-\left|x\right|}{s}}}{-4 \cdot \left|x\right| + 4 \cdot s} \]
              3. Step-by-step derivation
                1. Applied rewrites95.6%

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

                Alternative 5: 95.1% accurate, 2.3× speedup?

                \[0 \leq s \land s \leq 1.0651631\]
                \[\frac{1}{2 \cdot \mathsf{fma}\left(e^{\frac{\left|x\right|}{s}}, s, s\right)} \]
                (FPCore (x s)
                  :precision binary32
                  :pre (and (<= 0.0 s) (<= s 1.0651631))
                  (/ 1.0 (* 2.0 (fma (exp (/ (fabs x) s)) s s))))
                float code(float x, float s) {
                	return 1.0f / (2.0f * fmaf(expf((fabsf(x) / s)), s, s));
                }
                
                function code(x, s)
                	return Float32(Float32(1.0) / Float32(Float32(2.0) * fma(exp(Float32(abs(x) / s)), s, s)))
                end
                
                \frac{1}{2 \cdot \mathsf{fma}\left(e^{\frac{\left|x\right|}{s}}, s, s\right)}
                
                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. Applied rewrites99.6%

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

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

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

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

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

                      Alternative 6: 94.7% accurate, 2.7× speedup?

                      \[0 \leq s \land s \leq 1.0651631\]
                      \[\frac{\frac{0.25}{s}}{e^{\frac{\left|x\right|}{s}}} \]
                      (FPCore (x s)
                        :precision binary32
                        :pre (and (<= 0.0 s) (<= s 1.0651631))
                        (/ (/ 0.25 s) (exp (/ (fabs x) s))))
                      float code(float x, float s) {
                      	return (0.25f / s) / expf((fabsf(x) / s));
                      }
                      
                      real(4) function code(x, s)
                      use fmin_fmax_functions
                          real(4), intent (in) :: x
                          real(4), intent (in) :: s
                          code = (0.25e0 / s) / exp((abs(x) / s))
                      end function
                      
                      function code(x, s)
                      	return Float32(Float32(Float32(0.25) / s) / exp(Float32(abs(x) / s)))
                      end
                      
                      function tmp = code(x, s)
                      	tmp = (single(0.25) / s) / exp((abs(x) / s));
                      end
                      
                      \frac{\frac{0.25}{s}}{e^{\frac{\left|x\right|}{s}}}
                      
                      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. Applied rewrites99.3%

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

                          \[\leadsto \frac{\frac{\frac{1}{4}}{s}}{e^{\frac{\left|x\right|}{s}}} \]
                        3. Step-by-step derivation
                          1. Applied rewrites94.6%

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

                          Alternative 7: 94.6% accurate, 2.8× speedup?

                          \[0 \leq s \land s \leq 1.0651631\]
                          \[\frac{0.25}{e^{\frac{\left|x\right|}{s}} \cdot s} \]
                          (FPCore (x s)
                            :precision binary32
                            :pre (and (<= 0.0 s) (<= s 1.0651631))
                            (/ 0.25 (* (exp (/ (fabs x) s)) s)))
                          float code(float x, float s) {
                          	return 0.25f / (expf((fabsf(x) / s)) * s);
                          }
                          
                          real(4) function code(x, s)
                          use fmin_fmax_functions
                              real(4), intent (in) :: x
                              real(4), intent (in) :: s
                              code = 0.25e0 / (exp((abs(x) / s)) * s)
                          end function
                          
                          function code(x, s)
                          	return Float32(Float32(0.25) / Float32(exp(Float32(abs(x) / s)) * s))
                          end
                          
                          function tmp = code(x, s)
                          	tmp = single(0.25) / (exp((abs(x) / s)) * s);
                          end
                          
                          \frac{0.25}{e^{\frac{\left|x\right|}{s}} \cdot s}
                          
                          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. Applied rewrites99.3%

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

                              \[\leadsto \frac{\frac{\frac{1}{4}}{s}}{e^{\frac{\left|x\right|}{s}}} \]
                            3. Step-by-step derivation
                              1. Applied rewrites94.6%

                                \[\leadsto \frac{\frac{0.25}{s}}{e^{\frac{\left|x\right|}{s}}} \]
                              2. Step-by-step derivation
                                1. Applied rewrites94.7%

                                  \[\leadsto \frac{0.25}{e^{\frac{\left|x\right|}{s}} \cdot s} \]
                                2. Add Preprocessing

                                Alternative 8: 57.0% accurate, 3.0× speedup?

                                \[0 \leq s \land s \leq 1.0651631\]
                                \[\frac{1}{s \cdot \left(4 + -4 \cdot \frac{\sqrt{x \cdot x}}{s}\right)} \]
                                (FPCore (x s)
                                  :precision binary32
                                  :pre (and (<= 0.0 s) (<= s 1.0651631))
                                  (/ 1.0 (* s (+ 4.0 (* -4.0 (/ (sqrt (* x x)) s))))))
                                float code(float x, float s) {
                                	return 1.0f / (s * (4.0f + (-4.0f * (sqrtf((x * x)) / s))));
                                }
                                
                                real(4) function code(x, s)
                                use fmin_fmax_functions
                                    real(4), intent (in) :: x
                                    real(4), intent (in) :: s
                                    code = 1.0e0 / (s * (4.0e0 + ((-4.0e0) * (sqrt((x * x)) / s))))
                                end function
                                
                                function code(x, s)
                                	return Float32(Float32(1.0) / Float32(s * Float32(Float32(4.0) + Float32(Float32(-4.0) * Float32(sqrt(Float32(x * x)) / s)))))
                                end
                                
                                function tmp = code(x, s)
                                	tmp = single(1.0) / (s * (single(4.0) + (single(-4.0) * (sqrt((x * x)) / s))));
                                end
                                
                                \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\sqrt{x \cdot x}}{s}\right)}
                                
                                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}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                3. Step-by-step derivation
                                  1. Applied rewrites95.7%

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

                                    \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites50.9%

                                      \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                    2. Step-by-step derivation
                                      1. Applied rewrites57.0%

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

                                      Alternative 9: 57.0% accurate, 2.8× speedup?

                                      \[0 \leq s \land s \leq 1.0651631\]
                                      \[\begin{array}{l} \mathbf{if}\;\left|x\right| \leq 7999999874453996000:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\left|x\right|, \frac{-4}{s}, 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(4 \cdot \left(x \cdot x\right)\right) \cdot \frac{1}{\left|x\right|}}\\ \end{array} \]
                                      (FPCore (x s)
                                        :precision binary32
                                        :pre (and (<= 0.0 s) (<= s 1.0651631))
                                        (if (<= (fabs x) 7999999874453996000.0)
                                        (/ 1.0 (* s (fma (fabs x) (/ -4.0 s) 4.0)))
                                        (/ 1.0 (* (* 4.0 (* x x)) (/ 1.0 (fabs x))))))
                                      float code(float x, float s) {
                                      	float tmp;
                                      	if (fabsf(x) <= 7999999874453996000.0f) {
                                      		tmp = 1.0f / (s * fmaf(fabsf(x), (-4.0f / s), 4.0f));
                                      	} else {
                                      		tmp = 1.0f / ((4.0f * (x * x)) * (1.0f / fabsf(x)));
                                      	}
                                      	return tmp;
                                      }
                                      
                                      function code(x, s)
                                      	tmp = Float32(0.0)
                                      	if (abs(x) <= Float32(7999999874453996000.0))
                                      		tmp = Float32(Float32(1.0) / Float32(s * fma(abs(x), Float32(Float32(-4.0) / s), Float32(4.0))));
                                      	else
                                      		tmp = Float32(Float32(1.0) / Float32(Float32(Float32(4.0) * Float32(x * x)) * Float32(Float32(1.0) / abs(x))));
                                      	end
                                      	return tmp
                                      end
                                      
                                      \begin{array}{l}
                                      \mathbf{if}\;\left|x\right| \leq 7999999874453996000:\\
                                      \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\left|x\right|, \frac{-4}{s}, 4\right)}\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\frac{1}{\left(4 \cdot \left(x \cdot x\right)\right) \cdot \frac{1}{\left|x\right|}}\\
                                      
                                      
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 2 regimes
                                      2. if (fabs.f32 x) < 7.99999987e18

                                        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}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites95.7%

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

                                            \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites50.9%

                                              \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                            2. Step-by-step derivation
                                              1. Applied rewrites51.3%

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

                                              if 7.99999987e18 < (fabs.f32 x)

                                              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}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites95.7%

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

                                                  \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites50.9%

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

                                                    \[\leadsto \frac{1}{4 \cdot \left({x}^{2} \cdot \left|\frac{-1}{x}\right|\right)} \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites31.0%

                                                      \[\leadsto \frac{1}{4 \cdot \left({x}^{2} \cdot \left|\frac{-1}{x}\right|\right)} \]
                                                    2. Step-by-step derivation
                                                      1. Applied rewrites31.2%

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

                                                    Alternative 10: 56.6% accurate, 3.0× speedup?

                                                    \[0 \leq s \land s \leq 1.0651631\]
                                                    \[\begin{array}{l} \mathbf{if}\;\left|x\right| \leq 7999999874453996000:\\ \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\left|x\right|, \frac{-4}{s}, 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{4 \cdot \left(x \cdot x\right)}{\left|x\right|}}\\ \end{array} \]
                                                    (FPCore (x s)
                                                      :precision binary32
                                                      :pre (and (<= 0.0 s) (<= s 1.0651631))
                                                      (if (<= (fabs x) 7999999874453996000.0)
                                                      (/ 1.0 (* s (fma (fabs x) (/ -4.0 s) 4.0)))
                                                      (/ 1.0 (/ (* 4.0 (* x x)) (fabs x)))))
                                                    float code(float x, float s) {
                                                    	float tmp;
                                                    	if (fabsf(x) <= 7999999874453996000.0f) {
                                                    		tmp = 1.0f / (s * fmaf(fabsf(x), (-4.0f / s), 4.0f));
                                                    	} else {
                                                    		tmp = 1.0f / ((4.0f * (x * x)) / fabsf(x));
                                                    	}
                                                    	return tmp;
                                                    }
                                                    
                                                    function code(x, s)
                                                    	tmp = Float32(0.0)
                                                    	if (abs(x) <= Float32(7999999874453996000.0))
                                                    		tmp = Float32(Float32(1.0) / Float32(s * fma(abs(x), Float32(Float32(-4.0) / s), Float32(4.0))));
                                                    	else
                                                    		tmp = Float32(Float32(1.0) / Float32(Float32(Float32(4.0) * Float32(x * x)) / abs(x)));
                                                    	end
                                                    	return tmp
                                                    end
                                                    
                                                    \begin{array}{l}
                                                    \mathbf{if}\;\left|x\right| \leq 7999999874453996000:\\
                                                    \;\;\;\;\frac{1}{s \cdot \mathsf{fma}\left(\left|x\right|, \frac{-4}{s}, 4\right)}\\
                                                    
                                                    \mathbf{else}:\\
                                                    \;\;\;\;\frac{1}{\frac{4 \cdot \left(x \cdot x\right)}{\left|x\right|}}\\
                                                    
                                                    
                                                    \end{array}
                                                    
                                                    Derivation
                                                    1. Split input into 2 regimes
                                                    2. if (fabs.f32 x) < 7.99999987e18

                                                      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}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites95.7%

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

                                                          \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites50.9%

                                                            \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                          2. Step-by-step derivation
                                                            1. Applied rewrites51.3%

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

                                                            if 7.99999987e18 < (fabs.f32 x)

                                                            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}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                            3. Step-by-step derivation
                                                              1. Applied rewrites95.7%

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

                                                                \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                              3. Step-by-step derivation
                                                                1. Applied rewrites50.9%

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

                                                                  \[\leadsto \frac{1}{4 \cdot \left({x}^{2} \cdot \left|\frac{-1}{x}\right|\right)} \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites31.0%

                                                                    \[\leadsto \frac{1}{4 \cdot \left({x}^{2} \cdot \left|\frac{-1}{x}\right|\right)} \]
                                                                  2. Step-by-step derivation
                                                                    1. Applied rewrites31.3%

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

                                                                  Alternative 11: 56.6% accurate, 3.3× speedup?

                                                                  \[0 \leq s \land s \leq 1.0651631\]
                                                                  \[\frac{\frac{0.25}{s}}{1 + \frac{\sqrt{x \cdot x}}{s}} \]
                                                                  (FPCore (x s)
                                                                    :precision binary32
                                                                    :pre (and (<= 0.0 s) (<= s 1.0651631))
                                                                    (/ (/ 0.25 s) (+ 1.0 (/ (sqrt (* x x)) s))))
                                                                  float code(float x, float s) {
                                                                  	return (0.25f / s) / (1.0f + (sqrtf((x * x)) / s));
                                                                  }
                                                                  
                                                                  real(4) function code(x, s)
                                                                  use fmin_fmax_functions
                                                                      real(4), intent (in) :: x
                                                                      real(4), intent (in) :: s
                                                                      code = (0.25e0 / s) / (1.0e0 + (sqrt((x * x)) / s))
                                                                  end function
                                                                  
                                                                  function code(x, s)
                                                                  	return Float32(Float32(Float32(0.25) / s) / Float32(Float32(1.0) + Float32(sqrt(Float32(x * x)) / s)))
                                                                  end
                                                                  
                                                                  function tmp = code(x, s)
                                                                  	tmp = (single(0.25) / s) / (single(1.0) + (sqrt((x * x)) / s));
                                                                  end
                                                                  
                                                                  \frac{\frac{0.25}{s}}{1 + \frac{\sqrt{x \cdot x}}{s}}
                                                                  
                                                                  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. Applied rewrites99.3%

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

                                                                      \[\leadsto \frac{\frac{\frac{1}{4}}{s}}{e^{\frac{\left|x\right|}{s}}} \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites94.6%

                                                                        \[\leadsto \frac{\frac{0.25}{s}}{e^{\frac{\left|x\right|}{s}}} \]
                                                                      2. Taylor expanded in s around inf

                                                                        \[\leadsto \frac{\frac{0.25}{s}}{1 + \frac{\left|x\right|}{s}} \]
                                                                      3. Step-by-step derivation
                                                                        1. Applied rewrites50.7%

                                                                          \[\leadsto \frac{\frac{0.25}{s}}{1 + \frac{\left|x\right|}{s}} \]
                                                                        2. Step-by-step derivation
                                                                          1. Applied rewrites57.0%

                                                                            \[\leadsto \frac{\frac{0.25}{s}}{1 + \frac{\sqrt{x \cdot x}}{s}} \]
                                                                          2. Add Preprocessing

                                                                          Alternative 12: 56.5% accurate, 3.2× speedup?

                                                                          \[0 \leq s \land s \leq 1.0651631\]
                                                                          \[\begin{array}{l} \mathbf{if}\;\left|x\right| \leq 9999999980506448000:\\ \;\;\;\;\frac{\frac{0.25}{s}}{1 + \frac{\left|x\right|}{s}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{4 \cdot \left(x \cdot x\right)}{\left|x\right|}}\\ \end{array} \]
                                                                          (FPCore (x s)
                                                                            :precision binary32
                                                                            :pre (and (<= 0.0 s) (<= s 1.0651631))
                                                                            (if (<= (fabs x) 9999999980506448000.0)
                                                                            (/ (/ 0.25 s) (+ 1.0 (/ (fabs x) s)))
                                                                            (/ 1.0 (/ (* 4.0 (* x x)) (fabs x)))))
                                                                          float code(float x, float s) {
                                                                          	float tmp;
                                                                          	if (fabsf(x) <= 9999999980506448000.0f) {
                                                                          		tmp = (0.25f / s) / (1.0f + (fabsf(x) / s));
                                                                          	} else {
                                                                          		tmp = 1.0f / ((4.0f * (x * x)) / fabsf(x));
                                                                          	}
                                                                          	return tmp;
                                                                          }
                                                                          
                                                                          real(4) function code(x, s)
                                                                          use fmin_fmax_functions
                                                                              real(4), intent (in) :: x
                                                                              real(4), intent (in) :: s
                                                                              real(4) :: tmp
                                                                              if (abs(x) <= 9999999980506448000.0e0) then
                                                                                  tmp = (0.25e0 / s) / (1.0e0 + (abs(x) / s))
                                                                              else
                                                                                  tmp = 1.0e0 / ((4.0e0 * (x * x)) / abs(x))
                                                                              end if
                                                                              code = tmp
                                                                          end function
                                                                          
                                                                          function code(x, s)
                                                                          	tmp = Float32(0.0)
                                                                          	if (abs(x) <= Float32(9999999980506448000.0))
                                                                          		tmp = Float32(Float32(Float32(0.25) / s) / Float32(Float32(1.0) + Float32(abs(x) / s)));
                                                                          	else
                                                                          		tmp = Float32(Float32(1.0) / Float32(Float32(Float32(4.0) * Float32(x * x)) / abs(x)));
                                                                          	end
                                                                          	return tmp
                                                                          end
                                                                          
                                                                          function tmp_2 = code(x, s)
                                                                          	tmp = single(0.0);
                                                                          	if (abs(x) <= single(9999999980506448000.0))
                                                                          		tmp = (single(0.25) / s) / (single(1.0) + (abs(x) / s));
                                                                          	else
                                                                          		tmp = single(1.0) / ((single(4.0) * (x * x)) / abs(x));
                                                                          	end
                                                                          	tmp_2 = tmp;
                                                                          end
                                                                          
                                                                          \begin{array}{l}
                                                                          \mathbf{if}\;\left|x\right| \leq 9999999980506448000:\\
                                                                          \;\;\;\;\frac{\frac{0.25}{s}}{1 + \frac{\left|x\right|}{s}}\\
                                                                          
                                                                          \mathbf{else}:\\
                                                                          \;\;\;\;\frac{1}{\frac{4 \cdot \left(x \cdot x\right)}{\left|x\right|}}\\
                                                                          
                                                                          
                                                                          \end{array}
                                                                          
                                                                          Derivation
                                                                          1. Split input into 2 regimes
                                                                          2. if (fabs.f32 x) < 9.99999998e18

                                                                            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. Applied rewrites99.3%

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

                                                                                \[\leadsto \frac{\frac{\frac{1}{4}}{s}}{e^{\frac{\left|x\right|}{s}}} \]
                                                                              3. Step-by-step derivation
                                                                                1. Applied rewrites94.6%

                                                                                  \[\leadsto \frac{\frac{0.25}{s}}{e^{\frac{\left|x\right|}{s}}} \]
                                                                                2. Taylor expanded in s around inf

                                                                                  \[\leadsto \frac{\frac{0.25}{s}}{1 + \frac{\left|x\right|}{s}} \]
                                                                                3. Step-by-step derivation
                                                                                  1. Applied rewrites50.7%

                                                                                    \[\leadsto \frac{\frac{0.25}{s}}{1 + \frac{\left|x\right|}{s}} \]

                                                                                  if 9.99999998e18 < (fabs.f32 x)

                                                                                  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}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                  3. Step-by-step derivation
                                                                                    1. Applied rewrites95.7%

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

                                                                                      \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                    3. Step-by-step derivation
                                                                                      1. Applied rewrites50.9%

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

                                                                                        \[\leadsto \frac{1}{4 \cdot \left({x}^{2} \cdot \left|\frac{-1}{x}\right|\right)} \]
                                                                                      3. Step-by-step derivation
                                                                                        1. Applied rewrites31.0%

                                                                                          \[\leadsto \frac{1}{4 \cdot \left({x}^{2} \cdot \left|\frac{-1}{x}\right|\right)} \]
                                                                                        2. Step-by-step derivation
                                                                                          1. Applied rewrites31.3%

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

                                                                                        Alternative 13: 56.4% accurate, 3.1× speedup?

                                                                                        \[0 \leq s \land s \leq 1.0651631\]
                                                                                        \[\begin{array}{l} \mathbf{if}\;-\left|x\right| \leq -9999999980506448000:\\ \;\;\;\;\frac{1}{\frac{4 \cdot \left(x \cdot x\right)}{\left|x\right|}}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25}{s \cdot \left(\frac{\left|x\right|}{s} - -1\right)}\\ \end{array} \]
                                                                                        (FPCore (x s)
                                                                                          :precision binary32
                                                                                          :pre (and (<= 0.0 s) (<= s 1.0651631))
                                                                                          (if (<= (- (fabs x)) -9999999980506448000.0)
                                                                                          (/ 1.0 (/ (* 4.0 (* x x)) (fabs x)))
                                                                                          (/ 0.25 (* s (- (/ (fabs x) s) -1.0)))))
                                                                                        float code(float x, float s) {
                                                                                        	float tmp;
                                                                                        	if (-fabsf(x) <= -9999999980506448000.0f) {
                                                                                        		tmp = 1.0f / ((4.0f * (x * x)) / fabsf(x));
                                                                                        	} else {
                                                                                        		tmp = 0.25f / (s * ((fabsf(x) / s) - -1.0f));
                                                                                        	}
                                                                                        	return tmp;
                                                                                        }
                                                                                        
                                                                                        real(4) function code(x, s)
                                                                                        use fmin_fmax_functions
                                                                                            real(4), intent (in) :: x
                                                                                            real(4), intent (in) :: s
                                                                                            real(4) :: tmp
                                                                                            if (-abs(x) <= (-9999999980506448000.0e0)) then
                                                                                                tmp = 1.0e0 / ((4.0e0 * (x * x)) / abs(x))
                                                                                            else
                                                                                                tmp = 0.25e0 / (s * ((abs(x) / s) - (-1.0e0)))
                                                                                            end if
                                                                                            code = tmp
                                                                                        end function
                                                                                        
                                                                                        function code(x, s)
                                                                                        	tmp = Float32(0.0)
                                                                                        	if (Float32(-abs(x)) <= Float32(-9999999980506448000.0))
                                                                                        		tmp = Float32(Float32(1.0) / Float32(Float32(Float32(4.0) * Float32(x * x)) / abs(x)));
                                                                                        	else
                                                                                        		tmp = Float32(Float32(0.25) / Float32(s * Float32(Float32(abs(x) / s) - Float32(-1.0))));
                                                                                        	end
                                                                                        	return tmp
                                                                                        end
                                                                                        
                                                                                        function tmp_2 = code(x, s)
                                                                                        	tmp = single(0.0);
                                                                                        	if (-abs(x) <= single(-9999999980506448000.0))
                                                                                        		tmp = single(1.0) / ((single(4.0) * (x * x)) / abs(x));
                                                                                        	else
                                                                                        		tmp = single(0.25) / (s * ((abs(x) / s) - single(-1.0)));
                                                                                        	end
                                                                                        	tmp_2 = tmp;
                                                                                        end
                                                                                        
                                                                                        \begin{array}{l}
                                                                                        \mathbf{if}\;-\left|x\right| \leq -9999999980506448000:\\
                                                                                        \;\;\;\;\frac{1}{\frac{4 \cdot \left(x \cdot x\right)}{\left|x\right|}}\\
                                                                                        
                                                                                        \mathbf{else}:\\
                                                                                        \;\;\;\;\frac{0.25}{s \cdot \left(\frac{\left|x\right|}{s} - -1\right)}\\
                                                                                        
                                                                                        
                                                                                        \end{array}
                                                                                        
                                                                                        Derivation
                                                                                        1. Split input into 2 regimes
                                                                                        2. if (neg.f32 (fabs.f32 x)) < -9.99999998e18

                                                                                          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}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                          3. Step-by-step derivation
                                                                                            1. Applied rewrites95.7%

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

                                                                                              \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                            3. Step-by-step derivation
                                                                                              1. Applied rewrites50.9%

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

                                                                                                \[\leadsto \frac{1}{4 \cdot \left({x}^{2} \cdot \left|\frac{-1}{x}\right|\right)} \]
                                                                                              3. Step-by-step derivation
                                                                                                1. Applied rewrites31.0%

                                                                                                  \[\leadsto \frac{1}{4 \cdot \left({x}^{2} \cdot \left|\frac{-1}{x}\right|\right)} \]
                                                                                                2. Step-by-step derivation
                                                                                                  1. Applied rewrites31.3%

                                                                                                    \[\leadsto \frac{1}{\frac{4 \cdot \left(x \cdot x\right)}{\left|x\right|}} \]

                                                                                                  if -9.99999998e18 < (neg.f32 (fabs.f32 x))

                                                                                                  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. Applied rewrites99.3%

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

                                                                                                      \[\leadsto \frac{\frac{\frac{1}{4}}{s}}{e^{\frac{\left|x\right|}{s}}} \]
                                                                                                    3. Step-by-step derivation
                                                                                                      1. Applied rewrites94.6%

                                                                                                        \[\leadsto \frac{\frac{0.25}{s}}{e^{\frac{\left|x\right|}{s}}} \]
                                                                                                      2. Taylor expanded in s around inf

                                                                                                        \[\leadsto \frac{\frac{0.25}{s}}{1 + \frac{\left|x\right|}{s}} \]
                                                                                                      3. Step-by-step derivation
                                                                                                        1. Applied rewrites50.7%

                                                                                                          \[\leadsto \frac{\frac{0.25}{s}}{1 + \frac{\left|x\right|}{s}} \]
                                                                                                        2. Step-by-step derivation
                                                                                                          1. Applied rewrites50.8%

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

                                                                                                        Alternative 14: 55.8% accurate, 3.2× speedup?

                                                                                                        \[0 \leq s \land s \leq 1.0651631\]
                                                                                                        \[\begin{array}{l} \mathbf{if}\;-\left|x\right| \leq -2.0000000400817547 \cdot 10^{+20}:\\ \;\;\;\;\frac{1}{-4 \cdot \sqrt{x \cdot x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25}{s \cdot \left(\frac{\left|x\right|}{s} - -1\right)}\\ \end{array} \]
                                                                                                        (FPCore (x s)
                                                                                                          :precision binary32
                                                                                                          :pre (and (<= 0.0 s) (<= s 1.0651631))
                                                                                                          (if (<= (- (fabs x)) -2.0000000400817547e+20)
                                                                                                          (/ 1.0 (* -4.0 (sqrt (* x x))))
                                                                                                          (/ 0.25 (* s (- (/ (fabs x) s) -1.0)))))
                                                                                                        float code(float x, float s) {
                                                                                                        	float tmp;
                                                                                                        	if (-fabsf(x) <= -2.0000000400817547e+20f) {
                                                                                                        		tmp = 1.0f / (-4.0f * sqrtf((x * x)));
                                                                                                        	} else {
                                                                                                        		tmp = 0.25f / (s * ((fabsf(x) / s) - -1.0f));
                                                                                                        	}
                                                                                                        	return tmp;
                                                                                                        }
                                                                                                        
                                                                                                        real(4) function code(x, s)
                                                                                                        use fmin_fmax_functions
                                                                                                            real(4), intent (in) :: x
                                                                                                            real(4), intent (in) :: s
                                                                                                            real(4) :: tmp
                                                                                                            if (-abs(x) <= (-2.0000000400817547e+20)) then
                                                                                                                tmp = 1.0e0 / ((-4.0e0) * sqrt((x * x)))
                                                                                                            else
                                                                                                                tmp = 0.25e0 / (s * ((abs(x) / s) - (-1.0e0)))
                                                                                                            end if
                                                                                                            code = tmp
                                                                                                        end function
                                                                                                        
                                                                                                        function code(x, s)
                                                                                                        	tmp = Float32(0.0)
                                                                                                        	if (Float32(-abs(x)) <= Float32(-2.0000000400817547e+20))
                                                                                                        		tmp = Float32(Float32(1.0) / Float32(Float32(-4.0) * sqrt(Float32(x * x))));
                                                                                                        	else
                                                                                                        		tmp = Float32(Float32(0.25) / Float32(s * Float32(Float32(abs(x) / s) - Float32(-1.0))));
                                                                                                        	end
                                                                                                        	return tmp
                                                                                                        end
                                                                                                        
                                                                                                        function tmp_2 = code(x, s)
                                                                                                        	tmp = single(0.0);
                                                                                                        	if (-abs(x) <= single(-2.0000000400817547e+20))
                                                                                                        		tmp = single(1.0) / (single(-4.0) * sqrt((x * x)));
                                                                                                        	else
                                                                                                        		tmp = single(0.25) / (s * ((abs(x) / s) - single(-1.0)));
                                                                                                        	end
                                                                                                        	tmp_2 = tmp;
                                                                                                        end
                                                                                                        
                                                                                                        \begin{array}{l}
                                                                                                        \mathbf{if}\;-\left|x\right| \leq -2.0000000400817547 \cdot 10^{+20}:\\
                                                                                                        \;\;\;\;\frac{1}{-4 \cdot \sqrt{x \cdot x}}\\
                                                                                                        
                                                                                                        \mathbf{else}:\\
                                                                                                        \;\;\;\;\frac{0.25}{s \cdot \left(\frac{\left|x\right|}{s} - -1\right)}\\
                                                                                                        
                                                                                                        
                                                                                                        \end{array}
                                                                                                        
                                                                                                        Derivation
                                                                                                        1. Split input into 2 regimes
                                                                                                        2. if (neg.f32 (fabs.f32 x)) < -2.00000004e20

                                                                                                          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}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                                          3. Step-by-step derivation
                                                                                                            1. Applied rewrites95.7%

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

                                                                                                              \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                                            3. Step-by-step derivation
                                                                                                              1. Applied rewrites50.9%

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

                                                                                                                \[\leadsto \frac{1}{-4 \cdot \left|x\right|} \]
                                                                                                              3. Step-by-step derivation
                                                                                                                1. Applied rewrites7.7%

                                                                                                                  \[\leadsto \frac{1}{-4 \cdot \left|x\right|} \]
                                                                                                                2. Step-by-step derivation
                                                                                                                  1. Applied rewrites28.0%

                                                                                                                    \[\leadsto \frac{1}{-4 \cdot \sqrt{x \cdot x}} \]

                                                                                                                  if -2.00000004e20 < (neg.f32 (fabs.f32 x))

                                                                                                                  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. Applied rewrites99.3%

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

                                                                                                                      \[\leadsto \frac{\frac{\frac{1}{4}}{s}}{e^{\frac{\left|x\right|}{s}}} \]
                                                                                                                    3. Step-by-step derivation
                                                                                                                      1. Applied rewrites94.6%

                                                                                                                        \[\leadsto \frac{\frac{0.25}{s}}{e^{\frac{\left|x\right|}{s}}} \]
                                                                                                                      2. Taylor expanded in s around inf

                                                                                                                        \[\leadsto \frac{\frac{0.25}{s}}{1 + \frac{\left|x\right|}{s}} \]
                                                                                                                      3. Step-by-step derivation
                                                                                                                        1. Applied rewrites50.7%

                                                                                                                          \[\leadsto \frac{\frac{0.25}{s}}{1 + \frac{\left|x\right|}{s}} \]
                                                                                                                        2. Step-by-step derivation
                                                                                                                          1. Applied rewrites50.8%

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

                                                                                                                        Alternative 15: 52.4% accurate, 0.8× speedup?

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

                                                                                                                          1. Initial program 99.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}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                                                          3. Step-by-step derivation
                                                                                                                            1. Applied rewrites95.7%

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

                                                                                                                              \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                                                            3. Step-by-step derivation
                                                                                                                              1. Applied rewrites50.9%

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

                                                                                                                                \[\leadsto \frac{1}{-4 \cdot \left|x\right|} \]
                                                                                                                              3. Step-by-step derivation
                                                                                                                                1. Applied rewrites7.7%

                                                                                                                                  \[\leadsto \frac{1}{-4 \cdot \left|x\right|} \]
                                                                                                                                2. Step-by-step derivation
                                                                                                                                  1. Applied rewrites28.0%

                                                                                                                                    \[\leadsto \frac{1}{-4 \cdot \sqrt{x \cdot x}} \]

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

                                                                                                                                  1. Initial program 99.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{\frac{1}{4}}{s} \]
                                                                                                                                  3. Step-by-step derivation
                                                                                                                                    1. Applied rewrites27.9%

                                                                                                                                      \[\leadsto \frac{0.25}{s} \]
                                                                                                                                  4. Recombined 2 regimes into one program.
                                                                                                                                  5. Add Preprocessing

                                                                                                                                  Alternative 16: 32.0% accurate, 0.8× speedup?

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

                                                                                                                                    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}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                                                                    3. Step-by-step derivation
                                                                                                                                      1. Applied rewrites95.7%

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

                                                                                                                                        \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                                                                      3. Step-by-step derivation
                                                                                                                                        1. Applied rewrites50.9%

                                                                                                                                          \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                                                                        2. Step-by-step derivation
                                                                                                                                          1. Applied rewrites57.0%

                                                                                                                                            \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\sqrt{x \cdot x}}{s}\right)} \]
                                                                                                                                          2. Taylor expanded in x around -inf

                                                                                                                                            \[\leadsto \frac{1}{4 \cdot x} \]
                                                                                                                                          3. Step-by-step derivation
                                                                                                                                            1. Applied rewrites9.3%

                                                                                                                                              \[\leadsto \frac{1}{4 \cdot x} \]

                                                                                                                                            if 2.00000003e-16 < (/.f32 (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)) (*.f32 (*.f32 s (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (fabs.f32 x)) s)))))

                                                                                                                                            1. Initial program 99.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{\frac{1}{4}}{s} \]
                                                                                                                                            3. Step-by-step derivation
                                                                                                                                              1. Applied rewrites27.9%

                                                                                                                                                \[\leadsto \frac{0.25}{s} \]
                                                                                                                                            4. Recombined 2 regimes into one program.
                                                                                                                                            5. Add Preprocessing

                                                                                                                                            Alternative 17: 32.0% accurate, 0.9× speedup?

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

                                                                                                                                              1. Initial program 99.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}}}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                                                                              3. Step-by-step derivation
                                                                                                                                                1. Applied rewrites95.7%

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

                                                                                                                                                  \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                                                                                3. Step-by-step derivation
                                                                                                                                                  1. Applied rewrites50.9%

                                                                                                                                                    \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\left|x\right|}{s}\right)} \]
                                                                                                                                                  2. Step-by-step derivation
                                                                                                                                                    1. Applied rewrites57.0%

                                                                                                                                                      \[\leadsto \frac{1}{s \cdot \left(4 + -4 \cdot \frac{\sqrt{x \cdot x}}{s}\right)} \]
                                                                                                                                                    2. Taylor expanded in x around inf

                                                                                                                                                      \[\leadsto \frac{1}{-4 \cdot x} \]
                                                                                                                                                    3. Step-by-step derivation
                                                                                                                                                      1. Applied rewrites9.5%

                                                                                                                                                        \[\leadsto \frac{1}{-4 \cdot x} \]

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

                                                                                                                                                      1. Initial program 99.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{\frac{1}{4}}{s} \]
                                                                                                                                                      3. Step-by-step derivation
                                                                                                                                                        1. Applied rewrites27.9%

                                                                                                                                                          \[\leadsto \frac{0.25}{s} \]
                                                                                                                                                      4. Recombined 2 regimes into one program.
                                                                                                                                                      5. Add Preprocessing

                                                                                                                                                      Alternative 18: 27.9% accurate, 13.8× speedup?

                                                                                                                                                      \[0 \leq s \land s \leq 1.0651631\]
                                                                                                                                                      \[\frac{0.25}{s} \]
                                                                                                                                                      (FPCore (x s)
                                                                                                                                                        :precision binary32
                                                                                                                                                        :pre (and (<= 0.0 s) (<= s 1.0651631))
                                                                                                                                                        (/ 0.25 s))
                                                                                                                                                      float code(float x, float s) {
                                                                                                                                                      	return 0.25f / s;
                                                                                                                                                      }
                                                                                                                                                      
                                                                                                                                                      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
                                                                                                                                                      
                                                                                                                                                      \frac{0.25}{s}
                                                                                                                                                      
                                                                                                                                                      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{\frac{1}{4}}{s} \]
                                                                                                                                                      3. Step-by-step derivation
                                                                                                                                                        1. Applied rewrites27.9%

                                                                                                                                                          \[\leadsto \frac{0.25}{s} \]
                                                                                                                                                        2. Add Preprocessing

                                                                                                                                                        Reproduce

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