
(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 (* l_m (PI)))) (* l_s (if (<= t_0 1e+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 := l\_m \cdot \mathsf{PI}\left(\right)\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 10^{+15}:\\
\;\;\;\;t\_0 - \frac{\frac{\tan t\_0}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 1e15Initial program 78.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6485.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.9
Applied rewrites85.9%
if 1e15 < (*.f64 (PI.f64) l) Initial program 59.9%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6499.7
Applied rewrites99.7%
Final simplification89.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 (* l_m (PI))) (t_1 (- t_0 (* (tan t_0) (pow (* F F) -1.0)))))
(*
l_s
(if (or (<= t_1 -5e+276)
(not (or (<= t_1 -1e+124) (not (<= t_1 -2e-132)))))
(* (- 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 := l\_m \cdot \mathsf{PI}\left(\right)\\
t_1 := t\_0 - \tan t\_0 \cdot {\left(F \cdot F\right)}^{-1}\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+276} \lor \neg \left(t\_1 \leq -1 \cdot 10^{+124} \lor \neg \left(t\_1 \leq -2 \cdot 10^{-132}\right)\right):\\
\;\;\;\;\left(-l\_m\right) \cdot \frac{\mathsf{PI}\left(\right)}{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.00000000000000001e276 or -9.99999999999999948e123 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) < -2e-132Initial program 66.7%
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-*.f6458.0
Applied rewrites58.0%
Taylor expanded in F around 0
Applied rewrites33.6%
Applied rewrites24.0%
if -5.00000000000000001e276 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) < -9.99999999999999948e123 or -2e-132 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) Initial program 76.6%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6478.8
Applied rewrites78.8%
Final simplification62.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 (* l_m (PI))) (t_1 (- t_0 (* (tan t_0) (pow (* F F) -1.0)))))
(*
l_s
(if (<= t_1 -5e+276)
(/ (* (- (PI)) l_m) (* F F))
(if (or (<= t_1 -1e+124) (not (<= t_1 -2e-132)))
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 := l\_m \cdot \mathsf{PI}\left(\right)\\
t_1 := t\_0 - \tan t\_0 \cdot {\left(F \cdot F\right)}^{-1}\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+276}:\\
\;\;\;\;\frac{\left(-\mathsf{PI}\left(\right)\right) \cdot l\_m}{F \cdot F}\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+124} \lor \neg \left(t\_1 \leq -2 \cdot 10^{-132}\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)))) < -5.00000000000000001e276Initial program 30.7%
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-*.f6423.9
Applied rewrites23.9%
Taylor expanded in F around 0
Applied rewrites41.8%
Applied rewrites23.3%
if -5.00000000000000001e276 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) < -9.99999999999999948e123 or -2e-132 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) Initial program 76.6%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6478.8
Applied rewrites78.8%
if -9.99999999999999948e123 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) < -2e-132Initial program 98.4%
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-*.f6487.9
Applied rewrites87.9%
Taylor expanded in F around 0
Applied rewrites26.4%
Applied rewrites26.4%
Final simplification62.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 (* l_m (PI)))) (* l_s (if (<= t_0 2e+14) (- t_0 (/ (* (/ 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 := l\_m \cdot \mathsf{PI}\left(\right)\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+14}:\\
\;\;\;\;t\_0 - \frac{\frac{l\_m}{F} \cdot \mathsf{PI}\left(\right)}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 2e14Initial program 78.4%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6485.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.8
Applied rewrites85.8%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6480.1
Applied rewrites80.1%
Applied rewrites80.1%
if 2e14 < (*.f64 (PI.f64) l) Initial program 60.5%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6498.3
Applied rewrites98.3%
Final simplification84.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 (* l_m (PI)))) (* l_s (if (<= t_0 2e+14) (- t_0 (* (/ (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 := l\_m \cdot \mathsf{PI}\left(\right)\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+14}:\\
\;\;\;\;t\_0 - \frac{\mathsf{PI}\left(\right)}{F \cdot F} \cdot l\_m\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 (PI.f64) l) < 2e14Initial program 78.4%
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-*.f6472.7
Applied rewrites72.7%
if 2e14 < (*.f64 (PI.f64) l) Initial program 60.5%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6498.3
Applied rewrites98.3%
Final simplification79.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 (* l_m (PI)))) (* l_s (if (<= t_0 2e+14) (* (- (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 := l\_m \cdot \mathsf{PI}\left(\right)\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+14}:\\
\;\;\;\;\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) < 2e14Initial program 78.4%
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-*.f6472.7
Applied rewrites72.7%
if 2e14 < (*.f64 (PI.f64) l) Initial program 60.5%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6498.3
Applied rewrites98.3%
Final simplification79.5%
l\_m = (fabs.f64 l) l\_s = (copysign.f64 #s(literal 1 binary64) l) (FPCore (l_s F l_m) :precision binary64 (* l_s (* l_m (PI))))
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)
\\
l\_s \cdot \left(l\_m \cdot \mathsf{PI}\left(\right)\right)
\end{array}
Initial program 73.6%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6474.9
Applied rewrites74.9%
Final simplification74.9%
herbie shell --seed 2024271
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* (PI) l) (* (/ 1.0 (* F F)) (tan (* (PI) l)))))