Sample trimmed logistic on [-pi, pi]

Percentage Accurate: 98.9% → 99.0%
Time: 23.6s
Alternatives: 20
Speedup: 0.7×

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 20 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: 99.0% accurate, 0.7× speedup?

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

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

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
  2. Simplified98.8%

    \[\leadsto \color{blue}{\left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{1 + e^{0 - \frac{\pi}{s}}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. flip-+N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \log \left(\frac{1}{\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} \cdot \frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1 \cdot -1}}\right)\right) \]
    3. log-recN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \left(\mathsf{neg}\left(\log \left(\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} \cdot \frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1 \cdot -1}\right)\right)\right)\right) \]
  5. Applied egg-rr98.9%

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

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

Alternative 2: 98.8% accurate, 0.8× speedup?

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

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

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
  2. Simplified98.8%

    \[\leadsto \color{blue}{\left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{1 + e^{0 - \frac{\pi}{s}}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. div-invN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\left(\mathsf{fma}\left(1, \frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}}, -1\right)\right)\right)\right) \]
    3. metadata-evalN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\left(\mathsf{fma}\left(1, \frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}}, \mathsf{neg}\left(1\right)\right)\right)\right)\right) \]
    4. fmm-defN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\left(1 \cdot \frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - 1\right)\right)\right) \]
    5. div-invN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\left(\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - 1\right)\right)\right) \]
    6. inv-powN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\left({\left(\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}^{-1} - 1\right)\right)\right) \]
    7. pow-to-expN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\left(e^{\log \left(\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) \cdot -1} - 1\right)\right)\right) \]
  5. Applied egg-rr98.9%

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

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

