
(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 1100000000000.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}\;l\_m \leq 1100000000000:\\
\;\;\;\;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 l < 1.1e12Initial program 79.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
*-lft-identityN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6488.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.3
Applied rewrites88.3%
if 1.1e12 < l Initial program 70.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 (* (/ 1.0 (* F F)) (tan t_0))) -2e-281)
(/ (* (- (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 - \frac{1}{F \cdot F} \cdot \tan t\_0 \leq -2 \cdot 10^{-281}:\\
\;\;\;\;\frac{\left(-\mathsf{PI}\left(\right)\right) \cdot l\_m}{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)))) < -2e-281Initial program 78.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
*-lft-identityN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6484.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.2
Applied rewrites84.2%
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-*.f6474.8
Applied rewrites74.8%
Taylor expanded in F around 0
Applied rewrites29.3%
Applied rewrites25.0%
if -2e-281 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) Initial program 75.6%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6472.8
Applied rewrites72.8%
Final simplification50.2%
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 600000000000.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}\;l\_m \leq 600000000000:\\
\;\;\;\;t\_0 - \frac{\frac{\mathsf{PI}\left(\right)}{F} \cdot l\_m}{F}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 6e11Initial program 79.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
*-lft-identityN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6488.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.3
Applied rewrites88.3%
Taylor expanded in l around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6485.7
Applied rewrites85.7%
if 6e11 < l Initial program 70.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 (<= l_m 600000000000.0) (- 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 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;l\_m \leq 600000000000:\\
\;\;\;\;t\_0 - \frac{\mathsf{PI}\left(\right)}{F \cdot F} \cdot l\_m\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 6e11Initial program 79.6%
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-*.f6477.0
Applied rewrites77.0%
if 6e11 < l Initial program 70.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 (if (<= l_m 600000000000.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 600000000000:\\
\;\;\;\;\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 < 6e11Initial program 79.6%
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-*.f6477.0
Applied rewrites77.0%
if 6e11 < l Initial program 70.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 77.1%
Taylor expanded in F around inf
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6471.9
Applied rewrites71.9%
herbie shell --seed 2025017
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* (PI) l) (* (/ 1.0 (* F F)) (tan (* (PI) l)))))