Sample trimmed logistic on [-pi, pi]

Percentage Accurate: 98.9% → 98.9%
Time: 19.5s
Alternatives: 18
Speedup: N/A×

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{\pi}{s}}}\\ \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{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)))))
float code(float u, float s) {
	float t_0 = 1.0f / (1.0f + expf((((float) M_PI) / s)));
	return -s * logf(((1.0f / ((u * ((1.0f / (1.0f + expf((-((float) M_PI) / s)))) - t_0)) + t_0)) - 1.0f));
}
function code(u, s)
	t_0 = Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(pi) / s))))
	return Float32(Float32(-s) * log(Float32(Float32(Float32(1.0) / Float32(Float32(u * Float32(Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(-Float32(pi)) / s)))) - t_0)) + t_0)) - Float32(1.0))))
end
function tmp = code(u, s)
	t_0 = single(1.0) / (single(1.0) + exp((single(pi) / s)));
	tmp = -s * log(((single(1.0) / ((u * ((single(1.0) / (single(1.0) + exp((-single(pi) / s)))) - t_0)) + t_0)) - single(1.0)));
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{1 + e^{\frac{\pi}{s}}}\\
\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{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 18 alternatives:

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

Initial Program: 98.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{1 + e^{\frac{\pi}{s}}}\\ \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{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)))))
float code(float u, float s) {
	float t_0 = 1.0f / (1.0f + expf((((float) M_PI) / s)));
	return -s * logf(((1.0f / ((u * ((1.0f / (1.0f + expf((-((float) M_PI) / s)))) - t_0)) + t_0)) - 1.0f));
}
function code(u, s)
	t_0 = Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(pi) / s))))
	return Float32(Float32(-s) * log(Float32(Float32(Float32(1.0) / Float32(Float32(u * Float32(Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(-Float32(pi)) / s)))) - t_0)) + t_0)) - Float32(1.0))))
end
function tmp = code(u, s)
	t_0 = single(1.0) / (single(1.0) + exp((single(pi) / s)));
	tmp = -s * log(((single(1.0) / ((u * ((single(1.0) / (single(1.0) + exp((-single(pi) / s)))) - t_0)) + t_0)) - single(1.0)));
end
\begin{array}{l}

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

Alternative 1: 98.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \left(-s\right) \cdot \log \left(-1 + \frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\pi}{-s}}} + \frac{1}{-1 - e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{s + 0 \cdot \frac{s}{\pi}}{s \cdot \frac{s}{\pi}}}}}\right) \end{array} \]
(FPCore (u s)
 :precision binary32
 (*
  (- s)
  (log
   (+
    -1.0
    (/
     1.0
     (+
      (*
       u
       (+ (/ 1.0 (+ 1.0 (exp (/ PI (- s))))) (/ 1.0 (- -1.0 (exp (/ PI s))))))
      (/ 1.0 (+ 1.0 (exp (/ (+ s (* 0.0 (/ s PI))) (* s (/ s PI))))))))))))
float code(float u, float s) {
	return -s * logf((-1.0f + (1.0f / ((u * ((1.0f / (1.0f + expf((((float) M_PI) / -s)))) + (1.0f / (-1.0f - expf((((float) M_PI) / s)))))) + (1.0f / (1.0f + expf(((s + (0.0f * (s / ((float) M_PI)))) / (s * (s / ((float) M_PI)))))))))));
}
function code(u, s)
	return Float32(Float32(-s) * log(Float32(Float32(-1.0) + Float32(Float32(1.0) / Float32(Float32(u * Float32(Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(pi) / Float32(-s))))) + Float32(Float32(1.0) / Float32(Float32(-1.0) - exp(Float32(Float32(pi) / s)))))) + Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(s + Float32(Float32(0.0) * Float32(s / Float32(pi)))) / Float32(s * Float32(s / Float32(pi))))))))))))
end
function tmp = code(u, s)
	tmp = -s * log((single(-1.0) + (single(1.0) / ((u * ((single(1.0) / (single(1.0) + exp((single(pi) / -s)))) + (single(1.0) / (single(-1.0) - exp((single(pi) / s)))))) + (single(1.0) / (single(1.0) + exp(((s + (single(0.0) * (s / single(pi)))) / (s * (s / single(pi)))))))))));
end
\begin{array}{l}

\\
\left(-s\right) \cdot \log \left(-1 + \frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\pi}{-s}}} + \frac{1}{-1 - e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{s + 0 \cdot \frac{s}{\pi}}{s \cdot \frac{s}{\pi}}}}}\right)
\end{array}
Derivation
  1. Initial program 99.0%

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. frac-2negN/A

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\color{blue}{0 - \mathsf{PI}\left(\right)}}{\mathsf{neg}\left(s\right)}}}} - 1\right) \]
    3. div-subN/A

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0}{\mathsf{neg}\left(s\right)} - \color{blue}{\left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{s}\right)\right)}}}} - 1\right) \]
    5. clear-numN/A

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0}{\mathsf{neg}\left(s\right)} - \left(\mathsf{neg}\left(\color{blue}{\frac{1}{\frac{s}{\mathsf{PI}\left(\right)}}}\right)\right)}}} - 1\right) \]
    6. distribute-neg-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1}{\left(\mathsf{neg}\left(s\right)\right) \cdot \color{blue}{\frac{s}{\mathsf{PI}\left(\right)}}}}}} - 1\right) \]
    19. PI-lowering-PI.f3299.0

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\pi} - \left(-s\right) \cdot -1}{\left(-s\right) \cdot \frac{s}{\color{blue}{\pi}}}}}} - 1\right) \]
  4. Applied egg-rr99.0%

    \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\color{blue}{\frac{0 \cdot \frac{s}{\pi} - \left(-s\right) \cdot -1}{\left(-s\right) \cdot \frac{s}{\pi}}}}}} - 1\right) \]
  5. Final simplification99.0%

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

Alternative 2: 98.9% accurate, 1.0× speedup?

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

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

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\color{blue}{\left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\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. accelerator-lowering-fma.f32N/A

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\color{blue}{\mathsf{fma}\left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\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) \]
  4. Applied egg-rr99.0%

    \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\mathsf{fma}\left(\frac{1}{1 + e^{-\frac{\pi}{s}}} + \frac{-1}{1 + e^{\frac{\pi}{s}}}, u, \frac{1}{1 + e^{\frac{\pi}{s}}}\right)}} - 1\right) \]
  5. Final simplification99.0%

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

Alternative 3: 97.3% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \left(-s\right) \cdot \log \left(-1 + \frac{1}{\frac{1}{1 + e^{\frac{s + 0 \cdot \frac{s}{\pi}}{s \cdot \frac{s}{\pi}}}} + u \cdot \left(\frac{1}{1 + e^{\frac{\pi}{-s}}} + \frac{1}{-1 + \left(-1 + \frac{\mathsf{fma}\left(-0.5, \frac{\pi \cdot \pi}{s}, -\pi\right)}{s}\right)}\right)}\right) \end{array} \]
(FPCore (u s)
 :precision binary32
 (*
  (- s)
  (log
   (+
    -1.0
    (/
     1.0
     (+
      (/ 1.0 (+ 1.0 (exp (/ (+ s (* 0.0 (/ s PI))) (* s (/ s PI))))))
      (*
       u
       (+
        (/ 1.0 (+ 1.0 (exp (/ PI (- s)))))
        (/
         1.0
         (+ -1.0 (+ -1.0 (/ (fma -0.5 (/ (* PI PI) s) (- PI)) s))))))))))))
