
(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 1e-13)
(- t_0 (* (/ l_m F) (/ (PI) F)))
(- t_0 (/ (tan t_0) (* F F)))))))\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 10^{-13}:\\
\;\;\;\;t\_0 - \frac{l\_m}{F} \cdot \frac{\mathsf{PI}\left(\right)}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0 - \frac{\tan t\_0}{F \cdot F}\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 1e-13Initial program 77.9%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6474.8
Applied rewrites74.8%
Applied rewrites83.9%
if 1e-13 < (*.f64 (PI.f64) l) Initial program 67.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6467.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.9
Applied rewrites67.9%
Final simplification79.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 (- t_0 (/ (pow F -1.0) (* (/ 1.0 (tan t_0)) F))))))
\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 \left(t\_0 - \frac{{F}^{-1}}{\frac{1}{\tan t\_0} \cdot F}\right)
\end{array}
\end{array}
Initial program 75.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-tan.f64N/A
tan-quotN/A
lift-*.f64N/A
associate-/r*N/A
clear-numN/A
frac-2negN/A
frac-timesN/A
Applied rewrites81.6%
Final simplification81.6%
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 (- t_0 (/ (/ (tan t_0) F) F)))))
\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 \left(t\_0 - \frac{\frac{\tan t\_0}{F}}{F}\right)
\end{array}
\end{array}
Initial program 75.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6481.6
Applied rewrites81.6%
Final simplification81.6%
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 5e-10)
(- t_0 (* (/ l_m F) (/ (PI) F)))
(- t_0 (* (- l_m) (/ (PI) (* F F))))))))\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 5 \cdot 10^{-10}:\\
\;\;\;\;t\_0 - \frac{l\_m}{F} \cdot \frac{\mathsf{PI}\left(\right)}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0 - \left(-l\_m\right) \cdot \frac{\mathsf{PI}\left(\right)}{F \cdot F}\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 5.00000000000000031e-10Initial program 78.3%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6475.2
Applied rewrites75.2%
Applied rewrites84.1%
if 5.00000000000000031e-10 < (*.f64 (PI.f64) l) Initial program 66.5%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6446.5
Applied rewrites46.5%
Applied rewrites51.0%
Final simplification75.1%
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 5e-10)
(- t_0 (/ t_0 (* F F)))
(- t_0 (* (- l_m) (/ (PI) (* F F))))))))\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 5 \cdot 10^{-10}:\\
\;\;\;\;t\_0 - \frac{t\_0}{F \cdot F}\\
\mathbf{else}:\\
\;\;\;\;t\_0 - \left(-l\_m\right) \cdot \frac{\mathsf{PI}\left(\right)}{F \cdot F}\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 5.00000000000000031e-10Initial program 78.3%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6475.2
Applied rewrites75.2%
Applied rewrites75.7%
if 5.00000000000000031e-10 < (*.f64 (PI.f64) l) Initial program 66.5%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6446.5
Applied rewrites46.5%
Applied rewrites51.0%
Final simplification68.9%
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 (- t_0 (/ t_0 (* F F))))))
\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 \left(t\_0 - \frac{t\_0}{F \cdot F}\right)
\end{array}
\end{array}
Initial program 75.1%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6467.4
Applied rewrites67.4%
Applied rewrites67.7%
Final simplification67.7%
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)) (* (/ l_m (* F F)) (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) - \frac{l\_m}{F \cdot F} \cdot \mathsf{PI}\left(\right)\right)
\end{array}
Initial program 75.1%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6467.4
Applied rewrites67.4%
Applied rewrites49.7%
Applied rewrites67.7%
Final simplification67.7%
herbie shell --seed 2024312
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* (PI) l) (* (/ 1.0 (* F F)) (tan (* (PI) l)))))