
(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 780000000000.0)
(fma (PI) l_m (/ (/ (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 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;l\_m \leq 780000000000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{PI}\left(\right), l\_m, \frac{\frac{\tan t\_0}{F}}{-F}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if l < 7.8e11Initial program 80.3%
Taylor expanded in F around inf
associate-*r/N/A
times-fracN/A
quot-tanN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-tan.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6480.3
Applied rewrites80.3%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
lift-tan.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
quot-tanN/A
frac-timesN/A
associate-*r/N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites80.6%
lift-*.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-tan.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-/r*N/A
*-commutativeN/A
quot-tanN/A
mul-1-negN/A
quot-tanN/A
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites88.5%
if 7.8e11 < l Initial program 72.1%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6499.6
Applied rewrites99.6%
Final simplification90.8%
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))) -4e-272)
(/ (/ (* (- 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 - \frac{1}{F \cdot F} \cdot \tan t\_0 \leq -4 \cdot 10^{-272}:\\
\;\;\;\;\frac{\frac{\left(-l\_m\right) \cdot \mathsf{PI}\left(\right)}{F}}{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)))) < -3.99999999999999972e-272Initial program 76.6%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
pow2N/A
lift-*.f6470.0
Applied rewrites70.0%
Taylor expanded in F around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
*-commutativeN/A
lower-neg.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
pow2N/A
lift-*.f6424.8
Applied rewrites24.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-neg.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
mul-1-negN/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites32.7%
if -3.99999999999999972e-272 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) Initial program 80.0%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6468.1
Applied rewrites68.1%
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))) -4e-272)
(/ (* (- (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 -4 \cdot 10^{-272}:\\
\;\;\;\;\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)))) < -3.99999999999999972e-272Initial program 76.6%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
pow2N/A
lift-*.f6470.0
Applied rewrites70.0%
Taylor expanded in F around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
*-commutativeN/A
lower-neg.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
pow2N/A
lift-*.f6424.8
Applied rewrites24.8%
if -3.99999999999999972e-272 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) Initial program 80.0%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6468.1
Applied rewrites68.1%
Final simplification50.3%
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 7000000.0)
(fma (PI) l_m (/ (/ (* (- l_m) (PI)) F) F))
(* (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 7000000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{PI}\left(\right), l\_m, \frac{\frac{\left(-l\_m\right) \cdot \mathsf{PI}\left(\right)}{F}}{F}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot l\_m\\
\end{array}
\end{array}
if l < 7e6Initial program 80.2%
Taylor expanded in F around inf
associate-*r/N/A
times-fracN/A
quot-tanN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-tan.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6480.2
Applied rewrites80.2%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
lift-tan.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
quot-tanN/A
frac-timesN/A
associate-*r/N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites80.5%
lift-*.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
lift-tan.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-/r*N/A
*-commutativeN/A
quot-tanN/A
mul-1-negN/A
quot-tanN/A
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites88.5%
Taylor expanded in l around 0
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lift-PI.f6484.6
Applied rewrites84.6%
if 7e6 < l Initial program 72.6%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6497.8
Applied rewrites97.8%
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 7000000.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 7000000:\\
\;\;\;\;\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 < 7e6Initial program 80.2%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
pow2N/A
lift-*.f6476.3
Applied rewrites76.3%
if 7e6 < l Initial program 72.6%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6497.8
Applied rewrites97.8%
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.6%
Taylor expanded in F around inf
*-commutativeN/A
lift-*.f64N/A
lift-PI.f6468.0
Applied rewrites68.0%
herbie shell --seed 2025051
(FPCore (F l)
:name "VandenBroeck and Keller, Equation (6)"
:precision binary64
(- (* (PI) l) (* (/ 1.0 (* F F)) (tan (* (PI) l)))))