float code(float u, float s) {
	return -s * logf((-1.0f + (1.0f / ((1.0f / (1.0f + expf(((s + (0.0f * (s / ((float) M_PI)))) / (s * (s / ((float) M_PI))))))) + (u * ((1.0f / (1.0f + expf((((float) M_PI) / -s)))) + (1.0f / (-1.0f + (-1.0f + (fmaf(-0.5f, ((((float) M_PI) * ((float) M_PI)) / s), -((float) M_PI)) / s))))))))));
}
function code(u, s)
	return Float32(Float32(-s) * log(Float32(Float32(-1.0) + Float32(Float32(1.0) / Float32(Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(s + Float32(Float32(0.0) * Float32(s / Float32(pi)))) / Float32(s * Float32(s / Float32(pi))))))) + Float32(u * Float32(Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(pi) / Float32(-s))))) + Float32(Float32(1.0) / Float32(Float32(-1.0) + Float32(Float32(-1.0) + Float32(fma(Float32(-0.5), Float32(Float32(Float32(pi) * Float32(pi)) / s), Float32(-Float32(pi))) / s)))))))))))
end
\begin{array}{l}

\\
\left(-s\right) \cdot \log \left(-1 + \frac{1}{\frac{1}{1 + e^{\frac{s + 0 \cdot \frac{s}{\pi}}{s \cdot \frac{s}{\pi}}}} + u \cdot \left(\frac{1}{1 + e^{\frac{\pi}{-s}}} + \frac{1}{-1 + \left(-1 + \frac{\mathsf{fma}\left(-0.5, \frac{\pi \cdot \pi}{s}, -\pi\right)}{s}\right)}\right)}\right)
\end{array}
Derivation
  1. Initial program 99.0%

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. frac-2negN/A

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\color{blue}{0 - \mathsf{PI}\left(\right)}}{\mathsf{neg}\left(s\right)}}}} - 1\right) \]
    3. div-subN/A

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0}{\mathsf{neg}\left(s\right)} - \color{blue}{\left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{s}\right)\right)}}}} - 1\right) \]
    5. clear-numN/A

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0}{\mathsf{neg}\left(s\right)} - \left(\mathsf{neg}\left(\color{blue}{\frac{1}{\frac{s}{\mathsf{PI}\left(\right)}}}\right)\right)}}} - 1\right) \]
    6. distribute-neg-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1}{\left(\mathsf{neg}\left(s\right)\right) \cdot \color{blue}{\frac{s}{\mathsf{PI}\left(\right)}}}}}} - 1\right) \]
    19. PI-lowering-PI.f3299.0

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\pi} - \left(-s\right) \cdot -1}{\left(-s\right) \cdot \frac{s}{\color{blue}{\pi}}}}}} - 1\right) \]
  4. Applied egg-rr99.0%

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

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

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + \left(1 - \color{blue}{\frac{-1 \cdot \mathsf{PI}\left(\right) + \frac{-1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{s}}{s}}\right)}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1}{\left(\mathsf{neg}\left(s\right)\right) \cdot \frac{s}{\mathsf{PI}\left(\right)}}}}} - 1\right) \]
    5. mul-1-negN/A

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

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

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

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

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

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + \left(1 - \frac{\mathsf{fma}\left(\frac{-1}{2}, \frac{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)}{s}, \color{blue}{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}\right)}{s}\right)}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1}{\left(\mathsf{neg}\left(s\right)\right) \cdot \frac{s}{\mathsf{PI}\left(\right)}}}}} - 1\right) \]
    14. PI-lowering-PI.f3297.3

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + \left(1 - \frac{\mathsf{fma}\left(-0.5, \frac{\pi \cdot \pi}{s}, -\color{blue}{\pi}\right)}{s}\right)}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\pi} - \left(-s\right) \cdot -1}{\left(-s\right) \cdot \frac{s}{\pi}}}}} - 1\right) \]
  7. Simplified97.3%

    \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + \color{blue}{\left(1 - \frac{\mathsf{fma}\left(-0.5, \frac{\pi \cdot \pi}{s}, -\pi\right)}{s}\right)}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\pi} - \left(-s\right) \cdot -1}{\left(-s\right) \cdot \frac{s}{\pi}}}}} - 1\right) \]
  8. Final simplification97.3%

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

Alternative 4: 97.6% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \left(-s\right) \cdot \log \left(-1 + \frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\pi}{-s}}} + \frac{1}{-1 - e^{\frac{\pi}{s}}}\right)}\right) \end{array} \]
(FPCore (u s)
 :precision binary32
 (*
  (- s)
  (log
   (+
    -1.0
    (/
     1.0
     (*
      u
      (+
       (/ 1.0 (+ 1.0 (exp (/ PI (- s)))))
       (/ 1.0 (- -1.0 (exp (/ PI s)))))))))))
float code(float u, float s) {
	return -s * logf((-1.0f + (1.0f / (u * ((1.0f / (1.0f + expf((((float) M_PI) / -s)))) + (1.0f / (-1.0f - expf((((float) M_PI) / s)))))))));
}
function code(u, s)
	return Float32(Float32(-s) * log(Float32(Float32(-1.0) + Float32(Float32(1.0) / Float32(u * Float32(Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(pi) / Float32(-s))))) + Float32(Float32(1.0) / Float32(Float32(-1.0) - exp(Float32(Float32(pi) / s))))))))))
end
function tmp = code(u, s)
	tmp = -s * log((single(-1.0) + (single(1.0) / (u * ((single(1.0) / (single(1.0) + exp((single(pi) / -s)))) + (single(1.0) / (single(-1.0) - exp((single(pi) / s)))))))));
end
\begin{array}{l}

\\
\left(-s\right) \cdot \log \left(-1 + \frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\pi}{-s}}} + \frac{1}{-1 - e^{\frac{\pi}{s}}}\right)}\right)
\end{array}
Derivation
  1. Initial program 99.0%

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

    \[\leadsto \left(\mathsf{neg}\left(s\right)\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. *-lowering-*.f32N/A

      \[\leadsto \left(\mathsf{neg}\left(s\right)\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) \]
    2. sub-negN/A

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

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \color{blue}{e^{-1 \cdot \frac{\mathsf{PI}\left(\right)}{s}}}} + \left(\mathsf{neg}\left(\frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)\right)\right)} - 1\right) \]
    7. mul-1-negN/A

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\color{blue}{\frac{\mathsf{PI}\left(\right)}{\mathsf{neg}\left(s\right)}}}} + \left(\mathsf{neg}\left(\frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)\right)\right)} - 1\right) \]
    9. mul-1-negN/A

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

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\color{blue}{\mathsf{PI}\left(\right)}}{-1 \cdot s}}} + \left(\mathsf{neg}\left(\frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)\right)\right)} - 1\right) \]
    12. mul-1-negN/A

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{\color{blue}{\mathsf{neg}\left(s\right)}}}} + \left(\mathsf{neg}\left(\frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)\right)\right)} - 1\right) \]
    14. distribute-neg-fracN/A

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

    \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{u \cdot \left(\frac{1}{1 + e^{\frac{\pi}{-s}}} + \frac{-1}{1 + e^{\frac{\pi}{s}}}\right)}} - 1\right) \]
  6. Final simplification97.0%

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

