
(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 9 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 9e-13)
(- t_0 (/ (/ t_0 F) F))
(if (<= l_m 2.6e+15) (- t_0 (* (/ 1.0 (* F F)) (tan t_0))) 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 9 \cdot 10^{-13}:\\
\;\;\;\;t\_0 - \frac{\frac{t\_0}{F}}{F}\\
\mathbf{elif}\;l\_m \leq 2.6 \cdot 10^{+15}:\\
\;\;\;\;t\_0 - \frac{1}{F \cdot F} \cdot \tan t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 9e-13Initial program 81.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-tan.f64N/A
quot-tanN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6488.3
Applied rewrites88.3%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
inv-powN/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
times-fracN/A
associate-/r*N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
Applied rewrites88.3%
Taylor expanded in l around 0
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6483.0
Applied rewrites83.0%
if 9e-13 < l < 2.6e15Initial program 87.5%
if 2.6e15 < l Initial program 65.4%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6499.5
Applied rewrites99.5%
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 (* (/ 1.0 (* F F)) (tan t_0))) -5e-237)
(/ (* (- (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}\;t\_0 - \frac{1}{F \cdot F} \cdot \tan t\_0 \leq -5 \cdot 10^{-237}:\\
\;\;\;\;\frac{\left(-\mathsf{PI}\left(\right)\right) \cdot l\_m}{F \cdot F}\\
\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)))) < -5.0000000000000002e-237Initial program 79.2%
Taylor expanded in F around 0
associate-*r/N/A
times-fracN/A
quot-tanN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-tan.f6425.8
Applied rewrites25.8%
Taylor expanded in l around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
pow2N/A
lift-*.f6425.4
Applied rewrites25.4%
if -5.0000000000000002e-237 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) Initial program 77.0%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6475.0
Applied rewrites75.0%
Final simplification53.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 5.2e-9)
(- t_0 (/ (/ t_0 F) F))
(if (<= l_m 2.6e+15)
(- t_0 (/ (tan (fma (PI) 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 5.2 \cdot 10^{-9}:\\
\;\;\;\;t\_0 - \frac{\frac{t\_0}{F}}{F}\\
\mathbf{elif}\;l\_m \leq 2.6 \cdot 10^{+15}:\\
\;\;\;\;t\_0 - \frac{\tan \left(\mathsf{fma}\left(\mathsf{PI}\left(\right), l\_m, \mathsf{PI}\left(\right)\right)\right)}{F \cdot F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 5.2000000000000002e-9Initial program 81.8%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-tan.f64N/A
quot-tanN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6488.3
Applied rewrites88.3%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
inv-powN/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
times-fracN/A
associate-/r*N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
Applied rewrites88.4%
Taylor expanded in l around 0
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6483.1
Applied rewrites83.1%
if 5.2000000000000002e-9 < l < 2.6e15Initial program 85.7%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-/.f64N/A
lift-tan.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-tan.f64N/A
pow2N/A
lift-*.f6485.7
Applied rewrites85.7%
lift-*.f64N/A
lift-tan.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-lft-identityN/A
lift-*.f64N/A
lift-PI.f64N/A
tan-+PI-revN/A
lower-tan.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-PI.f64N/A
lift-PI.f6484.8
Applied rewrites84.8%
if 2.6e15 < l Initial program 65.4%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6499.5
Applied rewrites99.5%
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 2.6e+15) (- 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 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;l\_m \leq 2.6 \cdot 10^{+15}:\\
\;\;\;\;t\_0 - \frac{\frac{\tan t\_0}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 2.6e15Initial program 82.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-tan.f64N/A
quot-tanN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6488.2
Applied rewrites88.2%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
inv-powN/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
times-fracN/A
associate-/r*N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
Applied rewrites88.3%
if 2.6e15 < l Initial program 65.4%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6499.5
Applied rewrites99.5%
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 1600.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 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;l\_m \leq 1600:\\
\;\;\;\;t\_0 - \frac{\frac{t\_0}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 1600Initial program 82.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-tan.f64N/A
quot-tanN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6488.5
Applied rewrites88.5%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
inv-powN/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
times-fracN/A
associate-/r*N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
Applied rewrites88.5%
Taylor expanded in l around 0
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6483.3
Applied rewrites83.3%
if 1600 < l Initial program 66.5%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6493.9
Applied rewrites93.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 (* (PI) l_m))) (* l_s (if (<= l_m 1600.0) (- t_0 (/ (* 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 1600:\\
\;\;\;\;t\_0 - \frac{l\_m \cdot \frac{\mathsf{PI}\left(\right)}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 1600Initial program 82.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-tan.f64N/A
quot-tanN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6488.5
Applied rewrites88.5%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
inv-powN/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
times-fracN/A
associate-/r*N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
Applied rewrites88.5%
Taylor expanded in l around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-PI.f6483.3
Applied rewrites83.3%
if 1600 < l Initial program 66.5%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6493.9
Applied rewrites93.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 (* (PI) l_m))) (* l_s (if (<= l_m 1600.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 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;l\_m \leq 1600:\\
\;\;\;\;t\_0 - \frac{t\_0}{F \cdot F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 1600Initial program 82.0%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-/.f64N/A
lift-tan.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-tan.f64N/A
pow2N/A
lift-*.f6482.8
Applied rewrites82.8%
Taylor expanded in l around 0
*-lft-identityN/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6477.6
Applied rewrites77.6%
if 1600 < l Initial program 66.5%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6493.9
Applied rewrites93.9%
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 1600.0) (* (- (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 1600:\\
\;\;\;\;\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 < 1600Initial program 82.0%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
pow2N/A
lift-*.f6476.8
Applied rewrites76.8%
if 1600 < l Initial program 66.5%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6493.9
Applied rewrites93.9%
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 78.0%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6473.1
Applied rewrites73.1%
herbie shell --seed 2025027
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* (PI) l) (* (/ 1.0 (* F F)) (tan (* (PI) l)))))