
(FPCore (u s)
:precision binary32
(let* ((t_0 (/ 1.0 (+ 1.0 (exp (/ (PI) s))))))
(*
(- s)
(log
(-
(/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s)))) t_0)) t_0))
1.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\
\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - t\_0\right) + t\_0} - 1\right)
\end{array}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (u s)
:precision binary32
(let* ((t_0 (/ 1.0 (+ 1.0 (exp (/ (PI) s))))))
(*
(- s)
(log
(-
(/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s)))) t_0)) t_0))
1.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\
\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - t\_0\right) + t\_0} - 1\right)
\end{array}
\end{array}
(FPCore (u s)
:precision binary32
(let* ((t_0 (/ (PI) s)))
(*
(- s)
(log
(-
(/
1.0
(+
(*
u
(- (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s)))) (/ 1.0 (+ 1.0 (exp t_0)))))
(/ 1.0 (+ 1.0 (pow (E) t_0)))))
1.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{PI}\left(\right)}{s}\\
\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{t\_0}}\right) + \frac{1}{1 + {\mathsf{E}\left(\right)}^{t\_0}}} - 1\right)
\end{array}
\end{array}
Initial program 98.7%
lift-exp.f32N/A
lift-/.f32N/A
clear-numN/A
div-invN/A
clear-numN/A
lift-/.f32N/A
exp-prodN/A
lower-pow.f32N/A
exp-1-eN/A
lower-E.f3298.7
Applied rewrites98.7%
(FPCore (u s)
:precision binary32
(let* ((t_0 (fma (* 0.5 (PI)) u (* -0.25 (PI))))
(t_1 (/ 1.0 (+ 1.0 (exp (/ (PI) s)))))
(t_2 (/ t_0 s)))
(if (<=
(*
(- s)
(log
(-
(/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s)))) t_1)) t_1))
1.0)))
-4.999999999099794e-24)
(*
(- s)
(log (- (- 1.0 (/ (fma (pow t_0 2.0) -8.0 0.0) (* s s))) (* t_2 4.0))))
(* (- s) (log (fma t_2 -4.0 1.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(0.5 \cdot \mathsf{PI}\left(\right), u, -0.25 \cdot \mathsf{PI}\left(\right)\right)\\
t_1 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\
t_2 := \frac{t\_0}{s}\\
\mathbf{if}\;\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - t\_1\right) + t\_1} - 1\right) \leq -4.999999999099794 \cdot 10^{-24}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\left(1 - \frac{\mathsf{fma}\left({t\_0}^{2}, -8, 0\right)}{s \cdot s}\right) - t\_2 \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\mathsf{fma}\left(t\_2, -4, 1\right)\right)\\
\end{array}
\end{array}
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)))) < -5e-24Initial program 98.7%
Taylor expanded in s around inf
*-commutativeN/A
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-mul-1N/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
cancel-sign-sub-invN/A
associate-*r*N/A
*-commutativeN/A
mul-1-negN/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
mul-1-negN/A
Applied rewrites6.4%
Taylor expanded in s around inf
lower--.f32N/A
Applied rewrites13.1%
if -5e-24 < (*.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)))) Initial program 98.6%
Taylor expanded in s around inf
*-commutativeN/A
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-mul-1N/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
cancel-sign-sub-invN/A
associate-*r*N/A
*-commutativeN/A
mul-1-negN/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
mul-1-negN/A
Applied rewrites-0.0%
Taylor expanded in s around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites14.0%
(FPCore (u s)
:precision binary32
(let* ((t_0 (* 0.5 (PI))) (t_1 (/ 1.0 (+ 1.0 (exp (/ (PI) s))))))
(if (<=
(*
(- s)
(log
(-
(/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s)))) t_1)) t_1))
1.0)))
-2.0000000390829628e-25)
(*
(- s)
(log
(-
(-
(fma -8.0 (/ (fma (* t_0 u) 0.5 (* 0.25 (PI))) s) 2.0)
(* (/ (* (PI) 12.0) s) -0.25))
1.0)))
(* (- s) (log (fma (/ (fma t_0 u (* -0.25 (PI))) s) -4.0 1.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \mathsf{PI}\left(\right)\\
t_1 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\
\mathbf{if}\;\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - t\_1\right) + t\_1} - 1\right) \leq -2.0000000390829628 \cdot 10^{-25}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\left(\mathsf{fma}\left(-8, \frac{\mathsf{fma}\left(t\_0 \cdot u, 0.5, 0.25 \cdot \mathsf{PI}\left(\right)\right)}{s}, 2\right) - \frac{\mathsf{PI}\left(\right) \cdot 12}{s} \cdot -0.25\right) - 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\mathsf{fma}\left(\frac{\mathsf{fma}\left(t\_0, u, -0.25 \cdot \mathsf{PI}\left(\right)\right)}{s}, -4, 1\right)\right)\\
\end{array}
\end{array}
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)))) < -2.00000004e-25Initial program 98.7%
lift-exp.f32N/A
lift-/.f32N/A
clear-numN/A
div-invN/A
clear-numN/A
lift-/.f32N/A
exp-prodN/A
lower-pow.f32N/A
exp-1-eN/A
lower-E.f3298.7
Applied rewrites98.7%
Applied rewrites98.8%
Taylor expanded in s around inf
lower--.f32N/A
Applied rewrites23.0%
if -2.00000004e-25 < (*.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)))) Initial program 98.6%
Taylor expanded in s around inf
*-commutativeN/A
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-mul-1N/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
cancel-sign-sub-invN/A
associate-*r*N/A
*-commutativeN/A
mul-1-negN/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
mul-1-negN/A
Applied rewrites-0.0%
Taylor expanded in s around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites14.7%
Final simplification18.7%
(FPCore (u s)
:precision binary32
(let* ((t_0 (/ 1.0 (+ 1.0 (exp (/ (PI) s))))) (t_1 (* -0.25 (PI))))
(if (<=
(*
(- s)
(log
(-
(/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s)))) t_0)) t_0))
1.0)))
-6.000000240508405e-26)
(*
(- s)
(log
(-
(-
2.0
(/
(fma (fma (* (* -0.5 (PI)) u) 0.5 t_1) -8.0 (* 0.25 (* (PI) -12.0)))
s))
1.0)))
(* (- s) (log (fma (/ (fma (* 0.5 (PI)) u t_1) s) -4.0 1.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\
t_1 := -0.25 \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - t\_0\right) + t\_0} - 1\right) \leq -6.000000240508405 \cdot 10^{-26}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\left(2 - \frac{\mathsf{fma}\left(\mathsf{fma}\left(\left(-0.5 \cdot \mathsf{PI}\left(\right)\right) \cdot u, 0.5, t\_1\right), -8, 0.25 \cdot \left(\mathsf{PI}\left(\right) \cdot -12\right)\right)}{s}\right) - 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\mathsf{fma}\left(\frac{\mathsf{fma}\left(0.5 \cdot \mathsf{PI}\left(\right), u, t\_1\right)}{s}, -4, 1\right)\right)\\
\end{array}
\end{array}
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)))) < -6.00000024e-26Initial program 98.7%
lift-exp.f32N/A
lift-/.f32N/A
clear-numN/A
div-invN/A
clear-numN/A
lift-/.f32N/A
exp-prodN/A
lower-pow.f32N/A
exp-1-eN/A
lower-E.f3298.7
Applied rewrites98.7%
Applied rewrites98.6%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
Applied rewrites10.6%
if -6.00000024e-26 < (*.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)))) Initial program 98.6%
Taylor expanded in s around inf
*-commutativeN/A
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-mul-1N/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
cancel-sign-sub-invN/A
associate-*r*N/A
*-commutativeN/A
mul-1-negN/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
mul-1-negN/A
Applied rewrites-0.0%
Taylor expanded in s around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites14.8%
(FPCore (u s)
:precision binary32
(let* ((t_0 (/ 1.0 (+ 1.0 (exp (/ (PI) s)))))
(t_1 (* (* 4.0 (PI)) (fma 0.5 u -0.25))))
(if (<=
(*
(- s)
(log
(-
(/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s)))) t_0)) t_0))
1.0)))
-5.000000097707407e-25)
(fma (pow t_1 2.0) (/ 1.0 t_1) 0.0)
(*
(- s)
(log (fma (/ (fma (* 0.5 (PI)) u (* -0.25 (PI))) s) -4.0 1.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\
t_1 := \left(4 \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{fma}\left(0.5, u, -0.25\right)\\
\mathbf{if}\;\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - t\_0\right) + t\_0} - 1\right) \leq -5.000000097707407 \cdot 10^{-25}:\\
\;\;\;\;\mathsf{fma}\left({t\_1}^{2}, \frac{1}{t\_1}, 0\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\mathsf{fma}\left(\frac{\mathsf{fma}\left(0.5 \cdot \mathsf{PI}\left(\right), u, -0.25 \cdot \mathsf{PI}\left(\right)\right)}{s}, -4, 1\right)\right)\\
\end{array}
\end{array}
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)))) < -5.0000001e-25Initial program 98.7%
Taylor expanded in s around inf
Applied rewrites8.3%
Applied rewrites4.2%
Applied rewrites9.8%
if -5.0000001e-25 < (*.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)))) Initial program 98.6%
Taylor expanded in s around inf
*-commutativeN/A
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-mul-1N/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
cancel-sign-sub-invN/A
associate-*r*N/A
*-commutativeN/A
mul-1-negN/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
mul-1-negN/A
Applied rewrites-0.0%
Taylor expanded in s around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites14.5%
(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)))
-7.00000013679037e-25)
(* (- (* 2.0 (PI)) (/ (PI) u)) u)
(*
(- s)
(log (fma (/ (fma (* 0.5 (PI)) u (* -0.25 (PI))) s) -4.0 1.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\
\mathbf{if}\;\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - t\_0\right) + t\_0} - 1\right) \leq -7.00000013679037 \cdot 10^{-25}:\\
\;\;\;\;\left(2 \cdot \mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{u}\right) \cdot u\\
\mathbf{else}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\mathsf{fma}\left(\frac{\mathsf{fma}\left(0.5 \cdot \mathsf{PI}\left(\right), u, -0.25 \cdot \mathsf{PI}\left(\right)\right)}{s}, -4, 1\right)\right)\\
\end{array}
\end{array}
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)))) < -7.00000014e-25Initial program 98.7%
Taylor expanded in s around inf
Applied rewrites8.3%
Taylor expanded in u around inf
Applied rewrites13.6%
Applied rewrites13.7%
if -7.00000014e-25 < (*.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)))) Initial program 98.6%
Taylor expanded in s around inf
*-commutativeN/A
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-mul-1N/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
cancel-sign-sub-invN/A
associate-*r*N/A
*-commutativeN/A
mul-1-negN/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
mul-1-negN/A
Applied rewrites-0.0%
Taylor expanded in s around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites14.4%
(FPCore (u s)
:precision binary32
(let* ((t_0 (/ 1.0 (+ 1.0 (exp (/ (PI) s))))))
(*
(- s)
(log
(-
(/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s)))) t_0)) t_0))
1.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\\
\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - t\_0\right) + t\_0} - 1\right)
\end{array}
\end{array}
Initial program 98.7%
(FPCore (u s)
:precision binary32
(*
(- s)
(log
(-
(/
(/ 1.0 u)
(- (/ 1.0 (+ (exp (/ (- (PI)) s)) 1.0)) (/ 1.0 (+ (exp (/ (PI) s)) 1.0))))
1.0))))\begin{array}{l}
\\
\left(-s\right) \cdot \log \left(\frac{\frac{1}{u}}{\frac{1}{e^{\frac{-\mathsf{PI}\left(\right)}{s}} + 1} - \frac{1}{e^{\frac{\mathsf{PI}\left(\right)}{s}} + 1}} - 1\right)
\end{array}
Initial program 98.7%
Taylor expanded in s around inf
*-commutativeN/A
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-mul-1N/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
cancel-sign-sub-invN/A
associate-*r*N/A
*-commutativeN/A
mul-1-negN/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
mul-1-negN/A
Applied rewrites3.6%
Taylor expanded in u around inf
lower--.f32N/A
Applied rewrites97.2%
(FPCore (u s) :precision binary32 (* (- (* 2.0 (PI)) (/ (PI) u)) u))
\begin{array}{l}
\\
\left(2 \cdot \mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{u}\right) \cdot u
\end{array}
Initial program 98.7%
Taylor expanded in s around inf
Applied rewrites10.6%
Taylor expanded in u around inf
Applied rewrites11.1%
Applied rewrites11.4%
(FPCore (u s) :precision binary32 (* (PI) (+ (* 2.0 u) -1.0)))
\begin{array}{l}
\\
\mathsf{PI}\left(\right) \cdot \left(2 \cdot u + -1\right)
\end{array}
Initial program 98.7%
Taylor expanded in s around inf
Applied rewrites10.6%
Taylor expanded in u around inf
Applied rewrites5.1%
Taylor expanded in u around 0
Applied rewrites11.1%
Applied rewrites11.4%
(FPCore (u s) :precision binary32 (- (PI)))
\begin{array}{l}
\\
-\mathsf{PI}\left(\right)
\end{array}
Initial program 98.7%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f32N/A
lower-PI.f3211.1
Applied rewrites11.1%
herbie shell --seed 2024302
(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))))