Alternative 5: 37.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{\frac{\pi}{s}}\\ \left(-s\right) \cdot \log \left(-1 + \frac{1}{\mathsf{fma}\left(\frac{1}{-1 - t\_0} + 0.5, u, \frac{1}{1 + t\_0}\right)}\right) \end{array} \end{array} \]
(FPCore (u s)
 :precision binary32
 (let* ((t_0 (exp (/ PI s))))
   (*
    (- s)
    (log
     (+
      -1.0
      (/ 1.0 (fma (+ (/ 1.0 (- -1.0 t_0)) 0.5) u (/ 1.0 (+ 1.0 t_0)))))))))
float code(float u, float s) {
	float t_0 = expf((((float) M_PI) / s));
	return -s * logf((-1.0f + (1.0f / fmaf(((1.0f / (-1.0f - t_0)) + 0.5f), u, (1.0f / (1.0f + t_0))))));
}
function code(u, s)
	t_0 = exp(Float32(Float32(pi) / s))
	return Float32(Float32(-s) * log(Float32(Float32(-1.0) + Float32(Float32(1.0) / fma(Float32(Float32(Float32(1.0) / Float32(Float32(-1.0) - t_0)) + Float32(0.5)), u, Float32(Float32(1.0) / Float32(Float32(1.0) + t_0)))))))
