
(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 8 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)) 0.5) (+ a b)))
\begin{array}{l}
\\
\frac{\frac{\mathsf{PI}\left(\right)}{a \cdot b} \cdot 0.5}{a + b}
\end{array}
Initial program 75.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
associate-*r/N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
*-commutativeN/A
*-rgt-identityN/A
*-lft-identityN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites87.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
associate-/l/N/A
times-fracN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
Applied rewrites98.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r/N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
(FPCore (a b) :precision binary64 (if (<= a -4.5e-51) (* (/ (PI) (* (* a b) a)) 0.5) (/ (PI) (* (* b 2.0) (* b a)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.5 \cdot 10^{-51}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot 2\right) \cdot \left(b \cdot a\right)}\\
\end{array}
\end{array}
if a < -4.49999999999999974e-51Initial program 81.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.8
Applied rewrites77.8%
Applied rewrites87.7%
if -4.49999999999999974e-51 < a Initial program 72.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
associate-*r/N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
*-commutativeN/A
*-rgt-identityN/A
*-lft-identityN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites82.5%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6462.9
Applied rewrites62.9%
Applied rewrites63.0%
Applied rewrites73.8%
(FPCore (a b) :precision binary64 (if (<= a -1.55e-109) (* (/ (PI) (* (* a b) a)) 0.5) (* (PI) (/ 0.5 (* (* b a) b)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.55 \cdot 10^{-109}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(b \cdot a\right) \cdot b}\\
\end{array}
\end{array}
if a < -1.55e-109Initial program 83.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6473.3
Applied rewrites73.3%
Applied rewrites82.1%
if -1.55e-109 < a Initial program 70.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
associate-*r/N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
*-commutativeN/A
*-rgt-identityN/A
*-lft-identityN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites81.3%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6462.2
Applied rewrites62.2%
Applied rewrites62.3%
Applied rewrites73.8%
(FPCore (a b) :precision binary64 (if (<= a -4.5e-51) (* (/ (PI) (* (* a b) a)) 0.5) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.5 \cdot 10^{-51}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\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 < -4.49999999999999974e-51Initial program 81.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.8
Applied rewrites77.8%
Applied rewrites87.7%
if -4.49999999999999974e-51 < a Initial program 72.2%
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-*.f6463.0
Applied rewrites63.0%
(FPCore (a b) :precision binary64 (/ (* 0.5 (PI)) (* (+ b a) (* b a))))
\begin{array}{l}
\\
\frac{0.5 \cdot \mathsf{PI}\left(\right)}{\left(b + a\right) \cdot \left(b \cdot a\right)}
\end{array}
Initial program 75.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
associate-*r/N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
*-commutativeN/A
*-rgt-identityN/A
*-lft-identityN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites87.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
associate-/l/N/A
times-fracN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
Applied rewrites98.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r/N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
metadata-evalN/A
div-invN/A
lift-PI.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-PI.f64N/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6498.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.9
Applied rewrites98.9%
(FPCore (a b) :precision binary64 (* (/ (PI) (* (* a b) a)) 0.5))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5
\end{array}
Initial program 75.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6457.2
Applied rewrites57.2%
Applied rewrites64.1%
(FPCore (a b) :precision binary64 (* (PI) (/ 0.5 (* (* a b) a))))
\begin{array}{l}
\\
\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot a}
\end{array}
Initial program 75.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6457.2
Applied rewrites57.2%
Applied rewrites57.2%
Applied rewrites64.1%
(FPCore (a b) :precision binary64 (* (PI) (/ 0.5 (* (* a a) b))))
\begin{array}{l}
\\
\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot a\right) \cdot b}
\end{array}
Initial program 75.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6457.2
Applied rewrites57.2%
Applied rewrites57.2%
herbie shell --seed 2024318
(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))))