
(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 6 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 140.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}\;l\_m \leq 140:\\
\;\;\;\;t\_0 - \mathsf{PI}\left(\right) \cdot \frac{\frac{l\_m}{F}}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 140Initial program 80.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-*.f6475.7
Applied rewrites75.7%
Applied rewrites83.9%
Applied rewrites83.9%
if 140 < l Initial program 61.0%
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)) (t_1 (- t_0 (* (pow (* F F) -1.0) (tan t_0)))))
(*
l_s
(if (or (<= t_1 -2e+232) (not (<= t_1 -2e-255)))
t_0
(* (/ (- (PI)) (* F F)) l_m)))))\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 -2 \cdot 10^{+232} \lor \neg \left(t\_1 \leq -2 \cdot 10^{-255}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{-\mathsf{PI}\left(\right)}{F \cdot F} \cdot l\_m\\
\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)))) < -2.00000000000000011e232 or -2e-255 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) Initial program 67.1%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6473.7
Applied rewrites73.7%
if -2.00000000000000011e232 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) < -2e-255Initial program 95.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6495.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.0
Applied rewrites95.0%
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-*.f6486.9
Applied rewrites86.9%
Taylor expanded in F around 0
Applied rewrites25.8%
Final simplification58.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 140.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 140:\\
\;\;\;\;t\_0 - \frac{l\_m \cdot \mathsf{PI}\left(\right)}{F \cdot F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 140Initial program 80.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-*.f6475.7
Applied rewrites75.7%
Applied rewrites76.7%
if 140 < l Initial program 61.0%
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 (<= l_m 140.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}\;l\_m \leq 140:\\
\;\;\;\;t\_0 - \mathsf{PI}\left(\right) \cdot \frac{l\_m}{F \cdot F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 140Initial program 80.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-*.f6475.7
Applied rewrites75.7%
Applied rewrites76.6%
if 140 < l Initial program 61.0%
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 (* l_s (if (<= l_m 140.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 140:\\
\;\;\;\;\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 < 140Initial program 80.3%
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-*.f6475.7
Applied rewrites75.7%
if 140 < l Initial program 61.0%
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 (* 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.7%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6473.9
Applied rewrites73.9%
herbie shell --seed 2024340
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* (PI) l) (* (/ 1.0 (* F F)) (tan (* (PI) l)))))