end
\begin{array}{l}

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

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. frac-2negN/A

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\color{blue}{0 - \mathsf{PI}\left(\right)}}{\mathsf{neg}\left(s\right)}}}} - 1\right) \]
    3. div-subN/A

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0}{\mathsf{neg}\left(s\right)} - \color{blue}{\left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{s}\right)\right)}}}} - 1\right) \]
    5. clear-numN/A

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0}{\mathsf{neg}\left(s\right)} - \left(\mathsf{neg}\left(\color{blue}{\frac{1}{\frac{s}{\mathsf{PI}\left(\right)}}}\right)\right)}}} - 1\right) \]
    6. distribute-neg-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1}{\left(\mathsf{neg}\left(s\right)\right) \cdot \color{blue}{\frac{s}{\mathsf{PI}\left(\right)}}}}}} - 1\right) \]
    19. PI-lowering-PI.f3299.0

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\pi} - \left(-s\right) \cdot -1}{\left(-s\right) \cdot \frac{s}{\color{blue}{\pi}}}}}} - 1\right) \]
  4. Applied egg-rr99.0%

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

    \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \color{blue}{1}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1}{\left(\mathsf{neg}\left(s\right)\right) \cdot \frac{s}{\mathsf{PI}\left(\right)}}}}} - 1\right) \]
  6. Step-by-step derivation
    1. Simplified37.9%

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \color{blue}{1}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\pi} - \left(-s\right) \cdot -1}{\left(-s\right) \cdot \frac{s}{\pi}}}}} - 1\right) \]
    2. Applied egg-rr37.9%

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{\mathsf{fma}\left(0.5 + \frac{-1}{1 + e^{\frac{\pi}{s}}}, u, \frac{1}{1 + e^{\frac{\pi}{s}}}\right)}} - 1\right) \]
    3. Final simplification37.9%

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

    Alternative 6: 36.8% accurate, 2.0× speedup?

    \[\begin{array}{l} \\ \left(-s\right) \cdot \log \left(-1 + \frac{1}{u \cdot \left(\frac{1}{-1 - e^{\frac{\pi}{s}}} + 0.5\right)}\right) \end{array} \]
    (FPCore (u s)
     :precision binary32
     (*
      (- s)
      (log (+ -1.0 (/ 1.0 (* u (+ (/ 1.0 (- -1.0 (exp (/ PI s)))) 0.5)))))))
    float code(float u, float s) {
    	return -s * logf((-1.0f + (1.0f / (u * ((1.0f / (-1.0f - expf((((float) M_PI) / s)))) + 0.5f)))));
    }
    
    function code(u, s)
    	return Float32(Float32(-s) * log(Float32(Float32(-1.0) + Float32(Float32(1.0) / Float32(u * Float32(Float32(Float32(1.0) / Float32(Float32(-1.0) - exp(Float32(Float32(pi) / s)))) + Float32(0.5)))))))
    end
    
    function tmp = code(u, s)
    	tmp = -s * log((single(-1.0) + (single(1.0) / (u * ((single(1.0) / (single(-1.0) - exp((single(pi) / s)))) + single(0.5))))));
    end
    
    \begin{array}{l}
    
    \\
    \left(-s\right) \cdot \log \left(-1 + \frac{1}{u \cdot \left(\frac{1}{-1 - e^{\frac{\pi}{s}}} + 0.5\right)}\right)
    \end{array}
    
    Derivation
    1. Initial program 99.0%

      \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. frac-2negN/A

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

        \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\color{blue}{0 - \mathsf{PI}\left(\right)}}{\mathsf{neg}\left(s\right)}}}} - 1\right) \]
      3. div-subN/A

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

        \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0}{\mathsf{neg}\left(s\right)} - \color{blue}{\left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{s}\right)\right)}}}} - 1\right) \]
      5. clear-numN/A

        \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0}{\mathsf{neg}\left(s\right)} - \left(\mathsf{neg}\left(\color{blue}{\frac{1}{\frac{s}{\mathsf{PI}\left(\right)}}}\right)\right)}}} - 1\right) \]
      6. distribute-neg-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1}{\left(\mathsf{neg}\left(s\right)\right) \cdot \color{blue}{\frac{s}{\mathsf{PI}\left(\right)}}}}}} - 1\right) \]
      19. PI-lowering-PI.f3299.0

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\pi} - \left(-s\right) \cdot -1}{\left(-s\right) \cdot \frac{s}{\color{blue}{\pi}}}}}} - 1\right) \]
    4. Applied egg-rr99.0%

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

      \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \color{blue}{1}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1}{\left(\mathsf{neg}\left(s\right)\right) \cdot \frac{s}{\mathsf{PI}\left(\right)}}}}} - 1\right) \]
    6. Step-by-step derivation
      1. Simplified37.9%

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(0.5 + \frac{-1}{1 + e^{\frac{\color{blue}{\pi}}{s}}}\right)} - 1\right) \]
      4. Simplified36.8%

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{u \cdot \left(0.5 + \frac{-1}{1 + e^{\frac{\pi}{s}}}\right)}} - 1\right) \]
      5. Final simplification36.8%

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

      Alternative 7: 24.9% accurate, 3.2× speedup?

      \[\begin{array}{l} \\ \left(-s\right) \cdot \log \left(-1 + \frac{1}{s \cdot \mathsf{fma}\left(\frac{s}{\pi \cdot \pi}, -2, \frac{1}{\pi}\right)}\right) \end{array} \]
      (FPCore (u s)
       :precision binary32
       (* (- s) (log (+ -1.0 (/ 1.0 (* s (fma (/ s (* PI PI)) -2.0 (/ 1.0 PI))))))))
      float code(float u, float s) {
      	return -s * logf((-1.0f + (1.0f / (s * fmaf((s / (((float) M_PI) * ((float) M_PI))), -2.0f, (1.0f / ((float) M_PI)))))));
      }
      
      function code(u, s)
      	return Float32(Float32(-s) * log(Float32(Float32(-1.0) + Float32(Float32(1.0) / Float32(s * fma(Float32(s / Float32(Float32(pi) * Float32(pi))), Float32(-2.0), Float32(Float32(1.0) / Float32(pi))))))))
      end
      
      \begin{array}{l}
      
      \\
      \left(-s\right) \cdot \log \left(-1 + \frac{1}{s \cdot \mathsf{fma}\left(\frac{s}{\pi \cdot \pi}, -2, \frac{1}{\pi}\right)}\right)
      \end{array}
      
      Derivation
      1. Initial program 99.0%

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

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{\color{blue}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        3. exp-lowering-exp.f32N/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        5. PI-lowering-PI.f326.6

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\frac{\color{blue}{\pi}}{s}}}} - 1\right) \]
      5. Simplified6.6%

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \color{blue}{\left(1 + \frac{\mathsf{PI}\left(\right)}{s}\right)}}} - 1\right) \]
        2. /-lowering-/.f32N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}\right)}} - 1\right) \]
        3. PI-lowering-PI.f3225.1

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{\color{blue}{\pi}}{s}\right)}} - 1\right) \]
      8. Simplified25.1%

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \color{blue}{\left(1 + \frac{\pi}{s}\right)}}} - 1\right) \]
      9. Taylor expanded in s around 0

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

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{s \cdot \color{blue}{\mathsf{fma}\left(\frac{s}{{\mathsf{PI}\left(\right)}^{2}}, -2, \frac{1}{\mathsf{PI}\left(\right)}\right)}} - 1\right) \]
        4. /-lowering-/.f32N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{s \cdot \mathsf{fma}\left(\color{blue}{\frac{s}{{\mathsf{PI}\left(\right)}^{2}}}, -2, \frac{1}{\mathsf{PI}\left(\right)}\right)} - 1\right) \]
        5. unpow2N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{s \cdot \mathsf{fma}\left(\frac{s}{\color{blue}{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)}}, -2, \frac{1}{\mathsf{PI}\left(\right)}\right)} - 1\right) \]
        6. *-lowering-*.f32N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{s \cdot \mathsf{fma}\left(\frac{s}{\color{blue}{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)}}, -2, \frac{1}{\mathsf{PI}\left(\right)}\right)} - 1\right) \]
        7. PI-lowering-PI.f32N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{s \cdot \mathsf{fma}\left(\frac{s}{\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)}, -2, \frac{1}{\mathsf{PI}\left(\right)}\right)} - 1\right) \]
        8. PI-lowering-PI.f32N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{s \cdot \mathsf{fma}\left(\frac{s}{\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}}, -2, \frac{1}{\mathsf{PI}\left(\right)}\right)} - 1\right) \]
        9. /-lowering-/.f32N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{s \cdot \mathsf{fma}\left(\frac{s}{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)}, -2, \color{blue}{\frac{1}{\mathsf{PI}\left(\right)}}\right)} - 1\right) \]
        10. PI-lowering-PI.f3225.1

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{s \cdot \mathsf{fma}\left(\frac{s}{\pi \cdot \pi}, -2, \frac{1}{\color{blue}{\pi}}\right)} - 1\right) \]
      11. Simplified25.1%

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\color{blue}{s \cdot \mathsf{fma}\left(\frac{s}{\pi \cdot \pi}, -2, \frac{1}{\pi}\right)}} - 1\right) \]
      12. Final simplification25.1%

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

      Alternative 8: 24.9% accurate, 4.1× speedup?

      \[\begin{array}{l} \\ \left(-s\right) \cdot \log \left(\mathsf{fma}\left(\frac{1}{s}, \pi, 1\right)\right) \end{array} \]
      (FPCore (u s) :precision binary32 (* (- s) (log (fma (/ 1.0 s) PI 1.0))))
      float code(float u, float s) {
      	return -s * logf(fmaf((1.0f / s), ((float) M_PI), 1.0f));
      }
      
      function code(u, s)
      	return Float32(Float32(-s) * log(fma(Float32(Float32(1.0) / s), Float32(pi), Float32(1.0))))
      end
      
      \begin{array}{l}
      
      \\
      \left(-s\right) \cdot \log \left(\mathsf{fma}\left(\frac{1}{s}, \pi, 1\right)\right)
      \end{array}
      
      Derivation
      1. Initial program 99.0%

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

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{\color{blue}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        3. exp-lowering-exp.f32N/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        5. PI-lowering-PI.f326.6

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\frac{\color{blue}{\pi}}{s}}}} - 1\right) \]
      5. Simplified6.6%

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \color{blue}{\left(1 + \frac{\mathsf{PI}\left(\right)}{s}\right)}}} - 1\right) \]
        2. /-lowering-/.f32N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}\right)}} - 1\right) \]
        3. PI-lowering-PI.f3225.1

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{\color{blue}{\pi}}{s}\right)}} - 1\right) \]
      8. Simplified25.1%

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \color{blue}{\left(1 + \frac{\pi}{s}\right)}}} - 1\right) \]
      9. Step-by-step derivation
        1. *-un-lft-identityN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{\color{blue}{1 \cdot \mathsf{PI}\left(\right)}}{s}\right)}} - 1\right) \]
        2. remove-double-negN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(s\right)\right)\right)}}\right)}} - 1\right) \]
        3. neg-mul-1N/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\color{blue}{\left(\mathsf{neg}\left(s\right)\right) \cdot -1}}\right)}} - 1\right) \]
        5. +-lft-identityN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\color{blue}{0 + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}}\right)}} - 1\right) \]
        6. mul0-lftN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\color{blue}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)}} + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}\right)}} - 1\right) \]
        7. *-commutativeN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \color{blue}{-1 \cdot \left(\mathsf{neg}\left(s\right)\right)}}\right)}} - 1\right) \]
        8. neg-mul-1N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(s\right)\right)\right)\right)}}\right)}} - 1\right) \]
        9. remove-double-negN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \color{blue}{s}}\right)}} - 1\right) \]
        10. flip-+N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\color{blue}{\frac{\left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)}\right) \cdot \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)}\right) - s \cdot s}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - s}}}\right)}} - 1\right) \]
        11. mul0-lftN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\frac{\color{blue}{0} \cdot \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)}\right) - s \cdot s}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - s}}\right)}} - 1\right) \]
        12. mul0-lftN/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\frac{\color{blue}{0} - s \cdot s}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - s}}\right)}} - 1\right) \]
        14. neg-sub0N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\frac{\color{blue}{\mathsf{neg}\left(s \cdot s\right)}}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - s}}\right)}} - 1\right) \]
        15. mul0-lftN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\frac{\mathsf{neg}\left(s \cdot s\right)}{\color{blue}{0} - s}}\right)}} - 1\right) \]
        16. neg-sub0N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\frac{\mathsf{neg}\left(s \cdot s\right)}{\color{blue}{\mathsf{neg}\left(s\right)}}}\right)}} - 1\right) \]
        17. associate-*l/N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \color{blue}{\frac{1}{\frac{\mathsf{neg}\left(s \cdot s\right)}{\mathsf{neg}\left(s\right)}} \cdot \mathsf{PI}\left(\right)}\right)}} - 1\right) \]
        18. clear-numN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \color{blue}{\frac{\mathsf{neg}\left(s\right)}{\mathsf{neg}\left(s \cdot s\right)}} \cdot \mathsf{PI}\left(\right)\right)}} - 1\right) \]
      10. Applied egg-rr17.1%

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \color{blue}{\frac{s}{\frac{s \cdot s}{\pi}}}\right)}} - 1\right) \]
      11. Applied egg-rr25.1%

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

      Alternative 9: 24.9% accurate, 4.2× speedup?

      \[\begin{array}{l} \\ \left(-s\right) \cdot \log \left(\frac{s + \pi}{s}\right) \end{array} \]
      (FPCore (u s) :precision binary32 (* (- s) (log (/ (+ s PI) s))))
      float code(float u, float s) {
      	return -s * logf(((s + ((float) M_PI)) / s));
      }
      
      function code(u, s)
      	return Float32(Float32(-s) * log(Float32(Float32(s + Float32(pi)) / s)))
      end
      
      function tmp = code(u, s)
      	tmp = -s * log(((s + single(pi)) / s));
      end
      
      \begin{array}{l}
      
      \\
      \left(-s\right) \cdot \log \left(\frac{s + \pi}{s}\right)
      \end{array}
      
      Derivation
      1. Initial program 99.0%

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

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{\color{blue}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        3. exp-lowering-exp.f32N/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        5. PI-lowering-PI.f326.6

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\frac{\color{blue}{\pi}}{s}}}} - 1\right) \]
      5. Simplified6.6%

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \color{blue}{\left(1 + \frac{\mathsf{PI}\left(\right)}{s}\right)}}} - 1\right) \]
        2. /-lowering-/.f32N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}\right)}} - 1\right) \]
        3. PI-lowering-PI.f3225.1

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{\color{blue}{\pi}}{s}\right)}} - 1\right) \]
      8. Simplified25.1%

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \color{blue}{\left(1 + \frac{\pi}{s}\right)}}} - 1\right) \]
      9. Taylor expanded in s around 0

        \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \color{blue}{\left(\frac{s + \mathsf{PI}\left(\right)}{s}\right)} \]
      10. Step-by-step derivation
        1. /-lowering-/.f32N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \color{blue}{\left(\frac{s + \mathsf{PI}\left(\right)}{s}\right)} \]
        2. +-commutativeN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{\color{blue}{\mathsf{PI}\left(\right) + s}}{s}\right) \]
        3. +-lowering-+.f32N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{\color{blue}{\mathsf{PI}\left(\right) + s}}{s}\right) \]
        4. PI-lowering-PI.f3225.1

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{\color{blue}{\pi} + s}{s}\right) \]
      11. Simplified25.1%

        \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\frac{\pi + s}{s}\right)} \]
      12. Final simplification25.1%

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{s + \pi}{s}\right) \]
      13. Add Preprocessing

      Alternative 10: 24.9% accurate, 4.3× speedup?

      \[\begin{array}{l} \\ \left(-s\right) \cdot \mathsf{log1p}\left(\frac{\pi}{s}\right) \end{array} \]
      (FPCore (u s) :precision binary32 (* (- s) (log1p (/ PI s))))
      float code(float u, float s) {
      	return -s * log1pf((((float) M_PI) / s));
      }
      
      function code(u, s)
      	return Float32(Float32(-s) * log1p(Float32(Float32(pi) / s)))
      end
      
      \begin{array}{l}
      
      \\
      \left(-s\right) \cdot \mathsf{log1p}\left(\frac{\pi}{s}\right)
      \end{array}
      
      Derivation
      1. Initial program 99.0%

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

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{\color{blue}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        3. exp-lowering-exp.f32N/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        5. PI-lowering-PI.f326.6

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\frac{\color{blue}{\pi}}{s}}}} - 1\right) \]
      5. Simplified6.6%

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \color{blue}{\left(1 + \frac{\mathsf{PI}\left(\right)}{s}\right)}}} - 1\right) \]
        2. /-lowering-/.f32N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}\right)}} - 1\right) \]
        3. PI-lowering-PI.f3225.1

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{\color{blue}{\pi}}{s}\right)}} - 1\right) \]
      8. Simplified25.1%

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \color{blue}{\left(1 + \frac{\pi}{s}\right)}}} - 1\right) \]
      9. Step-by-step derivation
        1. *-un-lft-identityN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{\color{blue}{1 \cdot \mathsf{PI}\left(\right)}}{s}\right)}} - 1\right) \]
        2. remove-double-negN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(s\right)\right)\right)}}\right)}} - 1\right) \]
        3. neg-mul-1N/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\color{blue}{\left(\mathsf{neg}\left(s\right)\right) \cdot -1}}\right)}} - 1\right) \]
        5. +-lft-identityN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\color{blue}{0 + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}}\right)}} - 1\right) \]
        6. mul0-lftN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\color{blue}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)}} + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}\right)}} - 1\right) \]
        7. *-commutativeN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \color{blue}{-1 \cdot \left(\mathsf{neg}\left(s\right)\right)}}\right)}} - 1\right) \]
        8. neg-mul-1N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(s\right)\right)\right)\right)}}\right)}} - 1\right) \]
        9. remove-double-negN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \color{blue}{s}}\right)}} - 1\right) \]
        10. flip-+N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\color{blue}{\frac{\left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)}\right) \cdot \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)}\right) - s \cdot s}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - s}}}\right)}} - 1\right) \]
        11. mul0-lftN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\frac{\color{blue}{0} \cdot \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)}\right) - s \cdot s}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - s}}\right)}} - 1\right) \]
        12. mul0-lftN/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\frac{\color{blue}{0} - s \cdot s}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - s}}\right)}} - 1\right) \]
        14. neg-sub0N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\frac{\color{blue}{\mathsf{neg}\left(s \cdot s\right)}}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - s}}\right)}} - 1\right) \]
        15. mul0-lftN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\frac{\mathsf{neg}\left(s \cdot s\right)}{\color{blue}{0} - s}}\right)}} - 1\right) \]
        16. neg-sub0N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{1 \cdot \mathsf{PI}\left(\right)}{\frac{\mathsf{neg}\left(s \cdot s\right)}{\color{blue}{\mathsf{neg}\left(s\right)}}}\right)}} - 1\right) \]
        17. associate-*l/N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \color{blue}{\frac{1}{\frac{\mathsf{neg}\left(s \cdot s\right)}{\mathsf{neg}\left(s\right)}} \cdot \mathsf{PI}\left(\right)}\right)}} - 1\right) \]
        18. clear-numN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \color{blue}{\frac{\mathsf{neg}\left(s\right)}{\mathsf{neg}\left(s \cdot s\right)}} \cdot \mathsf{PI}\left(\right)\right)}} - 1\right) \]
      10. Applied egg-rr17.1%

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \color{blue}{\frac{s}{\frac{s \cdot s}{\pi}}}\right)}} - 1\right) \]
      11. Applied egg-rr25.1%

        \[\leadsto \left(-s\right) \cdot \color{blue}{\mathsf{log1p}\left(\frac{\pi}{s}\right)} \]
      12. Add Preprocessing

      Alternative 11: 24.9% accurate, 4.3× speedup?

      \[\begin{array}{l} \\ \left(-s\right) \cdot \log \left(\frac{\pi}{s}\right) \end{array} \]
      (FPCore (u s) :precision binary32 (* (- s) (log (/ PI s))))
      float code(float u, float s) {
      	return -s * logf((((float) M_PI) / s));
      }
      
      function code(u, s)
      	return Float32(Float32(-s) * log(Float32(Float32(pi) / s)))
      end
      
      function tmp = code(u, s)
      	tmp = -s * log((single(pi) / s));
      end
      
      \begin{array}{l}
      
      \\
      \left(-s\right) \cdot \log \left(\frac{\pi}{s}\right)
      \end{array}
      
      Derivation
      1. Initial program 99.0%

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

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{\color{blue}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        3. exp-lowering-exp.f32N/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        5. PI-lowering-PI.f326.6

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\frac{\color{blue}{\pi}}{s}}}} - 1\right) \]
      5. Simplified6.6%

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \color{blue}{\left(1 + \frac{\mathsf{PI}\left(\right)}{s}\right)}}} - 1\right) \]
        2. /-lowering-/.f32N/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}\right)}} - 1\right) \]
        3. PI-lowering-PI.f3225.1

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \left(1 + \frac{\color{blue}{\pi}}{s}\right)}} - 1\right) \]
      8. Simplified25.1%

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + \color{blue}{\left(1 + \frac{\pi}{s}\right)}}} - 1\right) \]
      9. Taylor expanded in s around 0

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{s}\right)} \]
        2. PI-lowering-PI.f3225.1

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{\color{blue}{\pi}}{s}\right) \]
      11. Simplified25.1%

        \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(\frac{\pi}{s}\right)} \]
      12. Add Preprocessing

      Alternative 12: 13.8% accurate, 13.4× speedup?

      \[\begin{array}{l} \\ \frac{\pi}{s} \cdot \left(\left(s \cdot s\right) \cdot \frac{-1}{s}\right) \end{array} \]
      (FPCore (u s) :precision binary32 (* (/ PI s) (* (* s s) (/ -1.0 s))))
      float code(float u, float s) {
      	return (((float) M_PI) / s) * ((s * s) * (-1.0f / s));
      }
      
      function code(u, s)
      	return Float32(Float32(Float32(pi) / s) * Float32(Float32(s * s) * Float32(Float32(-1.0) / s)))
      end
      
      function tmp = code(u, s)
      	tmp = (single(pi) / s) * ((s * s) * (single(-1.0) / s));
      end
      
      \begin{array}{l}
      
      \\
      \frac{\pi}{s} \cdot \left(\left(s \cdot s\right) \cdot \frac{-1}{s}\right)
      \end{array}
      
      Derivation
      1. Initial program 99.0%

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

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{\color{blue}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        3. exp-lowering-exp.f32N/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        5. PI-lowering-PI.f326.6

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\frac{\color{blue}{\pi}}{s}}}} - 1\right) \]
      5. Simplified6.6%

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

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

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

          \[\leadsto \left(-s\right) \cdot \frac{\color{blue}{\pi}}{s} \]
      8. Simplified11.9%

        \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\pi}{s}} \]
      9. Step-by-step derivation
        1. neg-mul-1N/A

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

          \[\leadsto \color{blue}{\left(s \cdot -1\right)} \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        3. +-lft-identityN/A

          \[\leadsto \color{blue}{\left(0 + s \cdot -1\right)} \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        4. mul0-lftN/A

          \[\leadsto \left(\color{blue}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)}} + s \cdot -1\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        5. cancel-sign-subN/A

          \[\leadsto \color{blue}{\left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1\right)} \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        6. flip--N/A

          \[\leadsto \color{blue}{\frac{\left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)}\right) \cdot \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)}\right) - \left(\left(\mathsf{neg}\left(s\right)\right) \cdot -1\right) \cdot \left(\left(\mathsf{neg}\left(s\right)\right) \cdot -1\right)}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}} \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        7. div-invN/A

          \[\leadsto \color{blue}{\left(\left(\left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)}\right) \cdot \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)}\right) - \left(\left(\mathsf{neg}\left(s\right)\right) \cdot -1\right) \cdot \left(\left(\mathsf{neg}\left(s\right)\right) \cdot -1\right)\right) \cdot \frac{1}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}\right)} \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        8. mul0-lftN/A

          \[\leadsto \left(\left(\color{blue}{0} \cdot \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)}\right) - \left(\left(\mathsf{neg}\left(s\right)\right) \cdot -1\right) \cdot \left(\left(\mathsf{neg}\left(s\right)\right) \cdot -1\right)\right) \cdot \frac{1}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        9. mul0-lftN/A

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

          \[\leadsto \left(\left(\color{blue}{0} - \left(\left(\mathsf{neg}\left(s\right)\right) \cdot -1\right) \cdot \left(\left(\mathsf{neg}\left(s\right)\right) \cdot -1\right)\right) \cdot \frac{1}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        11. sub0-negN/A

          \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(s\right)\right) \cdot -1\right) \cdot \left(\left(\mathsf{neg}\left(s\right)\right) \cdot -1\right)\right)\right)} \cdot \frac{1}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        12. pow2N/A

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

          \[\leadsto \left(\left(\mathsf{neg}\left({\color{blue}{\left(-1 \cdot \left(\mathsf{neg}\left(s\right)\right)\right)}}^{2}\right)\right) \cdot \frac{1}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        14. neg-mul-1N/A

          \[\leadsto \left(\left(\mathsf{neg}\left({\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(s\right)\right)\right)\right)}}^{2}\right)\right) \cdot \frac{1}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        15. remove-double-negN/A

          \[\leadsto \left(\left(\mathsf{neg}\left({\color{blue}{s}}^{2}\right)\right) \cdot \frac{1}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        16. pow2N/A

          \[\leadsto \left(\left(\mathsf{neg}\left(\color{blue}{s \cdot s}\right)\right) \cdot \frac{1}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        17. mul0-lftN/A

          \[\leadsto \left(\left(\mathsf{neg}\left(s \cdot s\right)\right) \cdot \frac{1}{\color{blue}{0} + \left(\mathsf{neg}\left(s\right)\right) \cdot -1}\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        18. +-lft-identityN/A

          \[\leadsto \left(\left(\mathsf{neg}\left(s \cdot s\right)\right) \cdot \frac{1}{\color{blue}{\left(\mathsf{neg}\left(s\right)\right) \cdot -1}}\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        19. *-commutativeN/A

          \[\leadsto \left(\left(\mathsf{neg}\left(s \cdot s\right)\right) \cdot \frac{1}{\color{blue}{-1 \cdot \left(\mathsf{neg}\left(s\right)\right)}}\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        20. neg-mul-1N/A

          \[\leadsto \left(\left(\mathsf{neg}\left(s \cdot s\right)\right) \cdot \frac{1}{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(s\right)\right)\right)}}\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
      10. Applied egg-rr14.5%

        \[\leadsto \color{blue}{\left(\left(s \cdot \left(-s\right)\right) \cdot \frac{1}{s}\right)} \cdot \frac{\pi}{s} \]
      11. Final simplification14.5%

        \[\leadsto \frac{\pi}{s} \cdot \left(\left(s \cdot s\right) \cdot \frac{-1}{s}\right) \]
      12. Add Preprocessing

      Alternative 13: 13.8% accurate, 14.6× speedup?

      \[\begin{array}{l} \\ \frac{\pi}{-s} \cdot \frac{s \cdot s}{s} \end{array} \]
      (FPCore (u s) :precision binary32 (* (/ PI (- s)) (/ (* s s) s)))
      float code(float u, float s) {
      	return (((float) M_PI) / -s) * ((s * s) / s);
      }
      
      function code(u, s)
      	return Float32(Float32(Float32(pi) / Float32(-s)) * Float32(Float32(s * s) / s))
      end
      
      function tmp = code(u, s)
      	tmp = (single(pi) / -s) * ((s * s) / s);
      end
      
      \begin{array}{l}
      
      \\
      \frac{\pi}{-s} \cdot \frac{s \cdot s}{s}
      \end{array}
      
      Derivation
      1. Initial program 99.0%

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

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{\color{blue}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        3. exp-lowering-exp.f32N/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        5. PI-lowering-PI.f326.6

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\frac{\color{blue}{\pi}}{s}}}} - 1\right) \]
      5. Simplified6.6%

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

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

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

          \[\leadsto \left(-s\right) \cdot \frac{\color{blue}{\pi}}{s} \]
      8. Simplified11.9%

        \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\pi}{s}} \]
      9. Step-by-step derivation
        1. neg-mul-1N/A

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

          \[\leadsto \color{blue}{\left(s \cdot -1\right)} \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        3. +-lft-identityN/A

          \[\leadsto \color{blue}{\left(0 + s \cdot -1\right)} \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        4. mul0-lftN/A

          \[\leadsto \left(\color{blue}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)}} + s \cdot -1\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        5. +-lft-identityN/A

          \[\leadsto \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \color{blue}{\left(0 + s \cdot -1\right)}\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        6. mul0-lftN/A

          \[\leadsto \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \left(\color{blue}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)}} + s \cdot -1\right)\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        7. cancel-sign-subN/A

          \[\leadsto \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)} + \color{blue}{\left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1\right)}\right) \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
        8. flip-+N/A

          \[\leadsto \color{blue}{\frac{\left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)}\right) \cdot \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)}\right) - \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1\right) \cdot \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1\right)}{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1\right)}} \cdot \frac{\mathsf{PI}\left(\right)}{s} \]
      10. Applied egg-rr14.5%

        \[\leadsto \color{blue}{\frac{s \cdot \left(-s\right)}{s}} \cdot \frac{\pi}{s} \]
      11. Final simplification14.5%

        \[\leadsto \frac{\pi}{-s} \cdot \frac{s \cdot s}{s} \]
      12. Add Preprocessing

      Alternative 14: 11.5% accurate, 26.8× speedup?

      \[\begin{array}{l} \\ \mathsf{fma}\left(u \cdot \left(\pi \cdot 0.5\right), 4, -\pi\right) \end{array} \]
      (FPCore (u s) :precision binary32 (fma (* u (* PI 0.5)) 4.0 (- PI)))
      float code(float u, float s) {
      	return fmaf((u * (((float) M_PI) * 0.5f)), 4.0f, -((float) M_PI));
      }
      
      function code(u, s)
      	return fma(Float32(u * Float32(Float32(pi) * Float32(0.5))), Float32(4.0), Float32(-Float32(pi)))
      end
      
      \begin{array}{l}
      
      \\
      \mathsf{fma}\left(u \cdot \left(\pi \cdot 0.5\right), 4, -\pi\right)
      \end{array}
      
      Derivation
      1. Initial program 99.0%

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

        \[\leadsto \color{blue}{-1 \cdot \mathsf{PI}\left(\right) + \frac{s \cdot \left(u \cdot \left({\left(1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}^{2} \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)\right)\right)}{e^{\frac{\mathsf{PI}\left(\right)}{s}}}} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

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

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

          \[\leadsto \color{blue}{\left(u \cdot \left({\left(1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}^{2} \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)\right)\right) \cdot \frac{s}{e^{\frac{\mathsf{PI}\left(\right)}{s}}}} + -1 \cdot \mathsf{PI}\left(\right) \]
        4. accelerator-lowering-fma.f32N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(u \cdot \left({\left(1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}\right)}^{2} \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)\right), \frac{s}{e^{\frac{\mathsf{PI}\left(\right)}{s}}}, -1 \cdot \mathsf{PI}\left(\right)\right)} \]
      5. Simplified2.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\frac{1}{1 + e^{\frac{\pi}{-s}}} + \frac{-1}{1 + e^{\frac{\pi}{s}}}\right) \cdot \left(u \cdot {\left(1 + e^{\frac{\pi}{s}}\right)}^{2}\right), \frac{s}{e^{\frac{\pi}{s}}}, -\pi\right)} \]
      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)\right) - \mathsf{PI}\left(\right)} \]
      7. Step-by-step derivation
        1. sub-negN/A

          \[\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)\right) + \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right)} \]
        2. *-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)\right) \cdot 4} + \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \]
        3. accelerator-lowering-fma.f32N/A

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(u \cdot \left(\mathsf{PI}\left(\right) \cdot \frac{1}{2}\right), 4, \color{blue}{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}\right) \]
        10. PI-lowering-PI.f3212.1

          \[\leadsto \mathsf{fma}\left(u \cdot \left(\pi \cdot 0.5\right), 4, -\color{blue}{\pi}\right) \]
      8. Simplified12.1%

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

      Alternative 15: 11.3% accurate, 26.8× speedup?

      \[\begin{array}{l} \\ s \cdot \frac{\pi}{-s} \end{array} \]
      (FPCore (u s) :precision binary32 (* s (/ PI (- s))))
      float code(float u, float s) {
      	return s * (((float) M_PI) / -s);
      }
      
      function code(u, s)
      	return Float32(s * Float32(Float32(pi) / Float32(-s)))
      end
      
      function tmp = code(u, s)
      	tmp = s * (single(pi) / -s);
      end
      
      \begin{array}{l}
      
      \\
      s \cdot \frac{\pi}{-s}
      \end{array}
      
      Derivation
      1. Initial program 99.0%

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

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{\color{blue}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        3. exp-lowering-exp.f32N/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\color{blue}{\frac{\mathsf{PI}\left(\right)}{s}}}}} - 1\right) \]
        5. PI-lowering-PI.f326.6

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{1}{1 + e^{\frac{\color{blue}{\pi}}{s}}}} - 1\right) \]
      5. Simplified6.6%

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

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

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

          \[\leadsto \left(-s\right) \cdot \frac{\color{blue}{\pi}}{s} \]
      8. Simplified11.9%

        \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\pi}{s}} \]
      9. Final simplification11.9%

        \[\leadsto s \cdot \frac{\pi}{-s} \]
      10. Add Preprocessing

      Alternative 16: 11.3% accurate, 30.0× speedup?

      \[\begin{array}{l} \\ \left(\pi \cdot \mathsf{fma}\left(-0.25, u, 0.25\right)\right) \cdot -4 \end{array} \]
      (FPCore (u s) :precision binary32 (* (* PI (fma -0.25 u 0.25)) -4.0))
      float code(float u, float s) {
      	return (((float) M_PI) * fmaf(-0.25f, u, 0.25f)) * -4.0f;
      }
      
      function code(u, s)
      	return Float32(Float32(Float32(pi) * fma(Float32(-0.25), u, Float32(0.25))) * Float32(-4.0))
      end
      
      \begin{array}{l}
      
      \\
      \left(\pi \cdot \mathsf{fma}\left(-0.25, u, 0.25\right)\right) \cdot -4
      \end{array}
      
      Derivation
      1. Initial program 99.0%

        \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. frac-2negN/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\color{blue}{0 - \mathsf{PI}\left(\right)}}{\mathsf{neg}\left(s\right)}}}} - 1\right) \]
        3. div-subN/A

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0}{\mathsf{neg}\left(s\right)} - \color{blue}{\left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{s}\right)\right)}}}} - 1\right) \]
        5. clear-numN/A

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0}{\mathsf{neg}\left(s\right)} - \left(\mathsf{neg}\left(\color{blue}{\frac{1}{\frac{s}{\mathsf{PI}\left(\right)}}}\right)\right)}}} - 1\right) \]
        6. distribute-neg-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1}{\left(\mathsf{neg}\left(s\right)\right) \cdot \color{blue}{\frac{s}{\mathsf{PI}\left(\right)}}}}}} - 1\right) \]
        19. PI-lowering-PI.f3299.0

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\pi} - \left(-s\right) \cdot -1}{\left(-s\right) \cdot \frac{s}{\color{blue}{\pi}}}}}} - 1\right) \]
      4. Applied egg-rr99.0%

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

        \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \color{blue}{1}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1}{\left(\mathsf{neg}\left(s\right)\right) \cdot \frac{s}{\mathsf{PI}\left(\right)}}}}} - 1\right) \]
      6. Step-by-step derivation
        1. Simplified37.9%

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

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

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

            \[\leadsto \color{blue}{\left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) \cdot -4} \]
          3. cancel-sign-sub-invN/A

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

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

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

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

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

            \[\leadsto \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \left(\frac{-1}{4} \cdot u + \frac{1}{4}\right)\right) \cdot -4 \]
          9. accelerator-lowering-fma.f3211.9

            \[\leadsto \left(\pi \cdot \color{blue}{\mathsf{fma}\left(-0.25, u, 0.25\right)}\right) \cdot -4 \]
        4. Simplified11.9%

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

        Alternative 17: 11.3% accurate, 56.7× speedup?

        \[\begin{array}{l} \\ \mathsf{fma}\left(u, \pi, -\pi\right) \end{array} \]
        (FPCore (u s) :precision binary32 (fma u PI (- PI)))
        float code(float u, float s) {
        	return fmaf(u, ((float) M_PI), -((float) M_PI));
        }
        
        function code(u, s)
        	return fma(u, Float32(pi), Float32(-Float32(pi)))
        end
        
        \begin{array}{l}
        
        \\
        \mathsf{fma}\left(u, \pi, -\pi\right)
        \end{array}
        
        Derivation
        1. Initial program 99.0%

          \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. frac-2negN/A

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

            \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{\color{blue}{0 - \mathsf{PI}\left(\right)}}{\mathsf{neg}\left(s\right)}}}} - 1\right) \]
          3. div-subN/A

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

            \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0}{\mathsf{neg}\left(s\right)} - \color{blue}{\left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{s}\right)\right)}}}} - 1\right) \]
          5. clear-numN/A

            \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0}{\mathsf{neg}\left(s\right)} - \left(\mathsf{neg}\left(\color{blue}{\frac{1}{\frac{s}{\mathsf{PI}\left(\right)}}}\right)\right)}}} - 1\right) \]
          6. distribute-neg-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1}{\left(\mathsf{neg}\left(s\right)\right) \cdot \color{blue}{\frac{s}{\mathsf{PI}\left(\right)}}}}}} - 1\right) \]
          19. PI-lowering-PI.f3299.0

            \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\pi} - \left(-s\right) \cdot -1}{\left(-s\right) \cdot \frac{s}{\color{blue}{\pi}}}}}} - 1\right) \]
        4. Applied egg-rr99.0%

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

          \[\leadsto \left(\mathsf{neg}\left(s\right)\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \color{blue}{1}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{0 \cdot \frac{s}{\mathsf{PI}\left(\right)} - \left(\mathsf{neg}\left(s\right)\right) \cdot -1}{\left(\mathsf{neg}\left(s\right)\right) \cdot \frac{s}{\mathsf{PI}\left(\right)}}}}} - 1\right) \]
        6. Step-by-step derivation
          1. Simplified37.9%

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

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

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

              \[\leadsto \color{blue}{\left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) \cdot -4} \]
            3. cancel-sign-sub-invN/A

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

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

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

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

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

              \[\leadsto \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \left(\frac{-1}{4} \cdot u + \frac{1}{4}\right)\right) \cdot -4 \]
            9. accelerator-lowering-fma.f3211.9

              \[\leadsto \left(\pi \cdot \color{blue}{\mathsf{fma}\left(-0.25, u, 0.25\right)}\right) \cdot -4 \]
          4. Simplified11.9%

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

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

              \[\leadsto \color{blue}{u \cdot \mathsf{PI}\left(\right) + -1 \cdot \mathsf{PI}\left(\right)} \]
            2. accelerator-lowering-fma.f32N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(u, \mathsf{PI}\left(\right), -1 \cdot \mathsf{PI}\left(\right)\right)} \]
            3. PI-lowering-PI.f32N/A

              \[\leadsto \mathsf{fma}\left(u, \color{blue}{\mathsf{PI}\left(\right)}, -1 \cdot \mathsf{PI}\left(\right)\right) \]
            4. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(u, \mathsf{PI}\left(\right), \color{blue}{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}\right) \]
            5. neg-lowering-neg.f32N/A

              \[\leadsto \mathsf{fma}\left(u, \mathsf{PI}\left(\right), \color{blue}{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}\right) \]
            6. PI-lowering-PI.f3211.9

              \[\leadsto \mathsf{fma}\left(u, \pi, -\color{blue}{\pi}\right) \]
          7. Simplified11.9%

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

          Alternative 18: 11.3% accurate, 170.0× speedup?

          \[\begin{array}{l} \\ -\pi \end{array} \]
          (FPCore (u s) :precision binary32 (- PI))
          float code(float u, float s) {
          	return -((float) M_PI);
          }
          
          function code(u, s)
          	return Float32(-Float32(pi))
          end
          
          function tmp = code(u, s)
          	tmp = -single(pi);
          end
          
          \begin{array}{l}
          
          \\
          -\pi
          \end{array}
          
          Derivation
          1. Initial program 99.0%

            \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{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. neg-lowering-neg.f32N/A

              \[\leadsto \color{blue}{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)} \]
            3. PI-lowering-PI.f3211.9

              \[\leadsto -\color{blue}{\pi} \]
          5. Simplified11.9%

            \[\leadsto \color{blue}{-\pi} \]
          6. Add Preprocessing

          Reproduce

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