Sample trimmed logistic on [-pi, pi]

Percentage Accurate: 98.9% → 98.9%
Time: 14.7s
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, 0.7× speedup?

\[\begin{array}{l} \\ \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{{\left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{3}}{-s}}}} - 1\right) \end{array} \]
(FPCore (u s)
 :precision binary32
 (*
  (- s)
  (log
   (-
    (/
     1.0
     (+
      (*
       u
       (-
        (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s))))
        (/ 1.0 (+ 1.0 (exp (/ (PI) s))))))
      (/ 1.0 (+ 1.0 (exp (/ (pow (- (cbrt (PI))) 3.0) (- s)))))))
    1.0))))
\begin{array}{l}

\\
\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{{\left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{3}}{-s}}}} - 1\right)
\end{array}
Derivation
  1. Initial program 98.8%

    \[\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. Step-by-step derivation
    1. lift-/.f32N/A

      \[\leadsto \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^{\color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
    2. lift-PI.f32N/A

      \[\leadsto \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{\color{blue}{\mathsf{PI}\left(\right)}}{s}}}} - 1\right) \]
    3. add-cube-cbrtN/A

      \[\leadsto \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{\color{blue}{\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \sqrt[3]{\mathsf{PI}\left(\right)}}}{s}}}} - 1\right) \]
    4. associate-/l*N/A

      \[\leadsto \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^{\color{blue}{\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \frac{\sqrt[3]{\mathsf{PI}\left(\right)}}{s}}}}} - 1\right) \]
    5. lower-*.f32N/A

      \[\leadsto \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^{\color{blue}{\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \frac{\sqrt[3]{\mathsf{PI}\left(\right)}}{s}}}}} - 1\right) \]
    6. pow2N/A

      \[\leadsto \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^{\color{blue}{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}} \cdot \frac{\sqrt[3]{\mathsf{PI}\left(\right)}}{s}}}} - 1\right) \]
    7. lower-pow.f32N/A

      \[\leadsto \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^{\color{blue}{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}} \cdot \frac{\sqrt[3]{\mathsf{PI}\left(\right)}}{s}}}} - 1\right) \]
    8. lift-PI.f32N/A

      \[\leadsto \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^{{\left(\sqrt[3]{\color{blue}{\mathsf{PI}\left(\right)}}\right)}^{2} \cdot \frac{\sqrt[3]{\mathsf{PI}\left(\right)}}{s}}}} - 1\right) \]
    9. lower-cbrt.f32N/A

      \[\leadsto \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^{{\color{blue}{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}}^{2} \cdot \frac{\sqrt[3]{\mathsf{PI}\left(\right)}}{s}}}} - 1\right) \]
    10. lower-/.f32N/A

      \[\leadsto \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^{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \color{blue}{\frac{\sqrt[3]{\mathsf{PI}\left(\right)}}{s}}}}} - 1\right) \]
    11. lift-PI.f32N/A

      \[\leadsto \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^{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \frac{\sqrt[3]{\color{blue}{\mathsf{PI}\left(\right)}}}{s}}}} - 1\right) \]
    12. lower-cbrt.f3298.8

      \[\leadsto \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^{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \frac{\color{blue}{\sqrt[3]{\mathsf{PI}\left(\right)}}}{s}}}} - 1\right) \]
  4. Applied rewrites98.8%

    \[\leadsto \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^{\color{blue}{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \frac{\sqrt[3]{\mathsf{PI}\left(\right)}}{s}}}}} - 1\right) \]
  5. Step-by-step derivation
    1. lift-PI.f32N/A

      \[\leadsto \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^{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \frac{\sqrt[3]{\color{blue}{\mathsf{PI}\left(\right)}}}{s}}}} - 1\right) \]
    2. add-exp-logN/A

      \[\leadsto \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^{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \frac{\sqrt[3]{\color{blue}{e^{\log \mathsf{PI}\left(\right)}}}}{s}}}} - 1\right) \]
    3. lower-exp.f32N/A

      \[\leadsto \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^{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \frac{\sqrt[3]{\color{blue}{e^{\log \mathsf{PI}\left(\right)}}}}{s}}}} - 1\right) \]
    4. lift-PI.f32N/A

      \[\leadsto \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^{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \frac{\sqrt[3]{e^{\log \color{blue}{\mathsf{PI}\left(\right)}}}}{s}}}} - 1\right) \]
    5. lower-log.f3298.8

      \[\leadsto \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^{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \frac{\sqrt[3]{e^{\color{blue}{\log \mathsf{PI}\left(\right)}}}}{s}}}} - 1\right) \]
  6. Applied rewrites98.8%

    \[\leadsto \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^{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \frac{\sqrt[3]{\color{blue}{e^{\log \mathsf{PI}\left(\right)}}}}{s}}}} - 1\right) \]
  7. Step-by-step derivation
    1. lift-*.f32N/A

      \[\leadsto \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^{\color{blue}{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \frac{\sqrt[3]{e^{\log \mathsf{PI}\left(\right)}}}{s}}}}} - 1\right) \]
    2. *-commutativeN/A

      \[\leadsto \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^{\color{blue}{\frac{\sqrt[3]{e^{\log \mathsf{PI}\left(\right)}}}{s} \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}}}} - 1\right) \]
    3. lift-/.f32N/A

      \[\leadsto \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^{\color{blue}{\frac{\sqrt[3]{e^{\log \mathsf{PI}\left(\right)}}}{s}} \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}}} - 1\right) \]
    4. frac-2negN/A

      \[\leadsto \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^{\color{blue}{\frac{\mathsf{neg}\left(\sqrt[3]{e^{\log \mathsf{PI}\left(\right)}}\right)}{\mathsf{neg}\left(s\right)}} \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}}} - 1\right) \]
    5. lift-neg.f32N/A

      \[\leadsto \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{neg}\left(\sqrt[3]{e^{\log \mathsf{PI}\left(\right)}}\right)}{\color{blue}{-s}} \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}}} - 1\right) \]
    6. associate-*l/N/A

      \[\leadsto \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^{\color{blue}{\frac{\left(\mathsf{neg}\left(\sqrt[3]{e^{\log \mathsf{PI}\left(\right)}}\right)\right) \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}{-s}}}}} - 1\right) \]
    7. lower-/.f32N/A

      \[\leadsto \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^{\color{blue}{\frac{\left(\mathsf{neg}\left(\sqrt[3]{e^{\log \mathsf{PI}\left(\right)}}\right)\right) \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}{-s}}}}} - 1\right) \]
    8. lower-*.f32N/A

      \[\leadsto \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{\color{blue}{\left(\mathsf{neg}\left(\sqrt[3]{e^{\log \mathsf{PI}\left(\right)}}\right)\right) \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}}{-s}}}} - 1\right) \]
    9. lift-exp.f32N/A

      \[\leadsto \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{\left(\mathsf{neg}\left(\sqrt[3]{\color{blue}{e^{\log \mathsf{PI}\left(\right)}}}\right)\right) \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}{-s}}}} - 1\right) \]
    10. lift-log.f32N/A

      \[\leadsto \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{\left(\mathsf{neg}\left(\sqrt[3]{e^{\color{blue}{\log \mathsf{PI}\left(\right)}}}\right)\right) \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}{-s}}}} - 1\right) \]
    11. rem-exp-logN/A

      \[\leadsto \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{\left(\mathsf{neg}\left(\sqrt[3]{\color{blue}{\mathsf{PI}\left(\right)}}\right)\right) \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}{-s}}}} - 1\right) \]
    12. lower-neg.f3298.8

      \[\leadsto \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{\color{blue}{\left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)} \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}{-s}}}} - 1\right) \]
  8. Applied rewrites98.8%

    \[\leadsto \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^{\color{blue}{\frac{\left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}{-s}}}}} - 1\right) \]
  9. Step-by-step derivation
    1. lift-*.f32N/A

      \[\leadsto \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{\color{blue}{\left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}}{-s}}}} - 1\right) \]
    2. *-commutativeN/A

      \[\leadsto \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{\color{blue}{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)}}{-s}}}} - 1\right) \]
    3. lift-pow.f32N/A

      \[\leadsto \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{\color{blue}{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}} \cdot \left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)}{-s}}}} - 1\right) \]
    4. unpow2N/A

      \[\leadsto \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{\color{blue}{\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)} \cdot \left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)}{-s}}}} - 1\right) \]
    5. sqr-neg-revN/A

      \[\leadsto \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{\color{blue}{\left(\left(\mathsf{neg}\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)\right) \cdot \left(\mathsf{neg}\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)\right)\right)} \cdot \left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)}{-s}}}} - 1\right) \]
    6. lift-neg.f32N/A

      \[\leadsto \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{\left(\color{blue}{\left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)} \cdot \left(\mathsf{neg}\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)\right)\right) \cdot \left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)}{-s}}}} - 1\right) \]
    7. lift-neg.f32N/A

      \[\leadsto \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{\left(\left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \color{blue}{\left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)}\right) \cdot \left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)}{-s}}}} - 1\right) \]
    8. pow3N/A

      \[\leadsto \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{\color{blue}{{\left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{3}}}{-s}}}} - 1\right) \]
    9. lower-pow.f3298.8

      \[\leadsto \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{\color{blue}{{\left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{3}}}{-s}}}} - 1\right) \]
  10. Applied rewrites98.8%

    \[\leadsto \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{\color{blue}{{\left(-\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{3}}}{-s}}}} - 1\right) \]
  11. Add Preprocessing

