
(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 5 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 (<= l_m 3.8e+14)
(+ t_0 (/ (/ (/ (sin (* l_m (PI))) (cos (fma l_m (PI) (PI)))) 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 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;l\_m \leq 3.8 \cdot 10^{+14}:\\
\;\;\;\;t\_0 + \frac{\frac{\frac{\sin \left(l\_m \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(\mathsf{fma}\left(l\_m, \mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)}}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 3.8e14Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6487.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.6
Applied rewrites87.6%
lift-tan.f64N/A
tan-+PI-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
tan-+PI-revN/A
tan-quotN/A
frac-2negN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-neg.f64N/A
cos-+PI-revN/A
lower-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lower-fma.f6487.4
Applied rewrites87.4%
if 3.8e14 < l Initial program 63.6%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.6
Applied rewrites99.6%
Final simplification90.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 (* (PI) l_m))) (* l_s (if (<= l_m 3.6e+15) (- t_0 (/ (/ (tan (* l_m (PI))) 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 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;l\_m \leq 3.6 \cdot 10^{+15}:\\
\;\;\;\;t\_0 - \frac{\frac{\tan \left(l\_m \cdot \mathsf{PI}\left(\right)\right)}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 3.6e15Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6487.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.6
Applied rewrites87.6%
if 3.6e15 < l Initial program 63.6%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.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 (<= l_m 3.8e+14) (- t_0 (/ (* (PI) (/ l_m 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 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;l\_m \leq 3.8 \cdot 10^{+14}:\\
\;\;\;\;t\_0 - \frac{\mathsf{PI}\left(\right) \cdot \frac{l\_m}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 3.8e14Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6487.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.6
Applied rewrites87.6%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6482.9
Applied rewrites82.9%
Applied rewrites82.9%
if 3.8e14 < l Initial program 63.6%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.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 (<= l_m 3.8e+14) (* (- (PI) (/ (PI) (* F F))) l_m) (* (PI) l_m))))
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;l\_m \leq 3.8 \cdot 10^{+14}:\\
\;\;\;\;\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F \cdot F}\right) \cdot l\_m\\
\mathbf{else}:\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot l\_m\\
\end{array}
\end{array}
if l < 3.8e14Initial program 80.9%
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-*.f6476.3
Applied rewrites76.3%
if 3.8e14 < l Initial program 63.6%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.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 (* (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 76.8%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6475.6
Applied rewrites75.6%
herbie shell --seed 2024359
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* (PI) l) (* (/ 1.0 (* F F)) (tan (* (PI) l)))))