
(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 10 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 (* 0.5 (/ (/ (PI) (+ b a)) (* b a))))
\begin{array}{l}
\\
0.5 \cdot \frac{\frac{\mathsf{PI}\left(\right)}{b + a}}{b \cdot a}
\end{array}
Initial program 79.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift-/.f64N/A
div-invN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites88.1%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-/.f64N/A
clear-numN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-rgt-identityN/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6498.6
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6491.3
Applied rewrites91.3%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites99.7%
Final simplification99.7%
(FPCore (a b) :precision binary64 (if (<= b 1.1e-66) (* (/ (PI) (* (* b a) a)) 0.5) (* (/ 0.5 (- b a)) (/ (PI) (* b a)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.1 \cdot 10^{-66}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{b - a} \cdot \frac{\mathsf{PI}\left(\right)}{b \cdot a}\\
\end{array}
\end{array}
if b < 1.1000000000000001e-66Initial program 78.4%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6460.2
Applied rewrites60.2%
Applied rewrites69.9%
if 1.1000000000000001e-66 < b Initial program 82.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift-/.f64N/A
div-invN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites74.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-/.f64N/A
clear-numN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6497.2
Applied rewrites97.2%
Taylor expanded in b around inf
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f6492.6
Applied rewrites92.6%
Final simplification75.7%
(FPCore (a b) :precision binary64 (if (<= a -2.9e-62) (/ (* (/ (PI) a) 0.5) (* b a)) (/ (* (/ (PI) b) 0.5) (* b a))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{-62}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a} \cdot 0.5}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{b} \cdot 0.5}{b \cdot a}\\
\end{array}
\end{array}
if a < -2.89999999999999986e-62Initial program 76.6%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites84.1%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6489.2
Applied rewrites89.2%
if -2.89999999999999986e-62 < a Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites83.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6470.8
Applied rewrites70.8%
Final simplification76.5%
(FPCore (a b) :precision binary64 (if (<= a -2.9e-62) (/ (* (/ (PI) a) 0.5) (* b a)) (* (/ (/ (PI) (* b a)) b) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{-62}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a} \cdot 0.5}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{b \cdot a}}{b} \cdot 0.5\\
\end{array}
\end{array}
if a < -2.89999999999999986e-62Initial program 76.6%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites84.1%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6489.2
Applied rewrites89.2%
if -2.89999999999999986e-62 < a Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift-/.f64N/A
div-invN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites82.9%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-/.f64N/A
clear-numN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6498.2
Applied rewrites98.2%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
unpow2N/A
associate-/r*N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f6470.7
Applied rewrites70.7%
Final simplification76.5%
(FPCore (a b) :precision binary64 (if (<= a -2.9e-62) (* (/ (/ 0.5 a) (* b a)) (PI)) (* (/ (/ (PI) (* b a)) b) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{-62}:\\
\;\;\;\;\frac{\frac{0.5}{a}}{b \cdot a} \cdot \mathsf{PI}\left(\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{b \cdot a}}{b} \cdot 0.5\\
\end{array}
\end{array}
if a < -2.89999999999999986e-62Initial program 76.6%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.9
Applied rewrites74.9%
Applied rewrites74.9%
Applied rewrites89.1%
if -2.89999999999999986e-62 < a Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift-/.f64N/A
div-invN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites82.9%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-/.f64N/A
clear-numN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6498.2
Applied rewrites98.2%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
unpow2N/A
associate-/r*N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f6470.7
Applied rewrites70.7%
Final simplification76.4%
(FPCore (a b) :precision binary64 (if (<= a -2.9e-62) (* (/ (/ 0.5 a) (* b a)) (PI)) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{-62}:\\
\;\;\;\;\frac{\frac{0.5}{a}}{b \cdot a} \cdot \mathsf{PI}\left(\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
\end{array}
\end{array}
if a < -2.89999999999999986e-62Initial program 76.6%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.9
Applied rewrites74.9%
Applied rewrites74.9%
Applied rewrites89.1%
if -2.89999999999999986e-62 < a Initial program 80.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6462.3
Applied rewrites62.3%
Final simplification70.6%
(FPCore (a b) :precision binary64 (if (<= a -2.9e-62) (* (/ (PI) (* (* b a) a)) 0.5) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{-62}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
\end{array}
\end{array}
if a < -2.89999999999999986e-62Initial program 76.6%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.9
Applied rewrites74.9%
Applied rewrites88.7%
if -2.89999999999999986e-62 < a Initial program 80.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6462.3
Applied rewrites62.3%
Final simplification70.5%
(FPCore (a b) :precision binary64 (* (/ (PI) (* (* b a) a)) 0.5))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5
\end{array}
Initial program 79.5%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
Applied rewrites63.8%
Final simplification63.8%
(FPCore (a b) :precision binary64 (* (/ 0.5 (* (* b a) a)) (PI)))
\begin{array}{l}
\\
\frac{0.5}{\left(b \cdot a\right) \cdot a} \cdot \mathsf{PI}\left(\right)
\end{array}
Initial program 79.5%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
Applied rewrites56.6%
Applied rewrites63.8%
Final simplification63.8%
(FPCore (a b) :precision binary64 (* (/ 0.5 (* (* a a) b)) (PI)))
\begin{array}{l}
\\
\frac{0.5}{\left(a \cdot a\right) \cdot b} \cdot \mathsf{PI}\left(\right)
\end{array}
Initial program 79.5%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
Applied rewrites56.6%
Final simplification56.6%
herbie shell --seed 2024276
(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))))