
(FPCore (a b) :precision binary64 (* (* (/ (PI) 2.0) (/ 1.0 (- (* b b) (* a a)))) (- (/ 1.0 a) (/ 1.0 b))))
\begin{array}{l}
\\
\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b) :precision binary64 (* (* (/ (PI) 2.0) (/ 1.0 (- (* b b) (* a a)))) (- (/ 1.0 a) (/ 1.0 b))))
\begin{array}{l}
\\
\left(\frac{\mathsf{PI}\left(\right)}{2} \cdot \frac{1}{b \cdot b - a \cdot a}\right) \cdot \left(\frac{1}{a} - \frac{1}{b}\right)
\end{array}
(FPCore (a b) :precision binary64 (/ (/ (/ (- (PI)) a) b) (* -2.0 (+ b a))))
\begin{array}{l}
\\
\frac{\frac{\frac{-\mathsf{PI}\left(\right)}{a}}{b}}{-2 \cdot \left(b + a\right)}
\end{array}
Initial program 81.4%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
Applied rewrites99.6%
Taylor expanded in a around 0
mul-1-negN/A
associate-/r*N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-PI.f6499.7
Applied rewrites99.7%
(FPCore (a b) :precision binary64 (if (or (<= a -9.6e-42) (not (<= a 4.2e-48))) (/ (* 0.5 (PI)) (* (* a b) a)) (* (/ (PI) (* (* a b) b)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.6 \cdot 10^{-42} \lor \neg \left(a \leq 4.2 \cdot 10^{-48}\right):\\
\;\;\;\;\frac{0.5 \cdot \mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot b} \cdot 0.5\\
\end{array}
\end{array}
if a < -9.60000000000000011e-42 or 4.19999999999999977e-48 < a Initial program 81.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6477.3
Applied rewrites77.3%
Applied rewrites87.3%
Applied rewrites87.4%
if -9.60000000000000011e-42 < a < 4.19999999999999977e-48Initial program 81.3%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites85.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6476.5
Applied rewrites76.5%
Applied rewrites92.1%
Final simplification89.4%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* 0.5 (PI))))
(if (<= a -9.6e-42)
(/ (/ t_0 (* a b)) a)
(if (<= a 4.2e-48)
(* (/ (PI) (* (* a b) b)) 0.5)
(/ t_0 (* (* a b) a))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;a \leq -9.6 \cdot 10^{-42}:\\
\;\;\;\;\frac{\frac{t\_0}{a \cdot b}}{a}\\
\mathbf{elif}\;a \leq 4.2 \cdot 10^{-48}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot b} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\left(a \cdot b\right) \cdot a}\\
\end{array}
\end{array}
if a < -9.60000000000000011e-42Initial program 81.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6479.2
Applied rewrites79.2%
Applied rewrites89.6%
Applied rewrites89.7%
if -9.60000000000000011e-42 < a < 4.19999999999999977e-48Initial program 81.3%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites85.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6476.5
Applied rewrites76.5%
Applied rewrites92.1%
if 4.19999999999999977e-48 < a Initial program 81.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6475.8
Applied rewrites75.8%
Applied rewrites85.7%
Applied rewrites85.8%
Final simplification89.4%
(FPCore (a b)
:precision binary64
(if (<= a -9.6e-42)
(/ (* (/ (PI) a) 0.5) (* b a))
(if (<= a 4.2e-48)
(* (/ (PI) (* (* a b) b)) 0.5)
(/ (* 0.5 (PI)) (* (* a b) a)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.6 \cdot 10^{-42}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a} \cdot 0.5}{b \cdot a}\\
\mathbf{elif}\;a \leq 4.2 \cdot 10^{-48}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot b} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a}\\
\end{array}
\end{array}
if a < -9.60000000000000011e-42Initial program 81.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6479.2
Applied rewrites79.2%
Applied rewrites89.6%
if -9.60000000000000011e-42 < a < 4.19999999999999977e-48Initial program 81.3%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites85.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6476.5
Applied rewrites76.5%
Applied rewrites92.1%
if 4.19999999999999977e-48 < a Initial program 81.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6475.8
Applied rewrites75.8%
Applied rewrites85.7%
Applied rewrites85.8%
Final simplification89.4%
(FPCore (a b) :precision binary64 (/ (/ (- (PI)) (* a b)) (* -2.0 (+ b a))))
\begin{array}{l}
\\
\frac{\frac{-\mathsf{PI}\left(\right)}{a \cdot b}}{-2 \cdot \left(b + a\right)}
\end{array}
Initial program 81.4%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
Applied rewrites99.6%
Taylor expanded in a around 0
mul-1-negN/A
associate-/r*N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-PI.f6499.7
Applied rewrites99.7%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-PI.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
(FPCore (a b) :precision binary64 (* (/ (PI) (* (* a b) b)) 0.5))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot b} \cdot 0.5
\end{array}
Initial program 81.4%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.4%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6456.3
Applied rewrites56.3%
Applied rewrites62.9%
(FPCore (a b) :precision binary64 (* (PI) (/ 0.5 (* (* a b) b))))
\begin{array}{l}
\\
\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot b}
\end{array}
Initial program 81.4%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.4%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6456.3
Applied rewrites56.3%
Applied rewrites56.3%
Applied rewrites62.9%
herbie shell --seed 2024337
(FPCore (a b)
:name "NMSE Section 6.1 mentioned, B"
:precision binary64
(* (* (/ (PI) 2.0) (/ 1.0 (- (* b b) (* a a)))) (- (/ 1.0 a) (/ 1.0 b))))