Alternative 2: 22.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\ \mathbf{if}\;\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) \leq -3.999999984016789 \cdot 10^{-12}:\\ \;\;\;\;\left(-s\right) \cdot \log \left(\frac{\mathsf{fma}\left(-2 \cdot \mathsf{PI}\left(\right), u, \mathsf{PI}\left(\right)\right)}{s} + 1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-s\right) \cdot \log \left(\mathsf{fma}\left(\mathsf{fma}\left(u \cdot {\mathsf{PI}\left(\right)}^{1}, -0.5, 0.25 \cdot \mathsf{PI}\left(\right)\right), \frac{4}{s}, 1\right)\right)\\ \end{array} \end{array} \]
(FPCore (u s)
 :precision binary32
 (let* ((t_0 (/ 1.0 (+ 1.0 (exp (/ (PI) s))))))
   (if (<=
        (*
         (- s)
         (log
          (-
           (/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s)))) t_0)) t_0))
           1.0)))
        -3.999999984016789e-12)
     (* (- s) (log (+ (/ (fma (* -2.0 (PI)) u (PI)) s) 1.0)))
     (*
      (- s)
      (log
       (fma (fma (* u (pow (PI) 1.0)) -0.5 (* 0.25 (PI))) (/ 4.0 s) 1.0))))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\
