Sample trimmed logistic on [-pi, pi]

Percentage Accurate: 98.9% → 98.9%
Time: 5.7s
Alternatives: 15
Speedup: 1.0×

Specification

?
\[\left(2.328306437 \cdot 10^{-10} \leq u \land u \leq 1\right) \land \left(0 \leq s \land s \leq 1.0651631\right)\]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{1 + e^{\frac{\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}

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 15 alternatives:

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

Initial Program: 98.9% accurate, 1.0× speedup?

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

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

Alternative 1: 98.9% accurate, 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}
Derivation
  1. Initial program 98.9%

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

Alternative 2: 98.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 3: 97.6% accurate, 1.4× speedup?

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

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

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

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

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

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

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

Alternative 4: 94.3% accurate, 1.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 94.3% accurate, 1.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\left(\frac{1}{e^{\frac{-\pi}{s}} + 1} - \frac{1}{\frac{\mathsf{PI}\left(\right)}{s}}\right) \cdot u} - 1\right) \]
  9. Step-by-step derivation
    1. lift-/.f32N/A

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

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\left(\frac{1}{e^{\frac{-\pi}{s}} + 1} - \frac{1}{\frac{\pi}{s}}\right) \cdot u} - 1\right) \]
  10. Applied rewrites94.3%

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

