
(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 (<= t_0 1e+15)
(- t_0 (pow (/ F (/ (tan (* l_m (PI))) F)) -1.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}\;t\_0 \leq 10^{+15}:\\
\;\;\;\;t\_0 - {\left(\frac{F}{\frac{\tan \left(l\_m \cdot \mathsf{PI}\left(\right)\right)}{F}}\right)}^{-1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 1e15Initial program 80.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f6487.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.6
Applied rewrites87.6%
if 1e15 < (*.f64 (PI.f64) l) Initial program 60.8%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.7
Applied rewrites99.7%
Final simplification90.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 (* (pow (* F F) -1.0) (tan t_0))) -5e-227)
(* (/ (- (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 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 - {\left(F \cdot F\right)}^{-1} \cdot \tan t\_0 \leq -5 \cdot 10^{-227}:\\
\;\;\;\;\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)))) < -4.99999999999999961e-227Initial program 73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f6480.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.2
Applied rewrites80.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-*.f6465.8
Applied rewrites65.8%
Taylor expanded in F around 0
Applied rewrites23.2%
if -4.99999999999999961e-227 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) Initial program 77.5%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6475.5
Applied rewrites75.5%
Final simplification53.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 (* (PI) l_m))) (* l_s (if (<= t_0 1e+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}\;t\_0 \leq 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 (*.f64 (PI.f64) l) < 1e15Initial program 80.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/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 1e15 < (*.f64 (PI.f64) l) Initial program 60.8%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.7
Applied rewrites99.7%
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 50000000000000.0)
(* (* (PI) (- 1.0 (pow (* F F) -1.0))) 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 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 50000000000000:\\
\;\;\;\;\left(\mathsf{PI}\left(\right) \cdot \left(1 - {\left(F \cdot F\right)}^{-1}\right)\right) \cdot l\_m\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 5e13Initial program 81.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f6487.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.9
Applied rewrites87.9%
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-*.f6476.5
Applied rewrites76.5%
Taylor expanded in F around 0
Applied rewrites76.5%
if 5e13 < (*.f64 (PI.f64) l) Initial program 60.2%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6498.3
Applied rewrites98.3%
Final simplification82.0%
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 50000000000000.0)
(fma (PI) l_m (* (/ l_m F) (/ (- (PI)) 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 \leq 50000000000000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{PI}\left(\right), l\_m, \frac{l\_m}{F} \cdot \frac{-\mathsf{PI}\left(\right)}{F}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 5e13Initial program 81.1%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6481.6
Applied rewrites81.6%
Taylor expanded in l around 0
associate-*r/N/A
associate-*r*N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-PI.f6483.3
Applied rewrites83.3%
if 5e13 < (*.f64 (PI.f64) l) Initial program 60.2%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6498.3
Applied rewrites98.3%
Final simplification87.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 (* (PI) l_m)))
(*
l_s
(if (<= t_0 50000000000000.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}\;t\_0 \leq 50000000000000:\\
\;\;\;\;t\_0 - \frac{\frac{l\_m \cdot \mathsf{PI}\left(\right)}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 5e13Initial program 81.1%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
inv-powN/A
frac-2negN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
inv-powN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f6487.9
Applied rewrites87.9%
Taylor expanded in l around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-PI.f6483.3
Applied rewrites83.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-*.f6476.5
Applied rewrites76.5%
Applied rewrites83.2%
if 5e13 < (*.f64 (PI.f64) l) Initial program 60.2%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6498.3
Applied rewrites98.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 (<= t_0 50000000000000.0) (- 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}\;t\_0 \leq 50000000000000:\\
\;\;\;\;t\_0 - \mathsf{PI}\left(\right) \cdot \frac{l\_m}{F \cdot F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 5e13Initial program 81.1%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
inv-powN/A
frac-2negN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
inv-powN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f6487.9
Applied rewrites87.9%
Taylor expanded in l around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-PI.f6483.3
Applied rewrites83.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-*.f6476.5
Applied rewrites76.5%
Applied rewrites77.0%
if 5e13 < (*.f64 (PI.f64) l) Initial program 60.2%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6498.3
Applied rewrites98.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 (<= t_0 50000000000000.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 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 50000000000000:\\
\;\;\;\;\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) < 5e13Initial program 81.1%
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.5
Applied rewrites76.5%
if 5e13 < (*.f64 (PI.f64) l) Initial program 60.2%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6498.3
Applied rewrites98.3%
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 75.8%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6473.3
Applied rewrites73.3%
herbie shell --seed 2024314
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* (PI) l) (* (/ 1.0 (* F F)) (tan (* (PI) l)))))