
(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 50000000000000.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 50000000000000:\\
\;\;\;\;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) < 5e13Initial program 84.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6493.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.1
Applied rewrites93.1%
if 5e13 < (*.f64 (PI.f64) l) Initial program 57.0%
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 (* (pow (* F F) -1.0) (tan t_0))) -2e-231)
(* (/ (- (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 -2 \cdot 10^{-231}:\\
\;\;\;\;\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)))) < -2e-231Initial program 77.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6484.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.9
Applied rewrites84.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-*.f6471.0
Applied rewrites71.0%
Taylor expanded in F around 0
Applied rewrites22.8%
Applied rewrites22.8%
if -2e-231 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) Initial program 78.9%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6474.7
Applied rewrites74.7%
Final simplification50.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 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 84.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6493.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.1
Applied rewrites93.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-*.f6480.7
Applied rewrites80.7%
Taylor expanded in F around 0
Applied rewrites80.7%
if 5e13 < (*.f64 (PI.f64) l) Initial program 57.0%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.6
Applied rewrites99.6%
Final simplification85.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)
(fma (PI) l_m (/ -1.0 (* F (/ F (* 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 50000000000000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{PI}\left(\right), l\_m, \frac{-1}{F \cdot \frac{F}{l\_m \cdot \mathsf{PI}\left(\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 5e13Initial program 84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
*-lft-identityN/A
lower-/.f6485.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.6
Applied rewrites85.6%
Taylor expanded in l around 0
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-/.f6488.8
Applied rewrites88.8%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6488.8
Applied rewrites88.8%
Applied rewrites88.8%
if 5e13 < (*.f64 (PI.f64) l) Initial program 57.0%
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 50000000000000.0)
(fma (* (/ (PI) F) l_m) (/ -1.0 F) 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}\;t\_0 \leq 50000000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{F} \cdot l\_m, \frac{-1}{F}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 5e13Initial program 84.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6493.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.1
Applied rewrites93.1%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
div-invN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
div-invN/A
lift-/.f64N/A
lower-fma.f6493.0
lift-*.f64N/A
*-commutativeN/A
lift-*.f6493.0
Applied rewrites93.0%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6488.7
Applied rewrites88.7%
if 5e13 < (*.f64 (PI.f64) l) Initial program 57.0%
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 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 84.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-*.f6480.7
Applied rewrites80.7%
if 5e13 < (*.f64 (PI.f64) l) Initial program 57.0%
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 78.1%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6472.6
Applied rewrites72.6%
herbie shell --seed 2024307
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* (PI) l) (* (/ 1.0 (* F F)) (tan (* (PI) l)))))