
(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 (* (PI) l_m)))
(*
l_s
(if (<= t_0 100000000.0)
(- t_0 (/ (/ (tan (* l_m (PI))) F) F))
(* (/ l_m (PI)) (* (PI) (PI)))))))\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 100000000:\\
\;\;\;\;t\_0 - \frac{\frac{\tan \left(l\_m \cdot \mathsf{PI}\left(\right)\right)}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\frac{l\_m}{\mathsf{PI}\left(\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 1e8Initial program 76.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6484.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.1
Applied rewrites84.1%
if 1e8 < (*.f64 (PI.f64) l) Initial program 67.8%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.6
Applied rewrites99.6%
Applied rewrites99.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 (* (PI) l_m)))
(*
l_s
(if (<= t_0 100000000.0)
(- t_0 (/ (/ t_0 F) F))
(* (/ l_m (PI)) (* (PI) (PI)))))))\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 100000000:\\
\;\;\;\;t\_0 - \frac{\frac{t\_0}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\frac{l\_m}{\mathsf{PI}\left(\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 1e8Initial program 76.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6484.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.1
Applied rewrites84.1%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6477.8
Applied rewrites77.8%
Applied rewrites77.8%
if 1e8 < (*.f64 (PI.f64) l) Initial program 67.8%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.6
Applied rewrites99.6%
Applied rewrites99.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 (* (PI) l_m)))
(*
l_s
(if (<= t_0 100000000.0)
(- t_0 (/ (* (/ (PI) F) l_m) F))
(* (/ l_m (PI)) (* (PI) (PI)))))))\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 100000000:\\
\;\;\;\;t\_0 - \frac{\frac{\mathsf{PI}\left(\right)}{F} \cdot l\_m}{F}\\
\mathbf{else}:\\
\;\;\;\;\frac{l\_m}{\mathsf{PI}\left(\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 1e8Initial program 76.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6484.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.1
Applied rewrites84.1%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6477.8
Applied rewrites77.8%
if 1e8 < (*.f64 (PI.f64) l) Initial program 67.8%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.6
Applied rewrites99.6%
Applied rewrites99.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 (* (PI) l_m)))
(*
l_s
(if (<= t_0 100000000.0)
(- t_0 (/ (* (PI) (/ l_m F)) F))
(* (/ l_m (PI)) (* (PI) (PI)))))))\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 100000000:\\
\;\;\;\;t\_0 - \frac{\mathsf{PI}\left(\right) \cdot \frac{l\_m}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;\frac{l\_m}{\mathsf{PI}\left(\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 1e8Initial program 76.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6484.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.1
Applied rewrites84.1%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6477.8
Applied rewrites77.8%
Applied rewrites77.8%
if 1e8 < (*.f64 (PI.f64) l) Initial program 67.8%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.6
Applied rewrites99.6%
Applied rewrites99.6%
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
:precision binary64
(*
l_s
(if (<= (* (PI) l_m) 100000000.0)
(* (- (PI) (/ (PI) (* F F))) l_m)
(* (/ l_m (PI)) (* (PI) (PI))))))\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;\mathsf{PI}\left(\right) \cdot l\_m \leq 100000000:\\
\;\;\;\;\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F \cdot F}\right) \cdot l\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{l\_m}{\mathsf{PI}\left(\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\\
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 1e8Initial program 76.2%
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-*.f6469.9
Applied rewrites69.9%
if 1e8 < (*.f64 (PI.f64) l) Initial program 67.8%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.6
Applied rewrites99.6%
Applied rewrites99.6%
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)) (* (PI) (PI)))))
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
l\_s \cdot \left(\frac{l\_m}{\mathsf{PI}\left(\right)} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right)
\end{array}
Initial program 74.4%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6473.5
Applied rewrites73.5%
Applied rewrites73.6%
l\_m = (fabs.f64 l) l\_s = (copysign.f64 #s(literal 1 binary64) l) (FPCore (l_s F l_m) :precision binary64 (* l_s (* (PI) l_m)))
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
l\_s \cdot \left(\mathsf{PI}\left(\right) \cdot l\_m\right)
\end{array}
Initial program 74.4%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6473.5
Applied rewrites73.5%
herbie shell --seed 2024305
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* (PI) l) (* (/ 1.0 (* F F)) (tan (* (PI) l)))))