\mathbf{if}\;\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) \leq -3.999999984016789 \cdot 10^{-12}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\frac{\mathsf{fma}\left(-2 \cdot \mathsf{PI}\left(\right), u, \mathsf{PI}\left(\right)\right)}{s} + 1\right)\\

\mathbf{else}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\mathsf{fma}\left(\mathsf{fma}\left(u \cdot {\mathsf{PI}\left(\right)}^{1}, -0.5, 0.25 \cdot \mathsf{PI}\left(\right)\right), \frac{4}{s}, 1\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f32 (neg.f32 s) (log.f32 (-.f32 (/.f32 #s(literal 1 binary32) (+.f32 (*.f32 u (-.f32 (/.f32 #s(literal 1 binary32) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (PI.f32)) s)))) (/.f32 #s(literal 1 binary32) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (PI.f32) s)))))) (/.f32 #s(literal 1 binary32) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (PI.f32) s)))))) #s(literal 1 binary32)))) < -3.99999998e-12

    1. Initial program 98.8%

      \[\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 s around -inf

      \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(1 + 4 \cdot \frac{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)}{s}\right)} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \left(-s\right) \cdot \log \left(1 + \color{blue}{\frac{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)}{s}}\right) \]
      2. +-commutativeN/A

        \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\frac{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)}{s} + 1\right)} \]
      3. *-commutativeN/A

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{\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}}{s} + 1\right) \]
      4. associate-/l*N/A

        \[\leadsto \left(-s\right) \cdot \log \left(\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 \frac{4}{s}} + 1\right) \]
      5. lower-fma.f32N/A

        \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\mathsf{fma}\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), \frac{4}{s}, 1\right)\right)} \]
    5. Applied rewrites7.0%

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

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

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{\mathsf{fma}\left(-2 \cdot \mathsf{PI}\left(\right), u, \mathsf{PI}\left(\right)\right)}{s} + \color{blue}{1}\right) \]

      if -3.99999998e-12 < (*.f32 (neg.f32 s) (log.f32 (-.f32 (/.f32 #s(literal 1 binary32) (+.f32 (*.f32 u (-.f32 (/.f32 #s(literal 1 binary32) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (PI.f32)) s)))) (/.f32 #s(literal 1 binary32) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (PI.f32) s)))))) (/.f32 #s(literal 1 binary32) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (PI.f32) s)))))) #s(literal 1 binary32))))

      1. Initial program 98.8%

        \[\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 s around -inf

        \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(1 + 4 \cdot \frac{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)}{s}\right)} \]
      4. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \left(-s\right) \cdot \log \left(1 + \color{blue}{\frac{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)}{s}}\right) \]
        2. +-commutativeN/A

          \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\frac{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)}{s} + 1\right)} \]
        3. *-commutativeN/A

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{\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}}{s} + 1\right) \]
        4. associate-/l*N/A

          \[\leadsto \left(-s\right) \cdot \log \left(\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 \frac{4}{s}} + 1\right) \]
        5. lower-fma.f32N/A

          \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\mathsf{fma}\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), \frac{4}{s}, 1\right)\right)} \]
      5. Applied rewrites11.7%

        \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(u \cdot \mathsf{PI}\left(\right), -0.5, 0.25 \cdot \mathsf{PI}\left(\right)\right), \frac{4}{s}, 1\right)\right)} \]
      6. Step-by-step derivation
        1. Applied rewrites27.4%

          \[\leadsto \left(-s\right) \cdot \log \left(\mathsf{fma}\left(\mathsf{fma}\left(u \cdot {\mathsf{PI}\left(\right)}^{1}, -0.5, 0.25 \cdot \mathsf{PI}\left(\right)\right), \frac{4}{s}, 1\right)\right) \]
      7. Recombined 2 regimes into one program.
      8. Add Preprocessing

      Alternative 3: 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}
      
      Derivation
      1. Initial program 98.8%

        \[\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. Add Preprocessing

      Alternative 4: 97.7% 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.8%

        \[\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.6%

        \[\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 5: 9.2% accurate, 3.8× speedup?

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

        \[\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 s around -inf

        \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(1 + 4 \cdot \frac{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)}{s}\right)} \]
      4. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \left(-s\right) \cdot \log \left(1 + \color{blue}{\frac{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)}{s}}\right) \]
        2. +-commutativeN/A

          \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\frac{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)}{s} + 1\right)} \]
        3. *-commutativeN/A

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{\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}}{s} + 1\right) \]
        4. associate-/l*N/A

          \[\leadsto \left(-s\right) \cdot \log \left(\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 \frac{4}{s}} + 1\right) \]
        5. lower-fma.f32N/A

          \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\mathsf{fma}\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), \frac{4}{s}, 1\right)\right)} \]
      5. Applied rewrites10.4%

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

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

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

        Alternative 6: 25.1% accurate, 4.2× speedup?

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

          \[\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 s around -inf

          \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(1 + 4 \cdot \frac{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)}{s}\right)} \]
        4. Step-by-step derivation
          1. associate-*r/N/A

            \[\leadsto \left(-s\right) \cdot \log \left(1 + \color{blue}{\frac{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)}{s}}\right) \]
          2. +-commutativeN/A

            \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\frac{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)}{s} + 1\right)} \]
          3. *-commutativeN/A

            \[\leadsto \left(-s\right) \cdot \log \left(\frac{\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}}{s} + 1\right) \]
          4. associate-/l*N/A

            \[\leadsto \left(-s\right) \cdot \log \left(\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 \frac{4}{s}} + 1\right) \]
          5. lower-fma.f32N/A

            \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\mathsf{fma}\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), \frac{4}{s}, 1\right)\right)} \]
        5. Applied rewrites10.4%

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

          \[\leadsto \left(-s\right) \cdot \log \left(1 + \color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}\right) \]
        7. Step-by-step derivation
          1. Applied rewrites24.8%

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

          Alternative 7: 12.0% accurate, 7.4× speedup?

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

            \[\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 s around -inf

            \[\leadsto \left(-s\right) \cdot \color{blue}{\left(4 \cdot \frac{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)}{s}\right)} \]
          4. Step-by-step derivation
            1. associate-*r/N/A

              \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{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)}{s}} \]
            2. *-commutativeN/A

              \[\leadsto \left(-s\right) \cdot \frac{\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}}{s} \]
            3. associate-/l*N/A

              \[\leadsto \left(-s\right) \cdot \color{blue}{\left(\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 \frac{4}{s}\right)} \]
            4. lower-*.f32N/A

              \[\leadsto \left(-s\right) \cdot \color{blue}{\left(\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 \frac{4}{s}\right)} \]
            5. fp-cancel-sub-sign-invN/A

              \[\leadsto \left(-s\right) \cdot \left(\color{blue}{\left(u \cdot \left(\frac{-1}{4} \cdot \mathsf{PI}\left(\right) - \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right) + \left(\mathsf{neg}\left(\frac{-1}{4}\right)\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot \frac{4}{s}\right) \]
            6. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

              \[\leadsto \left(-s\right) \cdot \left(\mathsf{fma}\left(u \cdot \mathsf{PI}\left(\right), \frac{-1}{2}, \frac{1}{4} \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot \frac{4}{s}\right) \]
            15. lower-/.f3210.9

              \[\leadsto \left(-s\right) \cdot \left(\mathsf{fma}\left(u \cdot \mathsf{PI}\left(\right), -0.5, 0.25 \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\frac{4}{s}}\right) \]
          5. Applied rewrites10.9%

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

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

            Alternative 8: 11.5% accurate, 26.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := u \cdot \mathsf{PI}\left(\right)\\ \left(\left(-\mathsf{PI}\left(\right)\right) + t\_0\right) + t\_0 \end{array} \end{array} \]
            (FPCore (u s)
             :precision binary32
             (let* ((t_0 (* u (PI)))) (+ (+ (- (PI)) t_0) t_0)))
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := u \cdot \mathsf{PI}\left(\right)\\
            \left(\left(-\mathsf{PI}\left(\right)\right) + t\_0\right) + t\_0
            \end{array}
            \end{array}
            
            Derivation
            1. Initial program 98.8%

              \[\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 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) + \frac{-1}{2} \cdot \frac{-16 \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)}^{2} + -2 \cdot \left(-8 \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)}^{2} + -4 \cdot \left(\frac{-1}{8} \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{1}{8} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}{s}} \]
            4. Applied rewrites7.8%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left({\left(\mathsf{fma}\left(u \cdot \mathsf{PI}\left(\right), -0.5, 0.25 \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}, -16, \mathsf{fma}\left(16, {\left(\mathsf{fma}\left(u \cdot \mathsf{PI}\left(\right), -0.5, 0.25 \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}, 0\right)\right)}{s}, -0.5, \mathsf{fma}\left(u \cdot \mathsf{PI}\left(\right), -0.5, 0.25 \cdot \mathsf{PI}\left(\right)\right) \cdot -4\right)} \]
            5. Taylor expanded in s around inf

              \[\leadsto -4 \cdot \color{blue}{\left(\frac{-1}{2} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)} \]
            6. Step-by-step derivation
              1. Applied rewrites10.9%

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

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

                Alternative 9: 11.5% accurate, 36.4× speedup?

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

                  \[\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 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) + \frac{-1}{2} \cdot \frac{-16 \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)}^{2} + -2 \cdot \left(-8 \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)}^{2} + -4 \cdot \left(\frac{-1}{8} \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{1}{8} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}{s}} \]
                4. Applied rewrites7.8%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left({\left(\mathsf{fma}\left(u \cdot \mathsf{PI}\left(\right), -0.5, 0.25 \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}, -16, \mathsf{fma}\left(16, {\left(\mathsf{fma}\left(u \cdot \mathsf{PI}\left(\right), -0.5, 0.25 \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}, 0\right)\right)}{s}, -0.5, \mathsf{fma}\left(u \cdot \mathsf{PI}\left(\right), -0.5, 0.25 \cdot \mathsf{PI}\left(\right)\right) \cdot -4\right)} \]
                5. Taylor expanded in s around inf

                  \[\leadsto -4 \cdot \color{blue}{\left(\frac{-1}{2} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)} \]
                6. Step-by-step derivation
                  1. Applied rewrites10.9%

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

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

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

                    Alternative 10: 11.2% 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.8%

                      \[\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.f3210.9

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

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

                    Alternative 11: 10.3% accurate, 510.0× speedup?

                    \[\begin{array}{l} \\ 0 \end{array} \]
                    (FPCore (u s) :precision binary32 0.0)
                    float code(float u, float s) {
                    	return 0.0f;
                    }
                    
                    module fmin_fmax_functions
                        implicit none
                        private
                        public fmax
                        public fmin
                    
                        interface fmax
                            module procedure fmax88
                            module procedure fmax44
                            module procedure fmax84
                            module procedure fmax48
                        end interface
                        interface fmin
                            module procedure fmin88
                            module procedure fmin44
                            module procedure fmin84
                            module procedure fmin48
                        end interface
                    contains
                        real(8) function fmax88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmax44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmax84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmax48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                        end function
                        real(8) function fmin88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmin44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmin84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmin48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                        end function
                    end module
                    
                    real(4) function code(u, s)
                    use fmin_fmax_functions
                        real(4), intent (in) :: u
                        real(4), intent (in) :: s
                        code = 0.0e0
                    end function
                    
                    function code(u, s)
                    	return Float32(0.0)
                    end
                    
                    function tmp = code(u, s)
                    	tmp = single(0.0);
                    end
                    
                    \begin{array}{l}
                    
                    \\
                    0
                    \end{array}
                    
                    Derivation
                    1. Initial program 98.8%

                      \[\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 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) + \frac{-1}{2} \cdot \frac{-16 \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)}^{2} + -2 \cdot \left(-8 \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)}^{2} + -4 \cdot \left(\frac{-1}{8} \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{1}{8} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}{s}} \]
                    4. Applied rewrites7.8%

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

                      \[\leadsto \frac{-1}{2} \cdot \color{blue}{\frac{-16 \cdot {\left(\frac{-1}{2} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)}^{2} + 16 \cdot {\left(\frac{-1}{2} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)}^{2}}{s}} \]
                    6. Step-by-step derivation
                      1. Applied rewrites10.4%

                        \[\leadsto 0 \]
                      2. Add Preprocessing

                      Reproduce

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