Sample trimmed logistic on [-pi, pi]

Percentage Accurate: 98.9% → 98.9%
Time: 14.6s
Alternatives: 11
Speedup: 1.0×

Specification

?
\[\left(2.328306437 \cdot 10^{-10} \leq u \land u \leq 1\right) \land \left(0 \leq s \land s \leq 1.0651631\right)\]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\ \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - t\_0\right) + t\_0} - 1\right) \end{array} \end{array} \]
(FPCore (u s)
 :precision binary32
 (let* ((t_0 (/ 1.0 (+ 1.0 (exp (/ (PI) s))))))
   (*
    (- s)
    (log
     (-
      (/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s)))) t_0)) t_0))
      1.0)))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\
\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - t\_0\right) + t\_0} - 1\right)
\end{array}
\end{array}

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 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: 98.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\ \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - t\_0\right) + t\_0} - 1\right) \end{array} \end{array} \]
(FPCore (u s)
 :precision binary32
 (let* ((t_0 (/ 1.0 (+ 1.0 (exp (/ (PI) s))))))
   (*
    (- s)
    (log
     (-
      (/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s)))) t_0)) t_0))
      1.0)))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\
\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - t\_0\right) + t\_0} - 1\right)
\end{array}
\end{array}

Alternative 1: 98.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\\ \left(-s\right) \cdot \log \left(\frac{1}{\mathsf{fma}\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - t\_0, u, t\_0\right)} - 1\right) \end{array} \end{array} \]
(FPCore (u s)
 :precision binary32
 (let* ((t_0 (/ 1.0 (+ (exp (/ (PI) s)) 1.0))))
   (*
    (- s)
    (log
     (-
      (/ 1.0 (fma (- (/ 1.0 (+ (exp (/ (- (PI)) s)) 1.0)) t_0) u t_0))
      1.0)))))
\begin{array}{l}

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

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - 1\right) \]
  2. Add Preprocessing
  3. Taylor expanded in u around 0

    \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{u \cdot \left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
  4. Step-by-step derivation
    1. *-commutativeN/A

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

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\mathsf{fma}\left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}, u, \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}} - 1\right) \]
  5. Applied rewrites98.9%

    \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\mathsf{fma}\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}, u, \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\right)}} - 1\right) \]
  6. Add Preprocessing

Alternative 2: 97.1% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{PI}\left(\right)}{s}\\ \left(-s\right) \cdot \log \left(\frac{1}{\mathsf{fma}\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{\left(1 + \mathsf{fma}\left(0.5, \frac{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)}{s \cdot s}, t\_0\right)\right) + 1}, u, \frac{1}{e^{t\_0} + 1}\right)} - 1\right) \end{array} \end{array} \]
(FPCore (u s)
 :precision binary32
 (let* ((t_0 (/ (PI) s)))
   (*
    (- s)
    (log
     (-
      (/
       1.0
       (fma
        (-
         (/ 1.0 (+ (exp (/ (- (PI)) s)) 1.0))
         (/ 1.0 (+ (+ 1.0 (fma 0.5 (/ (* (PI) (PI)) (* s s)) t_0)) 1.0)))
        u
        (/ 1.0 (+ (exp t_0) 1.0))))
      1.0)))))