Alternative 3: 98.9% accurate, 1.3× speedup?

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

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

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
  2. Simplified98.8%

    \[\leadsto \color{blue}{\left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{1 + e^{0 - \frac{\pi}{s}}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. flip-+N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \log \left(\frac{1}{\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} \cdot \frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1 \cdot -1}}\right)\right) \]
    3. log-recN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \left(\mathsf{neg}\left(\log \left(\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} \cdot \frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1 \cdot -1}\right)\right)\right)\right) \]
  5. Applied egg-rr98.9%

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\left(\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} + 1}{{\left(\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}^{-2} + -1}\right)\right)\right)\right) \]
    2. clear-numN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{{\left(\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}^{-2} + -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} + 1}\right)\right)\right)\right)\right) \]
  7. Applied egg-rr98.9%

    \[\leadsto \left(-s\right) \cdot \left(-\color{blue}{\log \left(\frac{1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\pi}{s}}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1}\right)}\right) \]
  8. Step-by-step derivation
    1. sub0-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{s}\right)\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    2. distribute-neg-fracN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\left(\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    3. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    4. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    5. PI-lowering-PI.f3298.9%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
  9. Applied egg-rr98.9%

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

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

Alternative 4: 98.9% accurate, 1.3× speedup?

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

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

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
  2. Simplified98.8%

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{s}\right)\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
    2. distribute-neg-fracN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\left(\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
    3. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
    4. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
    5. PI-lowering-PI.f3298.8%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
  5. Applied egg-rr98.8%

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

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

Alternative 5: 94.8% accurate, 1.8× speedup?

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

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

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
  2. Simplified98.8%

    \[\leadsto \color{blue}{\left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{1 + e^{0 - \frac{\pi}{s}}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. flip-+N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \log \left(\frac{1}{\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} \cdot \frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1 \cdot -1}}\right)\right) \]
    3. log-recN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \left(\mathsf{neg}\left(\log \left(\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} \cdot \frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1 \cdot -1}\right)\right)\right)\right) \]
  5. Applied egg-rr98.9%

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\left(\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} + 1}{{\left(\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}^{-2} + -1}\right)\right)\right)\right) \]
    2. clear-numN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{{\left(\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}^{-2} + -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} + 1}\right)\right)\right)\right)\right) \]
  7. Applied egg-rr98.9%

    \[\leadsto \left(-s\right) \cdot \left(-\color{blue}{\log \left(\frac{1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\pi}{s}}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1}\right)}\right) \]
  8. Step-by-step derivation
    1. sub0-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{s}\right)\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    2. distribute-neg-fracN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\left(\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    3. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    4. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    5. PI-lowering-PI.f3298.9%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
  9. Applied egg-rr98.9%

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \color{blue}{\left(1 + -1 \cdot \frac{-1 \cdot \mathsf{PI}\left(\right) + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{\mathsf{PI}\left(\right)}^{3}}{s} + \frac{1}{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{s}}{s}\right)}\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
  11. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \left(1 + \left(\mathsf{neg}\left(\frac{-1 \cdot \mathsf{PI}\left(\right) + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{\mathsf{PI}\left(\right)}^{3}}{s} + \frac{1}{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{s}}{s}\right)\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    2. unsub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \left(1 - \frac{-1 \cdot \mathsf{PI}\left(\right) + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{\mathsf{PI}\left(\right)}^{3}}{s} + \frac{1}{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{s}}{s}\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    3. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \left(\frac{-1 \cdot \mathsf{PI}\left(\right) + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{\mathsf{PI}\left(\right)}^{3}}{s} + \frac{1}{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{s}}{s}\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(-1 \cdot \mathsf{PI}\left(\right) + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{\mathsf{PI}\left(\right)}^{3}}{s} + \frac{1}{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{s}\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
  12. Simplified93.7%

    \[\leadsto \left(-s\right) \cdot \left(-\log \left(\frac{1}{\frac{1}{\frac{u}{1 + e^{\frac{-\pi}{s}}} + \frac{1 - u}{1 + \color{blue}{\left(1 - \frac{-\left(\pi + \frac{\frac{0.16666666666666666 \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)}{s} + 0.5 \cdot \left(\pi \cdot \pi\right)}{s}\right)}{s}\right)}}} + -1}\right)\right) \]
  13. Final simplification93.7%

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

Alternative 6: 92.8% accurate, 1.8× speedup?

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

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

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
  2. Simplified98.8%

    \[\leadsto \color{blue}{\left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{1 + e^{0 - \frac{\pi}{s}}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. flip-+N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \log \left(\frac{1}{\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} \cdot \frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1 \cdot -1}}\right)\right) \]
    3. log-recN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \left(\mathsf{neg}\left(\log \left(\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} \cdot \frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1 \cdot -1}\right)\right)\right)\right) \]
  5. Applied egg-rr98.9%

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\left(\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} + 1}{{\left(\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}^{-2} + -1}\right)\right)\right)\right) \]
    2. clear-numN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{{\left(\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}^{-2} + -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} + 1}\right)\right)\right)\right)\right) \]
  7. Applied egg-rr98.9%

    \[\leadsto \left(-s\right) \cdot \left(-\color{blue}{\log \left(\frac{1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\pi}{s}}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1}\right)}\right) \]
  8. Step-by-step derivation
    1. sub0-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{s}\right)\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    2. distribute-neg-fracN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\left(\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    3. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    4. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    5. PI-lowering-PI.f3298.9%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
  9. Applied egg-rr98.9%

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(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)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
  11. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \left(1 + \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)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    2. unsub-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \left(1 - \frac{-1 \cdot \mathsf{PI}\left(\right) + \frac{-1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{s}}{s}\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    3. --lowering--.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \left(\frac{-1 \cdot \mathsf{PI}\left(\right) + \frac{-1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{s}}{s}\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    4. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(-1 \cdot \mathsf{PI}\left(\right) + \frac{-1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{s}\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(\frac{-1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{s} + -1 \cdot \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    6. mul-1-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(\frac{-1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{s} + \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    7. unsub-negN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\left(\frac{-1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{s}\right), \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    9. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \left(\frac{{\mathsf{PI}\left(\right)}^{2}}{s}\right)\right), \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    10. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\left({\mathsf{PI}\left(\right)}^{2}\right), s\right)\right), \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), s\right)\right), \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    12. *-lowering-*.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right), s\right)\right), \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    13. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right), s\right)\right), \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    14. PI-lowering-PI.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right), s\right)\right), \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    15. PI-lowering-PI.f3292.3%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right), s\right)\right), \mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
  12. Simplified92.3%

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

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

