
(FPCore (F l) :precision binary64 (let* ((t_0 (* (PI) l))) (- t_0 (* (/ 1.0 (* F F)) (tan t_0)))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \ell\\
t\_0 - \frac{1}{F \cdot F} \cdot \tan t\_0
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F l) :precision binary64 (let* ((t_0 (* (PI) l))) (- t_0 (* (/ 1.0 (* F F)) (tan t_0)))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \ell\\
t\_0 - \frac{1}{F \cdot F} \cdot \tan t\_0
\end{array}
\end{array}
l\_m = (fabs.f64 l) l\_s = (copysign.f64 #s(literal 1 binary64) l) (FPCore (l_s F l_m) :precision binary64 (let* ((t_0 (* l_m (PI)))) (* l_s (if (<= t_0 2000000000000.0) (- t_0 (/ (/ (tan t_0) F) F)) t_0))))
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
\begin{array}{l}
t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2000000000000:\\
\;\;\;\;t\_0 - \frac{\frac{\tan t\_0}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 2e12Initial program 72.0%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6482.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.3
Applied rewrites82.3%
if 2e12 < (*.f64 (PI.f64) l) Initial program 71.6%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.6
Applied rewrites99.6%
Final simplification86.2%
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
:precision binary64
(let* ((t_0 (* l_m (PI))) (t_1 (- t_0 (* (tan t_0) (/ 1.0 (* F F))))))
(*
l_s
(if (<= t_1 -1e+204)
t_0
(if (<= t_1 -5e-261) (* (/ (- (PI)) (* F F)) l_m) t_0)))))\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
\begin{array}{l}
t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
t_1 := t\_0 - \tan t\_0 \cdot \frac{1}{F \cdot F}\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+204}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-261}:\\
\;\;\;\;\frac{-\mathsf{PI}\left(\right)}{F \cdot F} \cdot l\_m\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) < -9.99999999999999989e203 or -4.99999999999999981e-261 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) Initial program 62.8%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6473.8
Applied rewrites73.8%
if -9.99999999999999989e203 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) < -4.99999999999999981e-261Initial program 94.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6494.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6494.2
Applied rewrites94.2%
Taylor expanded in l around 0
*-commutativeN/A
sub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-PI.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6484.0
Applied rewrites84.0%
Taylor expanded in F around 0
Applied rewrites16.7%
Final simplification57.3%
l\_m = (fabs.f64 l) l\_s = (copysign.f64 #s(literal 1 binary64) l) (FPCore (l_s F l_m) :precision binary64 (let* ((t_0 (* l_m (PI)))) (* l_s (if (<= t_0 2000000000000.0) (- t_0 (/ (/ t_0 F) F)) t_0))))
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
\begin{array}{l}
t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2000000000000:\\
\;\;\;\;t\_0 - \frac{\frac{t\_0}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 2e12Initial program 72.0%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6482.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.3
Applied rewrites82.3%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6477.2
Applied rewrites77.2%
if 2e12 < (*.f64 (PI.f64) l) Initial program 71.6%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.6
Applied rewrites99.6%
Final simplification82.2%
l\_m = (fabs.f64 l) l\_s = (copysign.f64 #s(literal 1 binary64) l) (FPCore (l_s F l_m) :precision binary64 (let* ((t_0 (* l_m (PI)))) (* l_s (if (<= t_0 2000000000000.0) (- t_0 (/ (* (/ (PI) F) l_m) F)) t_0))))
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
\begin{array}{l}
t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2000000000000:\\
\;\;\;\;t\_0 - \frac{\frac{\mathsf{PI}\left(\right)}{F} \cdot l\_m}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 2e12Initial program 72.0%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6482.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.3
Applied rewrites82.3%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6477.1
Applied rewrites77.1%
if 2e12 < (*.f64 (PI.f64) l) Initial program 71.6%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.6
Applied rewrites99.6%
Final simplification82.2%
l\_m = (fabs.f64 l) l\_s = (copysign.f64 #s(literal 1 binary64) l) (FPCore (l_s F l_m) :precision binary64 (let* ((t_0 (* l_m (PI)))) (* l_s (if (<= t_0 2000000000000.0) (- t_0 (* t_0 (/ 1.0 (* F F)))) t_0))))
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
\begin{array}{l}
t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2000000000000:\\
\;\;\;\;t\_0 - t\_0 \cdot \frac{1}{F \cdot F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 2e12Initial program 72.0%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6466.8
Applied rewrites66.8%
if 2e12 < (*.f64 (PI.f64) l) Initial program 71.6%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.6
Applied rewrites99.6%
Final simplification74.2%
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
:precision binary64
(let* ((t_0 (* l_m (PI))))
(*
l_s
(if (<= t_0 2000000000000.0) (* (- (PI) (/ (PI) (* F F))) l_m) t_0))))\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
\begin{array}{l}
t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2000000000000:\\
\;\;\;\;\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F \cdot F}\right) \cdot l\_m\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 2e12Initial program 72.0%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-PI.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6466.8
Applied rewrites66.8%
if 2e12 < (*.f64 (PI.f64) l) Initial program 71.6%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.6
Applied rewrites99.6%
Final simplification74.2%
l\_m = (fabs.f64 l) l\_s = (copysign.f64 #s(literal 1 binary64) l) (FPCore (l_s F l_m) :precision binary64 (* l_s (* l_m (PI))))
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
l\_s \cdot \left(l\_m \cdot \mathsf{PI}\left(\right)\right)
\end{array}
Initial program 71.9%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6475.8
Applied rewrites75.8%
Final simplification75.8%
herbie shell --seed 2024284
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* (PI) l) (* (/ 1.0 (* F F)) (tan (* (PI) l)))))