
(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 16 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
(*
(- s)
(log
(-
(/
1.0
(+
(*
u
(-
(/ 1.0 (+ 1.0 (exp (/ (- (PI)) s))))
(/ 1.0 (+ 1.0 (exp (/ (PI) s))))))
(/ 1.0 (+ 1.0 (exp (* (/ 1.0 s) (PI)))))))
1.0))))\begin{array}{l}
\\
\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + e^{\frac{-\mathsf{PI}\left(\right)}{s}}} - \frac{1}{1 + e^{\frac{\mathsf{PI}\left(\right)}{s}}}\right) + \frac{1}{1 + e^{\frac{1}{s} \cdot \mathsf{PI}\left(\right)}}} - 1\right)
\end{array}
Initial program 99.1%
lift-/.f32N/A
clear-numN/A
associate-/r/N/A
lower-*.f32N/A
lower-/.f3299.2
Applied rewrites99.2%
(FPCore (u s)
:precision binary32
(let* ((t_0 (/ (PI) s)) (t_1 (/ 1.0 (+ 1.0 (exp t_0)))))
(if (<=
(*
(- s)
(log
(-
(/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 (exp (/ (- (PI)) s)))) t_1)) t_1))
1.0)))
-2.9999999050033628e-15)
(*
(- s)
(log
(-
(/
1.0
(+
(*
u
(-
(/
1.0
(+ 1.0 (fma (- (fma (* t_0 (PI)) -0.5 (PI))) (/ 1.0 s) 1.0)))
t_1))
t_1))
1.0)))
(*
(- s)
(log
(-
(/
1.0
(+
(*
u
(-
(/ 1.0 (+ 1.0 (fma (fma (* -0.5 (PI)) t_0 (PI)) (/ -1.0 s) 1.0)))
t_1))
t_1))
1.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{PI}\left(\right)}{s}\\
t_1 := \frac{1}{1 + e^{t\_0}}\\
\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.9999999050033628 \cdot 10^{-15}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \mathsf{fma}\left(-\mathsf{fma}\left(t\_0 \cdot \mathsf{PI}\left(\right), -0.5, \mathsf{PI}\left(\right)\right), \frac{1}{s}, 1\right)} - t\_1\right) + t\_1} - 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot \mathsf{PI}\left(\right), t\_0, \mathsf{PI}\left(\right)\right), \frac{-1}{s}, 1\right)} - t\_1\right) + t\_1} - 1\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.99999991e-15Initial program 99.0%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
unpow2N/A
associate-/l*N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-/.f32N/A
lower-PI.f32N/A
lower-PI.f329.9
Applied rewrites10.7%
Applied rewrites50.0%
if -2.99999991e-15 < (*.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 99.2%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
unpow2N/A
associate-/l*N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-/.f32N/A
lower-PI.f32N/A
lower-PI.f320.0
Applied rewrites0.0%
Applied rewrites0.0%
Applied rewrites48.6%
Final simplification49.9%
(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 99.1%
(FPCore (u s)
:precision binary32
(let* ((t_0 (/ (PI) s)) (t_1 (/ 1.0 (+ 1.0 (exp t_0)))))
(if (<= s 9.999999998199587e-24)
(*
(- s)
(log
(-
(/
1.0
(+
(*
u
(-
(/
1.0
(+ 1.0 (fma (- (fma (* -0.5 (PI)) t_0 (PI))) (/ 1.0 s) 1.0)))
t_1))
t_1))
1.0)))
(*
(- s)
(log
(-
(/
1.0
(+
(*
u
(-
(/
1.0
(+ 1.0 (fma (- (fma (* t_0 (PI)) -0.5 (PI))) (/ 1.0 s) 1.0)))
t_1))
t_1))
1.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{PI}\left(\right)}{s}\\
t_1 := \frac{1}{1 + e^{t\_0}}\\
\mathbf{if}\;s \leq 9.999999998199587 \cdot 10^{-24}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \mathsf{fma}\left(-\mathsf{fma}\left(-0.5 \cdot \mathsf{PI}\left(\right), t\_0, \mathsf{PI}\left(\right)\right), \frac{1}{s}, 1\right)} - t\_1\right) + t\_1} - 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \mathsf{fma}\left(-\mathsf{fma}\left(t\_0 \cdot \mathsf{PI}\left(\right), -0.5, \mathsf{PI}\left(\right)\right), \frac{1}{s}, 1\right)} - t\_1\right) + t\_1} - 1\right)\\
\end{array}
\end{array}
if s < 1e-23Initial program 99.3%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
unpow2N/A
associate-/l*N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-/.f32N/A
lower-PI.f32N/A
lower-PI.f320.0
Applied rewrites0.0%
Applied rewrites0.1%
Applied rewrites51.2%
if 1e-23 < s Initial program 99.0%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
unpow2N/A
associate-/l*N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-/.f32N/A
lower-PI.f32N/A
lower-PI.f325.3
Applied rewrites6.4%
Applied rewrites51.0%
(FPCore (u s)
:precision binary32
(let* ((t_0 (/ (PI) s)) (t_1 (/ 1.0 (+ 1.0 (exp t_0)))))
(if (<= s 4.999999999099794e-24)
(*
(- s)
(log
(-
(/
1.0
(+
(*
u
(-
(/
1.0
(+ 1.0 (fma (- (fma (* -0.5 (PI)) t_0 (PI))) (/ 1.0 s) 1.0)))
t_1))
t_1))
1.0)))
(*
(- s)
(log
(-
(/
1.0
(+
(*
u
(-
(/ 1.0 (+ 1.0 (fma -1.0 (/ (fma (* t_0 (PI)) -0.5 (PI)) s) 1.0)))
t_1))
t_1))
1.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{PI}\left(\right)}{s}\\
t_1 := \frac{1}{1 + e^{t\_0}}\\
\mathbf{if}\;s \leq 4.999999999099794 \cdot 10^{-24}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \mathsf{fma}\left(-\mathsf{fma}\left(-0.5 \cdot \mathsf{PI}\left(\right), t\_0, \mathsf{PI}\left(\right)\right), \frac{1}{s}, 1\right)} - t\_1\right) + t\_1} - 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(t\_0 \cdot \mathsf{PI}\left(\right), -0.5, \mathsf{PI}\left(\right)\right)}{s}, 1\right)} - t\_1\right) + t\_1} - 1\right)\\
\end{array}
\end{array}
if s < 5e-24Initial program 99.4%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
unpow2N/A
associate-/l*N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-/.f32N/A
lower-PI.f32N/A
lower-PI.f320.0
Applied rewrites0.0%
Applied rewrites0.0%
Applied rewrites50.1%
if 5e-24 < s Initial program 98.9%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
unpow2N/A
associate-/l*N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-/.f32N/A
lower-PI.f32N/A
lower-PI.f324.4
Applied rewrites5.0%
Applied rewrites54.6%
(FPCore (u s)
:precision binary32
(let* ((t_0 (/ (PI) s)) (t_1 (/ 1.0 (+ 1.0 (exp t_0)))))
(if (<= u 0.0004600000102072954)
(*
(- s)
(log
(-
(/
1.0
(+
(*
u
(-
(/ 1.0 (+ 1.0 (fma (fma (* t_0 (PI)) -0.5 (PI)) (/ -1.0 s) 1.0)))
t_1))
t_1))
1.0)))
(*
(- s)
(log
(-
(/
1.0
(+
(*
u
(-
(/ 1.0 (+ 1.0 (fma (fma (* -0.5 (PI)) t_0 (PI)) (/ -1.0 s) 1.0)))
t_1))
t_1))
1.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{PI}\left(\right)}{s}\\
t_1 := \frac{1}{1 + e^{t\_0}}\\
\mathbf{if}\;u \leq 0.0004600000102072954:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \mathsf{fma}\left(\mathsf{fma}\left(t\_0 \cdot \mathsf{PI}\left(\right), -0.5, \mathsf{PI}\left(\right)\right), \frac{-1}{s}, 1\right)} - t\_1\right) + t\_1} - 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot \mathsf{PI}\left(\right), t\_0, \mathsf{PI}\left(\right)\right), \frac{-1}{s}, 1\right)} - t\_1\right) + t\_1} - 1\right)\\
\end{array}
\end{array}
if u < 4.6000001e-4Initial program 99.2%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
unpow2N/A
associate-/l*N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-/.f32N/A
lower-PI.f32N/A
lower-PI.f323.8
Applied rewrites3.8%
Applied rewrites51.7%
if 4.6000001e-4 < u Initial program 98.8%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
unpow2N/A
associate-/l*N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-/.f32N/A
lower-PI.f32N/A
lower-PI.f320.6
Applied rewrites0.6%
Applied rewrites1.2%
Applied rewrites44.9%
Final simplification50.5%
(FPCore (u s)
:precision binary32
(let* ((t_0 (/ (PI) s)) (t_1 (/ 1.0 (+ 1.0 (exp t_0)))))
(*
(- s)
(log
(-
(/
1.0
(+
(*
u
(-
(/ 1.0 (+ 1.0 (fma -1.0 (/ (fma (* t_0 (PI)) -0.5 (PI)) s) 1.0)))
t_1))
t_1))
1.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{PI}\left(\right)}{s}\\
t_1 := \frac{1}{1 + e^{t\_0}}\\
\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(t\_0 \cdot \mathsf{PI}\left(\right), -0.5, \mathsf{PI}\left(\right)\right)}{s}, 1\right)} - t\_1\right) + t\_1} - 1\right)
\end{array}
\end{array}
Initial program 99.1%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
unpow2N/A
associate-/l*N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-/.f32N/A
lower-PI.f32N/A
lower-PI.f322.6
Applied rewrites2.3%
Applied rewrites53.4%
(FPCore (u s)
:precision binary32
(let* ((t_0 (/ (PI) s)) (t_1 (/ 1.0 (+ 1.0 (exp t_0)))))
(*
(- s)
(log
(-
(/
1.0
(+
(*
u
(-
(/ 1.0 (+ 1.0 (fma -1.0 (/ (fma (* -0.5 (PI)) t_0 (PI)) s) 1.0)))
t_1))
t_1))
1.0)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{PI}\left(\right)}{s}\\
t_1 := \frac{1}{1 + e^{t\_0}}\\
\left(-s\right) \cdot \log \left(\frac{1}{u \cdot \left(\frac{1}{1 + \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.5 \cdot \mathsf{PI}\left(\right), t\_0, \mathsf{PI}\left(\right)\right)}{s}, 1\right)} - t\_1\right) + t\_1} - 1\right)
\end{array}
\end{array}
Initial program 99.1%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
unpow2N/A
associate-/l*N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-/.f32N/A
lower-PI.f32N/A
lower-PI.f322.6
Applied rewrites2.5%
Applied rewrites2.5%
Applied rewrites50.9%
(FPCore (u s) :precision binary32 (let* ((t_0 (/ 1.0 (+ 1.0 (exp (/ (PI) s)))))) (* (- s) (log (- (/ 1.0 (+ (* u (- (/ 1.0 (+ 1.0 1.0)) 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 + 1} - t\_0\right) + t\_0} - 1\right)
\end{array}
\end{array}
Initial program 99.1%
Taylor expanded in s around inf
Applied rewrites37.8%
(FPCore (u s)
:precision binary32
(*
(- s)
(log
(-
(-
(fma -4.0 (/ (fma (* 0.5 (PI)) u (* 0.25 (PI))) s) 2.0)
(* -2.0 (/ (PI) s)))
1.0))))\begin{array}{l}
\\
\left(-s\right) \cdot \log \left(\left(\mathsf{fma}\left(-4, \frac{\mathsf{fma}\left(0.5 \cdot \mathsf{PI}\left(\right), u, 0.25 \cdot \mathsf{PI}\left(\right)\right)}{s}, 2\right) - -2 \cdot \frac{\mathsf{PI}\left(\right)}{s}\right) - 1\right)
\end{array}
Initial program 99.1%
lift-/.f32N/A
clear-numN/A
lower-/.f32N/A
lower-/.f3299.1
Applied rewrites99.1%
lift-+.f32N/A
+-commutativeN/A
lift-/.f32N/A
lift-/.f32N/A
clear-numN/A
lift-/.f32N/A
flip-+N/A
Applied rewrites99.1%
Taylor expanded in s around inf
lower--.f32N/A
Applied rewrites21.9%
(FPCore (u s) :precision binary32 (if (<= s 3.0000000095132306e-30) (* (- s) (log (- (/ 1.0 (fma (- (PI)) (/ (fma -0.5 u 0.25) s) 0.5)) 1.0))) (* (- s) (log (- (/ 1.0 (fma (PI) (/ (fma -0.5 u 0.25) (- s)) 0.5)) 1.0)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;s \leq 3.0000000095132306 \cdot 10^{-30}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\frac{1}{\mathsf{fma}\left(-\mathsf{PI}\left(\right), \frac{\mathsf{fma}\left(-0.5, u, 0.25\right)}{s}, 0.5\right)} - 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-s\right) \cdot \log \left(\frac{1}{\mathsf{fma}\left(\mathsf{PI}\left(\right), \frac{\mathsf{fma}\left(-0.5, u, 0.25\right)}{-s}, 0.5\right)} - 1\right)\\
\end{array}
\end{array}
if s < 3e-30Initial program 99.3%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
Applied rewrites-0.0%
Applied rewrites-0.0%
Applied rewrites15.2%
if 3e-30 < s Initial program 99.1%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
Applied rewrites-0.0%
Applied rewrites-0.0%
Applied rewrites8.6%
Final simplification10.1%
(FPCore (u s) :precision binary32 (* (- s) (log (- (/ 1.0 (fma (PI) (/ (fma -0.5 u 0.25) (- s)) 0.5)) 1.0))))
\begin{array}{l}
\\
\left(-s\right) \cdot \log \left(\frac{1}{\mathsf{fma}\left(\mathsf{PI}\left(\right), \frac{\mathsf{fma}\left(-0.5, u, 0.25\right)}{-s}, 0.5\right)} - 1\right)
\end{array}
Initial program 99.1%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
Applied rewrites-0.0%
Applied rewrites-0.0%
Applied rewrites10.1%
Final simplification10.1%
(FPCore (u s) :precision binary32 (* (* (* (- (/ 0.25 u) 0.5) u) (PI)) -4.0))
\begin{array}{l}
\\
\left(\left(\left(\frac{0.25}{u} - 0.5\right) \cdot u\right) \cdot \mathsf{PI}\left(\right)\right) \cdot -4
\end{array}
Initial program 99.1%
lift-/.f32N/A
clear-numN/A
associate-/r/N/A
lower-*.f32N/A
lower-/.f3299.2
Applied rewrites99.2%
Taylor expanded in s around -inf
*-commutativeN/A
lower-*.f32N/A
cancel-sign-sub-invN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-PI.f3211.9
Applied rewrites11.9%
Taylor expanded in u around inf
Applied rewrites12.1%
(FPCore (u s) :precision binary32 (* (* (+ (* -0.5 u) 0.25) (PI)) -4.0))
\begin{array}{l}
\\
\left(\left(-0.5 \cdot u + 0.25\right) \cdot \mathsf{PI}\left(\right)\right) \cdot -4
\end{array}
Initial program 99.1%
lift-/.f32N/A
clear-numN/A
associate-/r/N/A
lower-*.f32N/A
lower-/.f3299.2
Applied rewrites99.2%
Taylor expanded in s around -inf
*-commutativeN/A
lower-*.f32N/A
cancel-sign-sub-invN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f32N/A
+-commutativeN/A
lower-fma.f32N/A
lower-PI.f3211.9
Applied rewrites11.9%
Applied rewrites12.1%
(FPCore (u s) :precision binary32 (- (PI)))
\begin{array}{l}
\\
-\mathsf{PI}\left(\right)
\end{array}
Initial program 99.1%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f32N/A
lower-PI.f3211.9
Applied rewrites11.9%
Final simplification11.9%
(FPCore (u s) :precision binary32 0.0)
float code(float u, float s) {
return 0.0f;
}
real(4) function code(u, s)
real(4), intent (in) :: u
real(4), intent (in) :: s
code = 0.0e0
end function
function code(u, s) return Float32(0.0) end
function tmp = code(u, s) tmp = single(0.0); end
\begin{array}{l}
\\
0
\end{array}
Initial program 99.1%
Taylor expanded in s around -inf
mul-1-negN/A
unsub-negN/A
lower--.f32N/A
lower-/.f32N/A
Applied rewrites-0.0%
lift--.f32N/A
Applied rewrites-0.0%
Taylor expanded in s around inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
exp-negN/A
rem-exp-logN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f3210.1
Applied rewrites10.1%
Taylor expanded in s around 0
Applied rewrites10.1%
Final simplification10.1%
herbie shell --seed 2024309
(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))))