
(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 8 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 20000000000000.0)
(- t_0 (* (pow F -1.0) (/ (tan (* l_m (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 20000000000000:\\
\;\;\;\;t\_0 - {F}^{-1} \cdot \frac{\tan \left(l\_m \cdot \mathsf{PI}\left(\right)\right)}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 2e13Initial program 79.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-/.f6488.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.1
Applied rewrites88.1%
if 2e13 < (*.f64 (PI.f64) l) Initial program 60.5%
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)) (t_1 (- t_0 (* (pow (* F F) -1.0) (tan t_0)))))
(*
l_s
(if (or (<= t_1 -1e+162) (not (<= t_1 -2e-265)))
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 := \mathsf{PI}\left(\right) \cdot l\_m\\
t_1 := t\_0 - {\left(F \cdot F\right)}^{-1} \cdot \tan t\_0\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+162} \lor \neg \left(t\_1 \leq -2 \cdot 10^{-265}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(-l\_m\right) \cdot \frac{\mathsf{PI}\left(\right)}{F \cdot F}\\
\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)))) < -9.9999999999999994e161 or -1.99999999999999997e-265 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) Initial program 67.3%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6470.9
Applied rewrites70.9%
if -9.9999999999999994e161 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) < -1.99999999999999997e-265Initial program 96.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-/.f6496.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.9
Applied rewrites96.9%
Taylor expanded in l around 0
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-PI.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6495.5
Applied rewrites95.5%
Taylor expanded in F around 0
Applied rewrites24.3%
Applied rewrites24.5%
Final simplification58.4%
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 20000000000000.0)
(- 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 20000000000000:\\
\;\;\;\;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) < 2e13Initial program 79.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6488.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.1
Applied rewrites88.1%
if 2e13 < (*.f64 (PI.f64) l) Initial program 60.5%
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 (<= t_0 40000000.0)
(fma (/ (* (- (PI)) l_m) F) (pow F -1.0) (* l_m (PI)))
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 40000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(-\mathsf{PI}\left(\right)\right) \cdot l\_m}{F}, {F}^{-1}, l\_m \cdot \mathsf{PI}\left(\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 4e7Initial program 79.0%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
lift-/.f64N/A
inv-powN/A
lift-*.f64N/A
unpow-prod-downN/A
inv-powN/A
inv-powN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites88.2%
Taylor expanded in l around 0
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-PI.f6485.4
Applied rewrites85.4%
if 4e7 < (*.f64 (PI.f64) l) Initial program 61.1%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6496.0
Applied rewrites96.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 40000000.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 40000000:\\
\;\;\;\;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) < 4e7Initial program 79.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6488.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.2
Applied rewrites88.2%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6485.4
Applied rewrites85.4%
Applied rewrites85.4%
if 4e7 < (*.f64 (PI.f64) l) Initial program 61.1%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6496.0
Applied rewrites96.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 40000000.0) (- t_0 (/ (* (/ (PI) F) l_m) 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 40000000:\\
\;\;\;\;t\_0 - \frac{\frac{\mathsf{PI}\left(\right)}{F} \cdot l\_m}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 4e7Initial program 79.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6488.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.2
Applied rewrites88.2%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6485.4
Applied rewrites85.4%
if 4e7 < (*.f64 (PI.f64) l) Initial program 61.1%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6496.0
Applied rewrites96.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 40000000.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 40000000:\\
\;\;\;\;\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) < 4e7Initial program 79.0%
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.2
Applied rewrites76.2%
if 4e7 < (*.f64 (PI.f64) l) Initial program 61.1%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6496.0
Applied rewrites96.0%
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.3%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6472.3
Applied rewrites72.3%
herbie shell --seed 2024329
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* (PI) l) (* (/ 1.0 (* F F)) (tan (* (PI) l)))))