
(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 (/ (* (/ 0.5 (* a b)) (PI)) (+ a b)))
\begin{array}{l}
\\
\frac{\frac{0.5}{a \cdot b} \cdot \mathsf{PI}\left(\right)}{a + b}
\end{array}
Initial program 75.5%
Applied rewrites87.4%
Applied rewrites99.1%
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
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
(FPCore (a b) :precision binary64 (if (<= a -1.75e-33) (* (/ (PI) (* (* b a) a)) 0.5) (* (/ (PI) (* (* b a) b)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.75 \cdot 10^{-33}:\\
\;\;\;\;\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 a\right) \cdot b} \cdot 0.5\\
\end{array}
\end{array}
if a < -1.7499999999999999e-33Initial program 69.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.1
Applied rewrites80.1%
Applied rewrites92.2%
if -1.7499999999999999e-33 < a Initial program 78.1%
Applied rewrites88.4%
Applied rewrites99.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-*.f6466.7
Applied rewrites66.7%
Applied rewrites72.9%
(FPCore (a b) :precision binary64 (if (<= a -1.55e-33) (* (/ (PI) (* (* b a) a)) 0.5) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.55 \cdot 10^{-33}:\\
\;\;\;\;\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 < -1.54999999999999998e-33Initial program 69.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.1
Applied rewrites80.1%
Applied rewrites92.2%
if -1.54999999999999998e-33 < a Initial program 78.1%
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-*.f6466.7
Applied rewrites66.7%
(FPCore (a b) :precision binary64 (/ (* (PI) 0.5) (* (+ b a) (* b a))))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(b + a\right) \cdot \left(b \cdot a\right)}
\end{array}
Initial program 75.5%
Applied rewrites87.4%
Applied rewrites99.1%
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
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-+.f64N/A
*-commutativeN/A
lower-*.f6498.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.8
Applied rewrites98.8%
(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 75.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6459.3
Applied rewrites59.3%
Applied rewrites66.8%
(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.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6459.3
Applied rewrites59.3%
Applied rewrites59.3%
Applied rewrites66.8%
(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.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6459.3
Applied rewrites59.3%
Applied rewrites59.3%
herbie shell --seed 2024313
(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))))