Alternative 6: 37.0% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

    Alternative 7: 37.0% accurate, 2.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(-s\right) \cdot \log \left(\frac{1}{\left(\frac{1}{2} - \frac{1}{2 + \frac{\pi}{s}}\right) \cdot u} - 1\right) \]
    9. Step-by-step derivation
      1. Applied rewrites37.0%

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

      Alternative 8: 24.9% accurate, 2.9× speedup?

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

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

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

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

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

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

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

      Alternative 9: 24.9% accurate, 3.1× speedup?

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

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

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

        \[\leadsto \log \left({\color{blue}{\left(1 + -4 \cdot \frac{u \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) - \frac{1}{4} \cdot \mathsf{PI}\left(\right)}{s}\right)}}^{\left(-s\right)}\right) \]
      4. Step-by-step derivation
        1. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \log \left({\left(-4 \cdot \frac{\mathsf{fma}\left(\frac{-1}{4}, \pi, \frac{1}{2} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right)\right)}{s}\right)}^{\left(-s\right)}\right) \]
        7. lift-PI.f3215.0

          \[\leadsto \log \left({\left(-4 \cdot \frac{\mathsf{fma}\left(-0.25, \pi, 0.5 \cdot \left(u \cdot \pi\right)\right)}{s}\right)}^{\left(-s\right)}\right) \]
      8. Applied rewrites15.0%

        \[\leadsto \log \left({\left(-4 \cdot \color{blue}{\frac{\mathsf{fma}\left(-0.25, \pi, 0.5 \cdot \left(u \cdot \pi\right)\right)}{s}}\right)}^{\left(-s\right)}\right) \]
      9. Step-by-step derivation
        1. lift-log.f32N/A

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

          \[\leadsto \log \color{blue}{\left({\left(-4 \cdot \frac{\mathsf{fma}\left(\frac{-1}{4}, \pi, \frac{1}{2} \cdot \left(u \cdot \pi\right)\right)}{s}\right)}^{\left(-s\right)}\right)} \]
      10. Applied rewrites24.9%

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

      Alternative 10: 15.4% accurate, 3.1× speedup?

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

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

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

        \[\leadsto \log \left({\color{blue}{\left(1 + -4 \cdot \frac{u \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) - \frac{1}{4} \cdot \mathsf{PI}\left(\right)}{s}\right)}}^{\left(-s\right)}\right) \]
      4. Step-by-step derivation
        1. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \log \left({\left(-4 \cdot \frac{\mathsf{fma}\left(\frac{-1}{4}, \pi, \frac{1}{2} \cdot \left(u \cdot \mathsf{PI}\left(\right)\right)\right)}{s}\right)}^{\left(-s\right)}\right) \]
        7. lift-PI.f3215.0

          \[\leadsto \log \left({\left(-4 \cdot \frac{\mathsf{fma}\left(-0.25, \pi, 0.5 \cdot \left(u \cdot \pi\right)\right)}{s}\right)}^{\left(-s\right)}\right) \]
      8. Applied rewrites15.0%

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

        \[\leadsto \log \left({\left(\frac{\mathsf{PI}\left(\right)}{s}\right)}^{\left(-s\right)}\right) \]
      10. Step-by-step derivation
        1. lift-/.f32N/A

          \[\leadsto \log \left({\left(\frac{\mathsf{PI}\left(\right)}{s}\right)}^{\left(-s\right)}\right) \]
        2. lift-PI.f3215.4

          \[\leadsto \log \left({\left(\frac{\pi}{s}\right)}^{\left(-s\right)}\right) \]
      11. Applied rewrites15.4%

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

      Alternative 11: 14.3% accurate, 3.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;s \leq 1.0799999657267643 \cdot 10^{-20}:\\ \;\;\;\;\log 1\\ \mathbf{else}:\\ \;\;\;\;\left(-s\right) \cdot \mathsf{fma}\left(-2, \frac{u \cdot \pi}{s}, \frac{\pi}{s}\right)\\ \end{array} \end{array} \]
      (FPCore (u s)
       :precision binary32
       (if (<= s 1.0799999657267643e-20)
         (log 1.0)
         (* (- s) (fma -2.0 (/ (* u PI) s) (/ PI s)))))
      float code(float u, float s) {
      	float tmp;
      	if (s <= 1.0799999657267643e-20f) {
      		tmp = logf(1.0f);
      	} else {
      		tmp = -s * fmaf(-2.0f, ((u * ((float) M_PI)) / s), (((float) M_PI) / s));
      	}
      	return tmp;
      }
      
      function code(u, s)
      	tmp = Float32(0.0)
      	if (s <= Float32(1.0799999657267643e-20))
      		tmp = log(Float32(1.0));
      	else
      		tmp = Float32(Float32(-s) * fma(Float32(-2.0), Float32(Float32(u * Float32(pi)) / s), Float32(Float32(pi) / s)));
      	end
      	return tmp
      end
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;s \leq 1.0799999657267643 \cdot 10^{-20}:\\
      \;\;\;\;\log 1\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(-s\right) \cdot \mathsf{fma}\left(-2, \frac{u \cdot \pi}{s}, \frac{\pi}{s}\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if s < 1.07999997e-20

        1. Initial program 98.9%

          \[\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. Applied rewrites13.3%

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

          \[\leadsto \log \color{blue}{1} \]
        4. Step-by-step derivation
          1. Applied rewrites13.3%

            \[\leadsto \log \color{blue}{1} \]

          if 1.07999997e-20 < s

          1. Initial program 98.9%

            \[\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. Taylor expanded in s around inf

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

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

              \[\leadsto \left(-s\right) \cdot \left(\frac{u \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) - \frac{1}{4} \cdot \mathsf{PI}\left(\right)}{s} \cdot \color{blue}{-4}\right) \]
          4. Applied rewrites15.2%

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

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

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

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

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

              \[\leadsto \left(-s\right) \cdot \mathsf{fma}\left(-2, \frac{u \cdot \pi}{s}, \frac{\mathsf{PI}\left(\right)}{s}\right) \]
            5. lift-/.f32N/A

              \[\leadsto \left(-s\right) \cdot \mathsf{fma}\left(-2, \frac{u \cdot \pi}{s}, \frac{\mathsf{PI}\left(\right)}{s}\right) \]
            6. lift-PI.f3215.2

              \[\leadsto \left(-s\right) \cdot \mathsf{fma}\left(-2, \frac{u \cdot \pi}{s}, \frac{\pi}{s}\right) \]
          7. Applied rewrites15.2%

            \[\leadsto \left(-s\right) \cdot \mathsf{fma}\left(-2, \color{blue}{\frac{u \cdot \pi}{s}}, \frac{\pi}{s}\right) \]
        5. Recombined 2 regimes into one program.
        6. Add Preprocessing

        Alternative 12: 14.3% accurate, 3.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;s \leq 1.0799999657267643 \cdot 10^{-20}:\\ \;\;\;\;\log 1\\ \mathbf{else}:\\ \;\;\;\;\left(-s\right) \cdot \frac{u \cdot \mathsf{fma}\left(-2, \pi, \frac{\pi}{u}\right)}{s}\\ \end{array} \end{array} \]
        (FPCore (u s)
         :precision binary32
         (if (<= s 1.0799999657267643e-20)
           (log 1.0)
           (* (- s) (/ (* u (fma -2.0 PI (/ PI u))) s))))
        float code(float u, float s) {
        	float tmp;
        	if (s <= 1.0799999657267643e-20f) {
        		tmp = logf(1.0f);
        	} else {
        		tmp = -s * ((u * fmaf(-2.0f, ((float) M_PI), (((float) M_PI) / u))) / s);
        	}
        	return tmp;
        }
        
        function code(u, s)
        	tmp = Float32(0.0)
        	if (s <= Float32(1.0799999657267643e-20))
        		tmp = log(Float32(1.0));
        	else
        		tmp = Float32(Float32(-s) * Float32(Float32(u * fma(Float32(-2.0), Float32(pi), Float32(Float32(pi) / u))) / s));
        	end
        	return tmp
        end
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;s \leq 1.0799999657267643 \cdot 10^{-20}:\\
        \;\;\;\;\log 1\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(-s\right) \cdot \frac{u \cdot \mathsf{fma}\left(-2, \pi, \frac{\pi}{u}\right)}{s}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if s < 1.07999997e-20

          1. Initial program 98.9%

            \[\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. Applied rewrites13.3%

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

            \[\leadsto \log \color{blue}{1} \]
          4. Step-by-step derivation
            1. Applied rewrites13.3%

              \[\leadsto \log \color{blue}{1} \]

            if 1.07999997e-20 < s

            1. Initial program 98.9%

              \[\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. Taylor expanded in s around inf

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

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

                \[\leadsto \left(-s\right) \cdot \left(\frac{u \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) - \frac{1}{4} \cdot \mathsf{PI}\left(\right)}{s} \cdot \color{blue}{-4}\right) \]
            4. Applied rewrites15.2%

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

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

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

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

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

                \[\leadsto \left(-s\right) \cdot \left(u \cdot \mathsf{fma}\left(-2, \frac{\pi}{s}, \frac{\mathsf{PI}\left(\right)}{s \cdot u}\right)\right) \]
              5. lower-/.f32N/A

                \[\leadsto \left(-s\right) \cdot \left(u \cdot \mathsf{fma}\left(-2, \frac{\pi}{s}, \frac{\mathsf{PI}\left(\right)}{s \cdot u}\right)\right) \]
              6. lift-PI.f32N/A

                \[\leadsto \left(-s\right) \cdot \left(u \cdot \mathsf{fma}\left(-2, \frac{\pi}{s}, \frac{\pi}{s \cdot u}\right)\right) \]
              7. lower-*.f3215.2

                \[\leadsto \left(-s\right) \cdot \left(u \cdot \mathsf{fma}\left(-2, \frac{\pi}{s}, \frac{\pi}{s \cdot u}\right)\right) \]
            7. Applied rewrites15.2%

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

              \[\leadsto \left(-s\right) \cdot \frac{u \cdot \left(-2 \cdot \mathsf{PI}\left(\right) + \frac{\mathsf{PI}\left(\right)}{u}\right)}{s} \]
            9. Step-by-step derivation
              1. lower-/.f32N/A

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

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

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

                \[\leadsto \left(-s\right) \cdot \frac{u \cdot \mathsf{fma}\left(-2, \pi, \frac{\mathsf{PI}\left(\right)}{u}\right)}{s} \]
              5. lower-/.f32N/A

                \[\leadsto \left(-s\right) \cdot \frac{u \cdot \mathsf{fma}\left(-2, \pi, \frac{\mathsf{PI}\left(\right)}{u}\right)}{s} \]
              6. lift-PI.f3215.2

                \[\leadsto \left(-s\right) \cdot \frac{u \cdot \mathsf{fma}\left(-2, \pi, \frac{\pi}{u}\right)}{s} \]
            10. Applied rewrites15.2%

              \[\leadsto \left(-s\right) \cdot \frac{u \cdot \mathsf{fma}\left(-2, \pi, \frac{\pi}{u}\right)}{s} \]
          5. Recombined 2 regimes into one program.
          6. Add Preprocessing

          Alternative 13: 14.3% accurate, 4.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;s \leq 1.0799999657267643 \cdot 10^{-20}:\\ \;\;\;\;\log 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\pi \cdot 0.5, u, -0.25 \cdot \pi\right) \cdot 4\\ \end{array} \end{array} \]
          (FPCore (u s)
           :precision binary32
           (if (<= s 1.0799999657267643e-20)
             (log 1.0)
             (* (fma (* PI 0.5) u (* -0.25 PI)) 4.0)))
          float code(float u, float s) {
          	float tmp;
          	if (s <= 1.0799999657267643e-20f) {
          		tmp = logf(1.0f);
          	} else {
          		tmp = fmaf((((float) M_PI) * 0.5f), u, (-0.25f * ((float) M_PI))) * 4.0f;
          	}
          	return tmp;
          }
          
          function code(u, s)
          	tmp = Float32(0.0)
          	if (s <= Float32(1.0799999657267643e-20))
          		tmp = log(Float32(1.0));
          	else
          		tmp = Float32(fma(Float32(Float32(pi) * Float32(0.5)), u, Float32(Float32(-0.25) * Float32(pi))) * Float32(4.0));
          	end
          	return tmp
          end
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;s \leq 1.0799999657267643 \cdot 10^{-20}:\\
          \;\;\;\;\log 1\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(\pi \cdot 0.5, u, -0.25 \cdot \pi\right) \cdot 4\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if s < 1.07999997e-20

            1. Initial program 98.9%

              \[\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. Applied rewrites13.3%

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

              \[\leadsto \log \color{blue}{1} \]
            4. Step-by-step derivation
              1. Applied rewrites13.3%

                \[\leadsto \log \color{blue}{1} \]

              if 1.07999997e-20 < s

              1. Initial program 98.9%

                \[\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. Taylor expanded in s around inf

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

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

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(\pi \cdot 0.5, u, -0.25 \cdot \pi\right) \cdot 4} \]
            5. Recombined 2 regimes into one program.
            6. Add Preprocessing

            Alternative 14: 14.2% accurate, 0.9× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{1 + e^{\frac{\pi}{s}}}\\ \mathbf{if}\;\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) \leq -9.999999682655225 \cdot 10^{-20}:\\ \;\;\;\;-\pi\\ \mathbf{else}:\\ \;\;\;\;\log 1\\ \end{array} \end{array} \]
            (FPCore (u s)
             :precision binary32
             (let* ((t_0 (/ 1.0 (+ 1.0 (exp (/ PI s))))))
               (if (<=
                    (*
                     (- s)
                     (log
                      (-
                       (/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 (exp (/ (- PI) s)))) t_0)) t_0))
                       1.0)))
                    -9.999999682655225e-20)
                 (- PI)
                 (log 1.0))))
            float code(float u, float s) {
            	float t_0 = 1.0f / (1.0f + expf((((float) M_PI) / s)));
            	float tmp;
            	if ((-s * logf(((1.0f / ((u * ((1.0f / (1.0f + expf((-((float) M_PI) / s)))) - t_0)) + t_0)) - 1.0f))) <= -9.999999682655225e-20f) {
            		tmp = -((float) M_PI);
            	} else {
            		tmp = logf(1.0f);
            	}
            	return tmp;
            }
            
            function code(u, s)
            	t_0 = Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(pi) / s))))
            	tmp = Float32(0.0)
            	if (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)))) <= Float32(-9.999999682655225e-20))
            		tmp = Float32(-Float32(pi));
            	else
            		tmp = log(Float32(1.0));
            	end
            	return tmp
            end
            
            function tmp_2 = code(u, s)
            	t_0 = single(1.0) / (single(1.0) + exp((single(pi) / s)));
            	tmp = single(0.0);
            	if ((-s * log(((single(1.0) / ((u * ((single(1.0) / (single(1.0) + exp((-single(pi) / s)))) - t_0)) + t_0)) - single(1.0)))) <= single(-9.999999682655225e-20))
            		tmp = -single(pi);
            	else
            		tmp = log(single(1.0));
            	end
            	tmp_2 = tmp;
            end
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := \frac{1}{1 + e^{\frac{\pi}{s}}}\\
            \mathbf{if}\;\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) \leq -9.999999682655225 \cdot 10^{-20}:\\
            \;\;\;\;-\pi\\
            
            \mathbf{else}:\\
            \;\;\;\;\log 1\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f32 (neg.f32 s) (log.f32 (-.f32 (/.f32 #s(literal 1 binary32) (+.f32 (*.f32 u (-.f32 (/.f32 #s(literal 1 binary32) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (neg.f32 (PI.f32)) s)))) (/.f32 #s(literal 1 binary32) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (PI.f32) s)))))) (/.f32 #s(literal 1 binary32) (+.f32 #s(literal 1 binary32) (exp.f32 (/.f32 (PI.f32) s)))))) #s(literal 1 binary32)))) < -9.99999968e-20

              1. Initial program 99.1%

                \[\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. Taylor expanded in u around 0

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

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

                  \[\leadsto -\mathsf{PI}\left(\right) \]
                3. lift-PI.f3215.2

                  \[\leadsto -\pi \]
              4. Applied rewrites15.2%

                \[\leadsto \color{blue}{-\pi} \]

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

              1. Initial program 98.8%

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

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

                \[\leadsto \log \color{blue}{1} \]
              4. Step-by-step derivation
                1. Applied rewrites13.0%

                  \[\leadsto \log \color{blue}{1} \]
              5. Recombined 2 regimes into one program.
              6. Add Preprocessing

              Alternative 15: 11.4% accurate, 46.3× 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.9%

                \[\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. Taylor expanded in u around 0

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

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

                  \[\leadsto -\mathsf{PI}\left(\right) \]
                3. lift-PI.f3211.4

                  \[\leadsto -\pi \]
              4. Applied rewrites11.4%

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

              Reproduce

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