\begin{array}{l}

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

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - 1\right) \]
  2. Add Preprocessing
  3. Taylor expanded in u around 0

    \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{u \cdot \left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
  4. Step-by-step derivation
    1. *-commutativeN/A

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

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\mathsf{fma}\left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}, u, \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}} - 1\right) \]
  5. Applied rewrites98.9%

    \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\mathsf{fma}\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}, u, \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\right)}} - 1\right) \]
  6. Taylor expanded in s around inf

    \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\mathsf{fma}\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{\left(1 + \left(\frac{1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{{s}^{2}} + \frac{\mathsf{PI}\left(\right)}{s}\right)\right) + 1}, u, \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\right)} - 1\right) \]
  7. Step-by-step derivation
    1. Applied rewrites97.6%

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

    Alternative 3: 97.5% accurate, 1.3× speedup?

    \[\begin{array}{l} \\ \left(-s\right) \cdot \log \left(\frac{1}{\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\right) \cdot u} - 1\right) \end{array} \]
    (FPCore (u s)
     :precision binary32
     (*
      (- s)
      (log
       (-
        (/
         1.0
         (*
          (- (/ 1.0 (+ (exp (/ (- (PI)) s)) 1.0)) (/ 1.0 (+ (exp (/ (PI) s)) 1.0)))
          u))
        1.0))))
    \begin{array}{l}
    
    \\
    \left(-s\right) \cdot \log \left(\frac{1}{\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\right) \cdot u} - 1\right)
    \end{array}
    
    Derivation
    1. Initial program 98.9%

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

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{u \cdot \left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}} - 1\right) \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) \cdot u}} - 1\right) \]
      2. lower-*.f32N/A

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) \cdot u}} - 1\right) \]
    5. Applied rewrites97.5%

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\right) \cdot u}} - 1\right) \]
    6. Add Preprocessing

    Alternative 4: 96.4% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := -\mathsf{PI}\left(\right)\\ \left(-s\right) \cdot \log \left(\frac{1}{\left(\frac{1}{e^{\frac{t\_0}{s}} + 1} - \frac{1}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)}{s}, -0.5, t\_0\right)}{s}, -1, 1\right) + 1}\right) \cdot u} - 1\right) \end{array} \end{array} \]
    (FPCore (u s)
     :precision binary32
     (let* ((t_0 (- (PI))))
       (*
        (- s)
        (log
         (-
          (/
           1.0
           (*
            (-
             (/ 1.0 (+ (exp (/ t_0 s)) 1.0))
             (/
              1.0
              (+ (fma (/ (fma (/ (* (PI) (PI)) s) -0.5 t_0) s) -1.0 1.0) 1.0)))
            u))
          1.0)))))
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := -\mathsf{PI}\left(\right)\\
    \left(-s\right) \cdot \log \left(\frac{1}{\left(\frac{1}{e^{\frac{t\_0}{s}} + 1} - \frac{1}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)}{s}, -0.5, t\_0\right)}{s}, -1, 1\right) + 1}\right) \cdot u} - 1\right)
    \end{array}
    \end{array}
    
    Derivation
    1. Initial program 98.9%

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

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{u \cdot \left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}} - 1\right) \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) \cdot u}} - 1\right) \]
      2. lower-*.f32N/A

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) \cdot u}} - 1\right) \]
    5. Applied rewrites97.5%

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\right) \cdot u}} - 1\right) \]
    6. Taylor expanded in s around -inf

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{\left(1 + -1 \cdot \frac{-1 \cdot \mathsf{PI}\left(\right) + \frac{-1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{s}}{s}\right) + 1}\right) \cdot u} - 1\right) \]
    7. Step-by-step derivation
      1. Applied rewrites96.6%

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

      Alternative 5: 94.1% accurate, 1.8× speedup?

      \[\begin{array}{l} \\ \left(-s\right) \cdot \log \left(\frac{1}{\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{\left(\frac{\mathsf{PI}\left(\right)}{s} + 1\right) + 1}\right) \cdot u} - 1\right) \end{array} \]
      (FPCore (u s)
       :precision binary32
       (*
        (- s)
        (log
         (-
          (/
           1.0
           (*
            (-
             (/ 1.0 (+ (exp (/ (- (PI)) s)) 1.0))
             (/ 1.0 (+ (+ (/ (PI) s) 1.0) 1.0)))
            u))
          1.0))))
      \begin{array}{l}
      
      \\
      \left(-s\right) \cdot \log \left(\frac{1}{\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{\left(\frac{\mathsf{PI}\left(\right)}{s} + 1\right) + 1}\right) \cdot u} - 1\right)
      \end{array}
      
      Derivation
      1. Initial program 98.9%

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

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{u \cdot \left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}} - 1\right) \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) \cdot u}} - 1\right) \]
        2. lower-*.f32N/A

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) \cdot u}} - 1\right) \]
      5. Applied rewrites97.5%

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\right) \cdot u}} - 1\right) \]
      6. Taylor expanded in s around inf

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{\left(1 + \frac{\mathsf{PI}\left(\right)}{s}\right) + 1}\right) \cdot u} - 1\right) \]
      7. Step-by-step derivation
        1. Applied rewrites94.9%

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{\left(\frac{\mathsf{PI}\left(\right)}{s} + 1\right) + 1}\right) \cdot u} - 1\right) \]
        2. Add Preprocessing

        Alternative 6: 37.0% accurate, 2.0× speedup?

        \[\begin{array}{l} \\ \left(-s\right) \cdot \log \left(\frac{1}{\left(0.5 - \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\right) \cdot u} - 1\right) \end{array} \]
        (FPCore (u s)
         :precision binary32
         (*
          (- s)
          (log (- (/ 1.0 (* (- 0.5 (/ 1.0 (+ (exp (/ (PI) s)) 1.0))) u)) 1.0))))
        \begin{array}{l}
        
        \\
        \left(-s\right) \cdot \log \left(\frac{1}{\left(0.5 - \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\right) \cdot u} - 1\right)
        \end{array}
        
        Derivation
        1. Initial program 98.9%

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

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{u \cdot \left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}} - 1\right) \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) \cdot u}} - 1\right) \]
          2. lower-*.f32N/A

            \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\left(\frac{1}{1 + e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) \cdot u}} - 1\right) \]
        5. Applied rewrites97.5%

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\left(\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\right) \cdot u}} - 1\right) \]
        6. Taylor expanded in s around inf

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\left(\frac{1}{2} - \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\right) \cdot u} - 1\right) \]
        7. Step-by-step derivation
          1. Applied rewrites37.3%

            \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\left(0.5 - \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}\right) \cdot u} - 1\right) \]
          2. Add Preprocessing

          Alternative 7: 24.8% accurate, 3.0× speedup?

          \[\begin{array}{l} \\ \left(-s\right) \cdot \log \left(\mathsf{fma}\left(\frac{\mathsf{fma}\left(\mathsf{fma}\left(\left(\left(0.5 \cdot \mathsf{PI}\left(\right)\right) \cdot -1\right) \cdot 0.5, u, -0.25 \cdot \mathsf{PI}\left(\right)\right), -8, 0.25 \cdot \left(\mathsf{PI}\left(\right) \cdot -12\right)\right)}{s}, -1, 2\right) - 1\right) \end{array} \]
          (FPCore (u s)
           :precision binary32
           (*
            (- s)
            (log
             (-
              (fma
               (/
                (fma
                 (fma (* (* (* 0.5 (PI)) -1.0) 0.5) u (* -0.25 (PI)))
                 -8.0
                 (* 0.25 (* (PI) -12.0)))
                s)
               -1.0
               2.0)
              1.0))))
          \begin{array}{l}
          
          \\
          \left(-s\right) \cdot \log \left(\mathsf{fma}\left(\frac{\mathsf{fma}\left(\mathsf{fma}\left(\left(\left(0.5 \cdot \mathsf{PI}\left(\right)\right) \cdot -1\right) \cdot 0.5, u, -0.25 \cdot \mathsf{PI}\left(\right)\right), -8, 0.25 \cdot \left(\mathsf{PI}\left(\right) \cdot -12\right)\right)}{s}, -1, 2\right) - 1\right)
          \end{array}
          
          Derivation
          1. Initial program 98.9%

            \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - 1\right) \]
          2. Add Preprocessing
          3. Applied rewrites98.8%

            \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\frac{{\left(e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1\right)}^{-3} + {\left(\left(e^{-\mathsf{log1p}\left(e^{\frac{-\mathsf{PI}\left(\right)}{s}}\right)} - e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}\right) \cdot u\right)}^{3}}{{\left(e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1\right)}^{-2} + \left({\left(\left(e^{-\mathsf{log1p}\left(e^{\frac{-\mathsf{PI}\left(\right)}{s}}\right)} - e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}\right) \cdot u\right)}^{2} - \left(\left(e^{-\mathsf{log1p}\left(e^{\frac{-\mathsf{PI}\left(\right)}{s}}\right)} - e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}\right) \cdot u\right) \cdot e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}\right)}}} - 1\right) \]
          4. Taylor expanded in s around -inf

            \[\leadsto \left(-s\right) \cdot \log \left(\color{blue}{\left(2 + -1 \cdot \frac{-8 \cdot \left(\frac{-1}{4} \cdot \mathsf{PI}\left(\right) + u \cdot \left(e^{\mathsf{neg}\left(\log 2\right)} \cdot \left(\frac{-1}{2} \cdot \left(\mathsf{PI}\left(\right) \cdot e^{\mathsf{neg}\left(\log 2\right)}\right) - \frac{1}{2} \cdot \left(\mathsf{PI}\left(\right) \cdot e^{\mathsf{neg}\left(\log 2\right)}\right)\right)\right)\right) - \frac{-1}{4} \cdot \left(-8 \cdot \mathsf{PI}\left(\right) + -4 \cdot \mathsf{PI}\left(\right)\right)}{s}\right)} - 1\right) \]
          5. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \left(-s\right) \cdot \log \left(\color{blue}{\left(-1 \cdot \frac{-8 \cdot \left(\frac{-1}{4} \cdot \mathsf{PI}\left(\right) + u \cdot \left(e^{\mathsf{neg}\left(\log 2\right)} \cdot \left(\frac{-1}{2} \cdot \left(\mathsf{PI}\left(\right) \cdot e^{\mathsf{neg}\left(\log 2\right)}\right) - \frac{1}{2} \cdot \left(\mathsf{PI}\left(\right) \cdot e^{\mathsf{neg}\left(\log 2\right)}\right)\right)\right)\right) - \frac{-1}{4} \cdot \left(-8 \cdot \mathsf{PI}\left(\right) + -4 \cdot \mathsf{PI}\left(\right)\right)}{s} + 2\right)} - 1\right) \]
            2. *-commutativeN/A

              \[\leadsto \left(-s\right) \cdot \log \left(\left(\color{blue}{\frac{-8 \cdot \left(\frac{-1}{4} \cdot \mathsf{PI}\left(\right) + u \cdot \left(e^{\mathsf{neg}\left(\log 2\right)} \cdot \left(\frac{-1}{2} \cdot \left(\mathsf{PI}\left(\right) \cdot e^{\mathsf{neg}\left(\log 2\right)}\right) - \frac{1}{2} \cdot \left(\mathsf{PI}\left(\right) \cdot e^{\mathsf{neg}\left(\log 2\right)}\right)\right)\right)\right) - \frac{-1}{4} \cdot \left(-8 \cdot \mathsf{PI}\left(\right) + -4 \cdot \mathsf{PI}\left(\right)\right)}{s} \cdot -1} + 2\right) - 1\right) \]
            3. lower-fma.f32N/A

              \[\leadsto \left(-s\right) \cdot \log \left(\color{blue}{\mathsf{fma}\left(\frac{-8 \cdot \left(\frac{-1}{4} \cdot \mathsf{PI}\left(\right) + u \cdot \left(e^{\mathsf{neg}\left(\log 2\right)} \cdot \left(\frac{-1}{2} \cdot \left(\mathsf{PI}\left(\right) \cdot e^{\mathsf{neg}\left(\log 2\right)}\right) - \frac{1}{2} \cdot \left(\mathsf{PI}\left(\right) \cdot e^{\mathsf{neg}\left(\log 2\right)}\right)\right)\right)\right) - \frac{-1}{4} \cdot \left(-8 \cdot \mathsf{PI}\left(\right) + -4 \cdot \mathsf{PI}\left(\right)\right)}{s}, -1, 2\right)} - 1\right) \]
          6. Applied rewrites24.9%

            \[\leadsto \left(-s\right) \cdot \log \left(\color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\mathsf{fma}\left(\left(\left(0.5 \cdot \mathsf{PI}\left(\right)\right) \cdot -1\right) \cdot 0.5, u, -0.25 \cdot \mathsf{PI}\left(\right)\right), -8, 0.25 \cdot \left(\mathsf{PI}\left(\right) \cdot -12\right)\right)}{s}, -1, 2\right)} - 1\right) \]
          7. Add Preprocessing

          Alternative 8: 24.6% accurate, 3.3× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{PI}\left(\right)}{s}\\ \left(-s\right) \cdot \log \left(\mathsf{fma}\left(t\_0, 1, \mathsf{fma}\left(u, \left(0.5 \cdot t\_0\right) \cdot -4, 2\right)\right) - 1\right) \end{array} \end{array} \]
          (FPCore (u s)
           :precision binary32
           (let* ((t_0 (/ (PI) s)))
             (* (- s) (log (- (fma t_0 1.0 (fma u (* (* 0.5 t_0) -4.0) 2.0)) 1.0)))))
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{\mathsf{PI}\left(\right)}{s}\\
          \left(-s\right) \cdot \log \left(\mathsf{fma}\left(t\_0, 1, \mathsf{fma}\left(u, \left(0.5 \cdot t\_0\right) \cdot -4, 2\right)\right) - 1\right)
          \end{array}
          \end{array}
          
          Derivation
          1. Initial program 98.9%

            \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - 1\right) \]
          2. Add Preprocessing
          3. Applied rewrites98.8%

            \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\frac{{\left(e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1\right)}^{-3} + {\left(\left(e^{-\mathsf{log1p}\left(e^{\frac{-\mathsf{PI}\left(\right)}{s}}\right)} - e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}\right) \cdot u\right)}^{3}}{{\left(e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1\right)}^{-2} + \left({\left(\left(e^{-\mathsf{log1p}\left(e^{\frac{-\mathsf{PI}\left(\right)}{s}}\right)} - e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}\right) \cdot u\right)}^{2} - \left(\left(e^{-\mathsf{log1p}\left(e^{\frac{-\mathsf{PI}\left(\right)}{s}}\right)} - e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}\right) \cdot u\right) \cdot e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}\right)}}} - 1\right) \]
          4. Step-by-step derivation
            1. lift-/.f32N/A

              \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\frac{{\left(e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1\right)}^{-3} + {\left(\left(e^{-\mathsf{log1p}\left(e^{\frac{-\mathsf{PI}\left(\right)}{s}}\right)} - e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}\right) \cdot u\right)}^{3}}{{\left(e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1\right)}^{-2} + \left({\left(\left(e^{-\mathsf{log1p}\left(e^{\frac{-\mathsf{PI}\left(\right)}{s}}\right)} - e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}\right) \cdot u\right)}^{2} - \left(\left(e^{-\mathsf{log1p}\left(e^{\frac{-\mathsf{PI}\left(\right)}{s}}\right)} - e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}\right) \cdot u\right) \cdot e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}\right)}}} - 1\right) \]
          5. Applied rewrites98.9%

            \[\leadsto \left(-s\right) \cdot \log \left(\color{blue}{{\left({\left(\mathsf{fma}\left(u, e^{-\mathsf{log1p}\left(e^{\frac{-\mathsf{PI}\left(\right)}{s}}\right)} - e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}, e^{-\mathsf{log1p}\left(e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}\right)\right)}^{2}\right)}^{-0.5}} - 1\right) \]
          6. Taylor expanded in s around -inf

            \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\left(\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{s \cdot e^{\mathsf{neg}\left(\log 2\right)}} + \left(\frac{1}{e^{\mathsf{neg}\left(\log 2\right)}} + \frac{u \cdot \left(\frac{-1}{2} \cdot \left(\mathsf{PI}\left(\right) \cdot e^{\mathsf{neg}\left(\log 2\right)}\right) - \frac{1}{2} \cdot \left(\mathsf{PI}\left(\right) \cdot e^{\mathsf{neg}\left(\log 2\right)}\right)\right)}{s \cdot {\left(e^{\mathsf{neg}\left(\log 2\right)}\right)}^{2}}\right)\right) - 1\right)} \]
          7. Step-by-step derivation
            1. lower--.f32N/A

              \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\left(\frac{1}{2} \cdot \frac{\mathsf{PI}\left(\right)}{s \cdot e^{\mathsf{neg}\left(\log 2\right)}} + \left(\frac{1}{e^{\mathsf{neg}\left(\log 2\right)}} + \frac{u \cdot \left(\frac{-1}{2} \cdot \left(\mathsf{PI}\left(\right) \cdot e^{\mathsf{neg}\left(\log 2\right)}\right) - \frac{1}{2} \cdot \left(\mathsf{PI}\left(\right) \cdot e^{\mathsf{neg}\left(\log 2\right)}\right)\right)}{s \cdot {\left(e^{\mathsf{neg}\left(\log 2\right)}\right)}^{2}}\right)\right) - 1\right)} \]
          8. Applied rewrites24.9%

            \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{s}, 1, \mathsf{fma}\left(u, \left(0.5 \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) \cdot -4, 2\right)\right) - 1\right)} \]
          9. Add Preprocessing

          Alternative 9: 11.6% accurate, 30.0× speedup?

          \[\begin{array}{l} \\ \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(0.5, u, -0.25\right)\right) \cdot 4 \end{array} \]
          (FPCore (u s) :precision binary32 (* (* (PI) (fma 0.5 u -0.25)) 4.0))
          \begin{array}{l}
          
          \\
          \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(0.5, u, -0.25\right)\right) \cdot 4
          \end{array}
          
          Derivation
          1. Initial program 98.9%

            \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - 1\right) \]
          2. Add Preprocessing
          3. Taylor expanded in u around 0

            \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\mathsf{PI}\left(\right)}{s}} \]
          4. Step-by-step derivation
            1. lower-/.f32N/A

              \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\mathsf{PI}\left(\right)}{s}} \]
            2. lower-PI.f3211.4

              \[\leadsto \left(-s\right) \cdot \frac{\color{blue}{\mathsf{PI}\left(\right)}}{s} \]
          5. Applied rewrites11.4%

            \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\mathsf{PI}\left(\right)}{s}} \]
          6. Taylor expanded in s around inf

            \[\leadsto \color{blue}{4 \cdot \left(u \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) - \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)} \]
          7. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\left(u \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) - \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right) \cdot 4} \]
            2. lower-*.f32N/A

              \[\leadsto \color{blue}{\left(u \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) - \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right) \cdot 4} \]
          8. Applied rewrites11.7%

            \[\leadsto \color{blue}{\mathsf{fma}\left(0.5 \cdot \mathsf{PI}\left(\right), u, -0.25 \cdot \mathsf{PI}\left(\right)\right) \cdot 4} \]
          9. Step-by-step derivation
            1. Applied rewrites11.7%

              \[\leadsto \left(\mathsf{PI}\left(\right) \cdot \mathsf{fma}\left(0.5, u, -0.25\right)\right) \cdot \color{blue}{4} \]
            2. Add Preprocessing

            Alternative 10: 11.6% accurate, 36.4× speedup?

            \[\begin{array}{l} \\ \mathsf{fma}\left(2, \mathsf{PI}\left(\right) \cdot u, -\mathsf{PI}\left(\right)\right) \end{array} \]
            (FPCore (u s) :precision binary32 (fma 2.0 (* (PI) u) (- (PI))))
            \begin{array}{l}
            
            \\
            \mathsf{fma}\left(2, \mathsf{PI}\left(\right) \cdot u, -\mathsf{PI}\left(\right)\right)
            \end{array}
            
            Derivation
            1. Initial program 98.9%

              \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - 1\right) \]
            2. Add Preprocessing
            3. Taylor expanded in u around 0

              \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\mathsf{PI}\left(\right)}{s}} \]
            4. Step-by-step derivation
              1. lower-/.f32N/A

                \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\mathsf{PI}\left(\right)}{s}} \]
              2. lower-PI.f3211.4

                \[\leadsto \left(-s\right) \cdot \frac{\color{blue}{\mathsf{PI}\left(\right)}}{s} \]
            5. Applied rewrites11.4%

              \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\mathsf{PI}\left(\right)}{s}} \]
            6. Taylor expanded in s around inf

              \[\leadsto \color{blue}{4 \cdot \left(u \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) - \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)} \]
            7. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \color{blue}{\left(u \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) - \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right) \cdot 4} \]
              2. lower-*.f32N/A

                \[\leadsto \color{blue}{\left(u \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) - \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right) \cdot 4} \]
            8. Applied rewrites11.7%

              \[\leadsto \color{blue}{\mathsf{fma}\left(0.5 \cdot \mathsf{PI}\left(\right), u, -0.25 \cdot \mathsf{PI}\left(\right)\right) \cdot 4} \]
            9. Taylor expanded in u around 0

              \[\leadsto -1 \cdot \mathsf{PI}\left(\right) + \color{blue}{2 \cdot \left(u \cdot \mathsf{PI}\left(\right)\right)} \]
            10. Step-by-step derivation
              1. Applied rewrites11.7%

                \[\leadsto \mathsf{fma}\left(2, \color{blue}{\mathsf{PI}\left(\right) \cdot u}, -\mathsf{PI}\left(\right)\right) \]
              2. Add Preprocessing

              Alternative 11: 11.4% accurate, 170.0× speedup?

              \[\begin{array}{l} \\ -\mathsf{PI}\left(\right) \end{array} \]
              (FPCore (u s) :precision binary32 (- (PI)))
              \begin{array}{l}
              
              \\
              -\mathsf{PI}\left(\right)
              \end{array}
              
              Derivation
              1. Initial program 98.9%

                \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - 1\right) \]
              2. Add Preprocessing
              3. Taylor expanded in u around 0

                \[\leadsto \color{blue}{-1 \cdot \mathsf{PI}\left(\right)} \]
              4. Step-by-step derivation
                1. mul-1-negN/A

                  \[\leadsto \color{blue}{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)} \]
                2. lower-neg.f32N/A

                  \[\leadsto \color{blue}{-\mathsf{PI}\left(\right)} \]
                3. lower-PI.f3211.5

                  \[\leadsto -\color{blue}{\mathsf{PI}\left(\right)} \]
              5. Applied rewrites11.5%

                \[\leadsto \color{blue}{-\mathsf{PI}\left(\right)} \]
              6. Add Preprocessing

              Reproduce

              ?
              herbie shell --seed 2025006 
              (FPCore (u s)
                :name "Sample trimmed logistic on [-pi, pi]"
                :precision binary32
                :pre (and (and (<= 2.328306437e-10 u) (<= u 1.0)) (and (<= 0.0 s) (<= s 1.0651631)))
                (* (- s) (log (- (/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s)))) (/ 1.0 (+ 1.0 (exp (/ (PI) s)))))) (/ 1.0 (+ 1.0 (exp (/ (PI) s)))))) 1.0))))