Alternative 7: 86.1% accurate, 1.9× speedup?

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

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

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
  2. Simplified98.8%

    \[\leadsto \color{blue}{\left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{1 + e^{0 - \frac{\pi}{s}}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. flip-+N/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \log \left(\frac{1}{\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} \cdot \frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1 \cdot -1}}\right)\right) \]
    3. log-recN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \left(\mathsf{neg}\left(\log \left(\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} \cdot \frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} - -1 \cdot -1}\right)\right)\right)\right) \]
  5. Applied egg-rr98.9%

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\left(\frac{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} + 1}{{\left(\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}^{-2} + -1}\right)\right)\right)\right) \]
    2. clear-numN/A

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \left(\frac{{\left(\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}^{-2} + -1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\mathsf{PI}\left(\right)}{s}}} + \frac{1 - u}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}} + 1}\right)\right)\right)\right)\right) \]
  7. Applied egg-rr98.9%

    \[\leadsto \left(-s\right) \cdot \left(-\color{blue}{\log \left(\frac{1}{\frac{1}{\frac{u}{1 + e^{0 - \frac{\pi}{s}}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1}\right)}\right) \]
  8. Step-by-step derivation
    1. sub0-negN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{s}\right)\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    2. distribute-neg-fracN/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\left(\frac{\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)}{s}\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    3. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    4. neg-lowering-neg.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    5. PI-lowering-PI.f3298.9%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
  9. Applied egg-rr98.9%

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \color{blue}{\left(1 + \frac{\mathsf{PI}\left(\right)}{s}\right)}\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
  11. Step-by-step derivation
    1. +-lowering-+.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{+.f32}\left(1, \left(\frac{\mathsf{PI}\left(\right)}{s}\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    2. /-lowering-/.f32N/A

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{PI}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
    3. PI-lowering-PI.f3286.6%

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{neg.f32}\left(\mathsf{log.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right)\right)\right) \]
  12. Simplified86.6%

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

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

Alternative 8: 37.6% accurate, 2.0× speedup?

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

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

    \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
  2. Simplified98.8%

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

    \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \color{blue}{1}\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
  5. Step-by-step derivation
    1. Simplified37.1%

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{1 + \color{blue}{1}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1\right) \]
    2. Step-by-step derivation
      1. metadata-eval37.1%

        \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
    3. Applied egg-rr37.1%

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

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

    Alternative 9: 37.0% accurate, 2.0× speedup?

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

      \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
    2. Simplified98.8%

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

      \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \color{blue}{1}\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
    5. Step-by-step derivation
      1. Simplified37.1%

        \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{1 + \color{blue}{1}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1\right) \]
      2. Step-by-step derivation
        1. metadata-eval37.1%

          \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
      3. Applied egg-rr37.1%

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

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

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

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

          \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\left(\frac{1}{u \cdot \left(\frac{1}{2} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right)}\right), -1\right)\right)\right) \]
      6. Simplified36.8%

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

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

      Alternative 10: 36.9% accurate, 3.1× speedup?

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

        \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
      2. Simplified98.8%

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

        \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \color{blue}{1}\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
      5. Step-by-step derivation
        1. Simplified37.1%

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{1 + \color{blue}{1}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1\right) \]
        2. Step-by-step derivation
          1. metadata-eval37.1%

            \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
        3. Applied egg-rr37.1%

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

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

            \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \left(1 + \left(\mathsf{neg}\left(\frac{-1 \cdot \mathsf{PI}\left(\right) + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{\mathsf{PI}\left(\right)}^{3}}{s} + \frac{1}{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{s}}{s}\right)\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
          2. unsub-negN/A

            \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \left(1 - \frac{-1 \cdot \mathsf{PI}\left(\right) + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{\mathsf{PI}\left(\right)}^{3}}{s} + \frac{1}{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{s}}{s}\right)\right)\right)\right)\right), -1\right)\right)\right) \]
          3. --lowering--.f32N/A

            \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \left(\frac{-1 \cdot \mathsf{PI}\left(\right) + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{\mathsf{PI}\left(\right)}^{3}}{s} + \frac{1}{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{s}}{s}\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
          4. /-lowering-/.f32N/A

            \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(-1 \cdot \mathsf{PI}\left(\right) + -1 \cdot \frac{\frac{1}{6} \cdot \frac{{\mathsf{PI}\left(\right)}^{3}}{s} + \frac{1}{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{s}\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
        6. Simplified36.7%

          \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{2} + \frac{1 - u}{1 + \color{blue}{\left(1 - \frac{-\left(\pi + \frac{\frac{0.16666666666666666 \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)}{s} + 0.5 \cdot \left(\pi \cdot \pi\right)}{s}\right)}{s}\right)}}} + -1\right) \]
        7. Final simplification36.7%

          \[\leadsto \left(-s\right) \cdot \log \left(-1 + \frac{-1}{\frac{1 - u}{-1 + \left(-1 - \frac{\pi + \frac{\frac{0.16666666666666666 \cdot \left(\pi \cdot \left(\pi \cdot \pi\right)\right)}{s} + \left(\pi \cdot \pi\right) \cdot 0.5}{s}}{s}\right)} - \frac{u}{2}}\right) \]
        8. Add Preprocessing

        Alternative 11: 36.7% accurate, 3.3× speedup?

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

          \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
        2. Simplified98.8%

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

          \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \color{blue}{1}\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
        5. Step-by-step derivation
          1. Simplified37.1%

            \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{1 + \color{blue}{1}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1\right) \]
          2. Step-by-step derivation
            1. metadata-eval37.1%

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
          3. Applied egg-rr37.1%

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

            \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(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)\right)\right)\right), -1\right)\right)\right) \]
          5. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \left(1 + \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)\right)\right)\right), -1\right)\right)\right) \]
            2. unsub-negN/A

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

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \left(\frac{-1 \cdot \mathsf{PI}\left(\right) + \frac{-1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{s}}{s}\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            4. /-lowering-/.f32N/A

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(-1 \cdot \mathsf{PI}\left(\right) + \frac{-1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{s}\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            5. +-commutativeN/A

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(\frac{-1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{s} + -1 \cdot \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            6. mul-1-negN/A

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(\frac{-1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{s} + \left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            7. unsub-negN/A

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\left(\frac{-1}{2} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{s} - \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            8. --lowering--.f32N/A

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

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \left(\frac{{\mathsf{PI}\left(\right)}^{2}}{s}\right)\right), \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            10. /-lowering-/.f32N/A

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\left({\mathsf{PI}\left(\right)}^{2}\right), s\right)\right), \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            11. unpow2N/A

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right), s\right)\right), \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            12. *-lowering-*.f32N/A

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right), s\right)\right), \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            13. PI-lowering-PI.f32N/A

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI}\left(\right)\right), s\right)\right), \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            14. PI-lowering-PI.f32N/A

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right), s\right)\right), \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            15. PI-lowering-PI.f3236.4%

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{\_.f32}\left(1, \mathsf{/.f32}\left(\mathsf{\_.f32}\left(\mathsf{*.f32}\left(\frac{-1}{2}, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{PI.f32}\left(\right)\right), s\right)\right), \mathsf{PI.f32}\left(\right)\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
          6. Simplified36.4%

            \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{2} + \frac{1 - u}{1 + \color{blue}{\left(1 - \frac{-0.5 \cdot \frac{\pi \cdot \pi}{s} - \pi}{s}\right)}}} + -1\right) \]
          7. Final simplification36.4%

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

          Alternative 12: 36.2% accurate, 3.5× speedup?

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

            \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
          2. Simplified98.8%

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

            \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \color{blue}{1}\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
          5. Step-by-step derivation
            1. Simplified37.1%

              \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{1 + \color{blue}{1}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1\right) \]
            2. Step-by-step derivation
              1. metadata-eval37.1%

                \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            3. Applied egg-rr37.1%

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

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

                \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{+.f32}\left(1, \left(\frac{\mathsf{PI}\left(\right)}{s}\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
              2. /-lowering-/.f32N/A

                \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{PI}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
              3. PI-lowering-PI.f3235.7%

                \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{+.f32}\left(1, \mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            6. Simplified35.7%

              \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{2} + \frac{1 - u}{1 + \color{blue}{\left(1 + \frac{\pi}{s}\right)}}} + -1\right) \]
            7. Final simplification35.7%

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

            Alternative 13: 25.1% accurate, 3.7× speedup?

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

              \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
            2. Simplified98.8%

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

              \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, \mathsf{+.f32}\left(1, \color{blue}{1}\right)\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
            5. Step-by-step derivation
              1. Simplified37.1%

                \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\frac{u}{1 + \color{blue}{1}} + \frac{1 - u}{1 + e^{\frac{\pi}{s}}}} + -1\right) \]
              2. Step-by-step derivation
                1. metadata-eval37.1%

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(\mathsf{/.f32}\left(1, \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \mathsf{/.f32}\left(\mathsf{\_.f32}\left(1, u\right), \mathsf{+.f32}\left(1, \mathsf{exp.f32}\left(\mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right)\right)\right)\right)\right), -1\right)\right)\right) \]
              3. Applied egg-rr37.1%

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

                \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\color{blue}{\left(1 + 4 \cdot \frac{\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)}{s}\right)}\right)\right) \]
              5. Step-by-step derivation
                1. associate-*r/N/A

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\left(1 + \frac{4 \cdot \left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right)}{s}\right)\right)\right) \]
                2. +-lowering-+.f32N/A

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(1, \left(\frac{4 \cdot \left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right)}{s}\right)\right)\right)\right) \]
                3. associate-*r/N/A

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(1, \left(4 \cdot \frac{\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)}{s}\right)\right)\right)\right) \]
                4. *-lowering-*.f32N/A

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(4, \left(\frac{\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)}{s}\right)\right)\right)\right)\right) \]
                5. /-lowering-/.f32N/A

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(4, \mathsf{/.f32}\left(\left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right) \]
                6. cancel-sign-sub-invN/A

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(4, \mathsf{/.f32}\left(\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), s\right)\right)\right)\right)\right) \]
                7. metadata-evalN/A

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

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(4, \mathsf{/.f32}\left(\left(\left(\frac{-1}{4} \cdot u\right) \cdot \mathsf{PI}\left(\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right), s\right)\right)\right)\right)\right) \]
                9. distribute-rgt-outN/A

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(4, \mathsf{/.f32}\left(\left(\mathsf{PI}\left(\right) \cdot \left(\frac{-1}{4} \cdot u + \frac{1}{4}\right)\right), s\right)\right)\right)\right)\right) \]
                10. *-lowering-*.f32N/A

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(4, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI}\left(\right), \left(\frac{-1}{4} \cdot u + \frac{1}{4}\right)\right), s\right)\right)\right)\right)\right) \]
                11. PI-lowering-PI.f32N/A

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(4, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \left(\frac{-1}{4} \cdot u + \frac{1}{4}\right)\right), s\right)\right)\right)\right)\right) \]
                12. +-lowering-+.f32N/A

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(4, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\left(\frac{-1}{4} \cdot u\right), \frac{1}{4}\right)\right), s\right)\right)\right)\right)\right) \]
                13. *-lowering-*.f3224.7%

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{log.f32}\left(\mathsf{+.f32}\left(1, \mathsf{*.f32}\left(4, \mathsf{/.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\frac{-1}{4}, u\right), \frac{1}{4}\right)\right), s\right)\right)\right)\right)\right) \]
              6. Simplified24.7%

                \[\leadsto \left(-s\right) \cdot \log \color{blue}{\left(1 + 4 \cdot \frac{\pi \cdot \left(-0.25 \cdot u + 0.25\right)}{s}\right)} \]
              7. Final simplification24.7%

                \[\leadsto \left(-s\right) \cdot \log \left(4 \cdot \frac{\pi \cdot \left(u \cdot -0.25 + 0.25\right)}{s} + 1\right) \]
              8. Add Preprocessing

              Alternative 14: 14.2% accurate, 10.6× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \pi \cdot \left(\frac{u}{2} + -0.25\right)\\ \frac{-1}{\frac{s}{\left(t\_0 \cdot -4 + \frac{0.5}{s} \cdot \left(0 \cdot \left(t\_0 \cdot t\_0\right)\right)\right) \cdot \frac{s \cdot s}{s}}} \end{array} \end{array} \]
              (FPCore (u s)
               :precision binary32
               (let* ((t_0 (* PI (+ (/ u 2.0) -0.25))))
                 (/
                  -1.0
                  (/
                   s
                   (* (+ (* t_0 -4.0) (* (/ 0.5 s) (* 0.0 (* t_0 t_0)))) (/ (* s s) s))))))
              float code(float u, float s) {
              	float t_0 = ((float) M_PI) * ((u / 2.0f) + -0.25f);
              	return -1.0f / (s / (((t_0 * -4.0f) + ((0.5f / s) * (0.0f * (t_0 * t_0)))) * ((s * s) / s)));
              }
              
              function code(u, s)
              	t_0 = Float32(Float32(pi) * Float32(Float32(u / Float32(2.0)) + Float32(-0.25)))
              	return Float32(Float32(-1.0) / Float32(s / Float32(Float32(Float32(t_0 * Float32(-4.0)) + Float32(Float32(Float32(0.5) / s) * Float32(Float32(0.0) * Float32(t_0 * t_0)))) * Float32(Float32(s * s) / s))))
              end
              
              function tmp = code(u, s)
              	t_0 = single(pi) * ((u / single(2.0)) + single(-0.25));
              	tmp = single(-1.0) / (s / (((t_0 * single(-4.0)) + ((single(0.5) / s) * (single(0.0) * (t_0 * t_0)))) * ((s * s) / s)));
              end
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \pi \cdot \left(\frac{u}{2} + -0.25\right)\\
              \frac{-1}{\frac{s}{\left(t\_0 \cdot -4 + \frac{0.5}{s} \cdot \left(0 \cdot \left(t\_0 \cdot t\_0\right)\right)\right) \cdot \frac{s \cdot s}{s}}}
              \end{array}
              \end{array}
              
              Derivation
              1. Initial program 98.8%

                \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
              2. Simplified98.8%

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

                \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \color{blue}{\left(\frac{-4 \cdot \left(\frac{1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{1}{2} \cdot \frac{-16 \cdot {\left(\frac{1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + -2 \cdot \left(-8 \cdot {\left(\frac{1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + -4 \cdot \left(\frac{-1}{8} \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{1}{8} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}{s}}{s}\right)}\right) \]
              5. Simplified11.3%

                \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right) \cdot -4 + \frac{\left(\left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right) \cdot \left(\left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right) \cdot -16\right) + \left(0 + \left(\left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right) \cdot \left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right)\right) \cdot 16\right)\right) \cdot 0.5}{s}}{s}} \]
              6. Applied egg-rr11.3%

                \[\leadsto \color{blue}{\frac{1}{\frac{s}{\left(-s\right) \cdot \left(\left(\pi \cdot \left(\frac{u}{2} + -0.25\right)\right) \cdot -4 + \frac{0.5}{s} \cdot \left(\left(\left(\pi \cdot \left(\frac{u}{2} + -0.25\right)\right) \cdot \left(\pi \cdot \left(\frac{u}{2} + -0.25\right)\right)\right) \cdot 0\right)\right)}}} \]
              7. Step-by-step derivation
                1. neg-sub0N/A

                  \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(s, \mathsf{*.f32}\left(\left(0 - s\right), \mathsf{+.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \frac{-1}{4}\right)\right), -4\right)}, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{2}, s\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \frac{-1}{4}\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \frac{-1}{4}\right)\right)\right), 0\right)\right)\right)\right)\right)\right) \]
                2. flip--N/A

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

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

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

                  \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(s, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{\_.f32}\left(0, \left(s \cdot s\right)\right), \left(0 + s\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\color{blue}{\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \frac{-1}{4}\right)\right)}, -4\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{2}, s\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \frac{-1}{4}\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \frac{-1}{4}\right)\right)\right), 0\right)\right)\right)\right)\right)\right) \]
                6. *-lowering-*.f32N/A

                  \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(s, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(s, s\right)\right), \left(0 + s\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \color{blue}{\mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \frac{-1}{4}\right)}\right), -4\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{2}, s\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \frac{-1}{4}\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \frac{-1}{4}\right)\right)\right), 0\right)\right)\right)\right)\right)\right) \]
                7. +-lowering-+.f3214.0%

                  \[\leadsto \mathsf{/.f32}\left(1, \mathsf{/.f32}\left(s, \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(s, s\right)\right), \mathsf{+.f32}\left(0, s\right)\right), \mathsf{+.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \frac{-1}{4}\right)\right), \color{blue}{-4}\right), \mathsf{*.f32}\left(\mathsf{/.f32}\left(\frac{1}{2}, s\right), \mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \frac{-1}{4}\right)\right), \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(\mathsf{/.f32}\left(u, 2\right), \frac{-1}{4}\right)\right)\right), 0\right)\right)\right)\right)\right)\right) \]
              8. Applied egg-rr14.0%

                \[\leadsto \frac{1}{\frac{s}{\color{blue}{\frac{0 - s \cdot s}{0 + s}} \cdot \left(\left(\pi \cdot \left(\frac{u}{2} + -0.25\right)\right) \cdot -4 + \frac{0.5}{s} \cdot \left(\left(\left(\pi \cdot \left(\frac{u}{2} + -0.25\right)\right) \cdot \left(\pi \cdot \left(\frac{u}{2} + -0.25\right)\right)\right) \cdot 0\right)\right)}} \]
              9. Final simplification14.0%

                \[\leadsto \frac{-1}{\frac{s}{\left(\left(\pi \cdot \left(\frac{u}{2} + -0.25\right)\right) \cdot -4 + \frac{0.5}{s} \cdot \left(0 \cdot \left(\left(\pi \cdot \left(\frac{u}{2} + -0.25\right)\right) \cdot \left(\pi \cdot \left(\frac{u}{2} + -0.25\right)\right)\right)\right)\right) \cdot \frac{s \cdot s}{s}}} \]
              10. Add Preprocessing

              Alternative 15: 14.0% accurate, 43.3× speedup?

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

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

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

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

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{/.f32}\left(\mathsf{PI}\left(\right), \color{blue}{s}\right)\right) \]
                2. PI-lowering-PI.f3211.0%

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right) \]
              6. Simplified11.0%

                \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\pi}{s}} \]
              7. Step-by-step derivation
                1. clear-numN/A

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

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

                  \[\leadsto \mathsf{/.f32}\left(\left(\mathsf{neg}\left(s\right)\right), \color{blue}{\left(\frac{s}{\mathsf{PI}\left(\right)}\right)}\right) \]
                4. neg-lowering-neg.f32N/A

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

                  \[\leadsto \mathsf{/.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{/.f32}\left(s, \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \]
                6. PI-lowering-PI.f3211.0%

                  \[\leadsto \mathsf{/.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{/.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
              8. Applied egg-rr11.0%

                \[\leadsto \color{blue}{\frac{-s}{\frac{s}{\pi}}} \]
              9. Step-by-step derivation
                1. neg-sub0N/A

                  \[\leadsto \mathsf{/.f32}\left(\left(0 - s\right), \mathsf{/.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
                2. flip--N/A

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

                  \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(0 \cdot 0 - s \cdot s\right), \left(0 + s\right)\right), \mathsf{/.f32}\left(\color{blue}{s}, \mathsf{PI.f32}\left(\right)\right)\right) \]
                4. metadata-evalN/A

                  \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\left(0 - s \cdot s\right), \left(0 + s\right)\right), \mathsf{/.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
                5. --lowering--.f32N/A

                  \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{\_.f32}\left(0, \left(s \cdot s\right)\right), \left(0 + s\right)\right), \mathsf{/.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
                6. *-lowering-*.f32N/A

                  \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(s, s\right)\right), \left(0 + s\right)\right), \mathsf{/.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
                7. +-lowering-+.f3213.8%

                  \[\leadsto \mathsf{/.f32}\left(\mathsf{/.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(s, s\right)\right), \mathsf{+.f32}\left(0, s\right)\right), \mathsf{/.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
              10. Applied egg-rr13.8%

                \[\leadsto \frac{\color{blue}{\frac{0 - s \cdot s}{0 + s}}}{\frac{s}{\pi}} \]
              11. Final simplification13.8%

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

              Alternative 16: 13.9% accurate, 43.3× 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) / s) * Float32(Float32(s * s) / Float32(-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 98.8%

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

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

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

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{/.f32}\left(\mathsf{PI}\left(\right), \color{blue}{s}\right)\right) \]
                2. PI-lowering-PI.f3211.0%

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right) \]
              6. Simplified11.0%

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

                  \[\leadsto \mathsf{*.f32}\left(\left(0 - s\right), \mathsf{/.f32}\left(\color{blue}{\mathsf{PI.f32}\left(\right)}, s\right)\right) \]
                2. flip--N/A

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

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\left(0 \cdot 0 - s \cdot s\right), \left(0 + s\right)\right), \mathsf{/.f32}\left(\color{blue}{\mathsf{PI.f32}\left(\right)}, s\right)\right) \]
                4. metadata-evalN/A

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\left(0 - s \cdot s\right), \left(0 + s\right)\right), \mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right) \]
                5. --lowering--.f32N/A

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{\_.f32}\left(0, \left(s \cdot s\right)\right), \left(0 + s\right)\right), \mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right) \]
                6. *-lowering-*.f32N/A

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(s, s\right)\right), \left(0 + s\right)\right), \mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right) \]
                7. +-lowering-+.f3213.7%

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{/.f32}\left(\mathsf{\_.f32}\left(0, \mathsf{*.f32}\left(s, s\right)\right), \mathsf{+.f32}\left(0, s\right)\right), \mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right) \]
              8. Applied egg-rr13.7%

                \[\leadsto \color{blue}{\frac{0 - s \cdot s}{0 + s}} \cdot \frac{\pi}{s} \]
              9. Final simplification13.7%

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

              Alternative 17: 11.6% accurate, 48.1× speedup?

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

                \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
              2. Simplified98.8%

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

                \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \color{blue}{\left(\frac{-4 \cdot \left(\frac{1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{1}{2} \cdot \frac{-16 \cdot {\left(\frac{1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + -2 \cdot \left(-8 \cdot {\left(\frac{1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + -4 \cdot \left(\frac{-1}{8} \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{1}{8} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}{s}}{s}\right)}\right) \]
              5. Simplified11.3%

                \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right) \cdot -4 + \frac{\left(\left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right) \cdot \left(\left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right) \cdot -16\right) + \left(0 + \left(\left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right) \cdot \left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right)\right) \cdot 16\right)\right) \cdot 0.5}{s}}{s}} \]
              6. Applied egg-rr11.3%

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

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

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

                  \[\leadsto \mathsf{*.f32}\left(u, \left(2 \cdot \mathsf{PI}\left(\right) + \color{blue}{-1 \cdot \frac{\mathsf{PI}\left(\right)}{u}}\right)\right) \]
                3. mul-1-negN/A

                  \[\leadsto \mathsf{*.f32}\left(u, \left(2 \cdot \mathsf{PI}\left(\right) + \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{u}\right)\right)\right)\right) \]
                4. unsub-negN/A

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

                  \[\leadsto \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\left(2 \cdot \mathsf{PI}\left(\right)\right), \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{u}\right)}\right)\right) \]
                6. *-commutativeN/A

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

                  \[\leadsto \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{PI}\left(\right), 2\right), \left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{u}\right)\right)\right) \]
                8. PI-lowering-PI.f32N/A

                  \[\leadsto \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 2\right), \left(\frac{\mathsf{PI}\left(\right)}{u}\right)\right)\right) \]
                9. /-lowering-/.f32N/A

                  \[\leadsto \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 2\right), \mathsf{/.f32}\left(\mathsf{PI}\left(\right), \color{blue}{u}\right)\right)\right) \]
                10. PI-lowering-PI.f3211.3%

                  \[\leadsto \mathsf{*.f32}\left(u, \mathsf{\_.f32}\left(\mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), 2\right), \mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), u\right)\right)\right) \]
              9. Simplified11.3%

                \[\leadsto \color{blue}{u \cdot \left(\pi \cdot 2 - \frac{\pi}{u}\right)} \]
              10. Add Preprocessing

              Alternative 18: 11.6% accurate, 61.9× speedup?

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

                \[\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\pi}{s}}} - \frac{1}{1 + e^{\frac{\pi}{s}}}\right) + \frac{1}{1 + e^{\frac{\pi}{s}}}} - 1\right) \]
              2. Simplified98.8%

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

                \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \color{blue}{\left(\frac{-4 \cdot \left(\frac{1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{1}{2} \cdot \frac{-16 \cdot {\left(\frac{1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + -2 \cdot \left(-8 \cdot {\left(\frac{1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) - \left(\frac{-1}{4} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right) + \frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + -4 \cdot \left(\frac{-1}{8} \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{1}{8} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}{s}}{s}\right)}\right) \]
              5. Simplified11.3%

                \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right) \cdot -4 + \frac{\left(\left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right) \cdot \left(\left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right) \cdot -16\right) + \left(0 + \left(\left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right) \cdot \left(\left(\pi \cdot u\right) \cdot 0.5 + \pi \cdot -0.25\right)\right) \cdot 16\right)\right) \cdot 0.5}{s}}{s}} \]
              6. Applied egg-rr11.3%

                \[\leadsto \color{blue}{\frac{1}{\frac{s}{\left(-s\right) \cdot \left(\left(\pi \cdot \left(\frac{u}{2} + -0.25\right)\right) \cdot -4 + \frac{0.5}{s} \cdot \left(\left(\left(\pi \cdot \left(\frac{u}{2} + -0.25\right)\right) \cdot \left(\pi \cdot \left(\frac{u}{2} + -0.25\right)\right)\right) \cdot 0\right)\right)}}} \]
              7. Taylor expanded in u around 0

                \[\leadsto \color{blue}{-1 \cdot \mathsf{PI}\left(\right) + 2 \cdot \left(u \cdot \mathsf{PI}\left(\right)\right)} \]
              8. Step-by-step derivation
                1. associate-*r*N/A

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

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

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

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

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(-1, \color{blue}{\left(2 \cdot u\right)}\right)\right) \]
                6. *-lowering-*.f3211.3%

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{PI.f32}\left(\right), \mathsf{+.f32}\left(-1, \mathsf{*.f32}\left(2, \color{blue}{u}\right)\right)\right) \]
              9. Simplified11.3%

                \[\leadsto \color{blue}{\pi \cdot \left(-1 + 2 \cdot u\right)} \]
              10. Final simplification11.3%

                \[\leadsto \pi \cdot \left(-1 + u \cdot 2\right) \]
              11. Add Preprocessing

              Alternative 19: 11.4% accurate, 61.9× speedup?

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

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

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

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

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{/.f32}\left(\mathsf{PI}\left(\right), \color{blue}{s}\right)\right) \]
                2. PI-lowering-PI.f3211.0%

                  \[\leadsto \mathsf{*.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{/.f32}\left(\mathsf{PI.f32}\left(\right), s\right)\right) \]
              6. Simplified11.0%

                \[\leadsto \left(-s\right) \cdot \color{blue}{\frac{\pi}{s}} \]
              7. Step-by-step derivation
                1. clear-numN/A

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

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

                  \[\leadsto \mathsf{/.f32}\left(\left(\mathsf{neg}\left(s\right)\right), \color{blue}{\left(\frac{s}{\mathsf{PI}\left(\right)}\right)}\right) \]
                4. neg-lowering-neg.f32N/A

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

                  \[\leadsto \mathsf{/.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{/.f32}\left(s, \color{blue}{\mathsf{PI}\left(\right)}\right)\right) \]
                6. PI-lowering-PI.f3211.0%

                  \[\leadsto \mathsf{/.f32}\left(\mathsf{neg.f32}\left(s\right), \mathsf{/.f32}\left(s, \mathsf{PI.f32}\left(\right)\right)\right) \]
              8. Applied egg-rr11.0%

                \[\leadsto \color{blue}{\frac{-s}{\frac{s}{\pi}}} \]
              9. Final simplification11.0%

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

              Alternative 20: 11.4% accurate, 216.5× 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 98.8%

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

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

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

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

                  \[\leadsto \mathsf{neg.f32}\left(\mathsf{PI}\left(\right)\right) \]
                3. PI-lowering-PI.f3211.0%

                  \[\leadsto \mathsf{neg.f32}\left(\mathsf{PI.f32}\left(\right)\right) \]
              6. Simplified11.0%

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

              Reproduce

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