
(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) (* b a)) 0.5) (+ b a)))
\begin{array}{l}
\\
\frac{\frac{\mathsf{PI}\left(\right)}{b \cdot a} \cdot 0.5}{b + a}
\end{array}
Initial program 79.3%
Applied rewrites90.5%
Applied rewrites99.7%
Final simplification99.7%
(FPCore (a b) :precision binary64 (* (/ 0.5 (+ b a)) (/ (PI) (* b a))))
\begin{array}{l}
\\
\frac{0.5}{b + a} \cdot \frac{\mathsf{PI}\left(\right)}{b \cdot a}
\end{array}
Initial program 79.3%
Applied rewrites90.5%
Applied rewrites99.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-rgt-identityN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
Final simplification99.6%
(FPCore (a b) :precision binary64 (if (<= b 8.4e-13) (* (/ (PI) (* (* b a) a)) 0.5) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.4 \cdot 10^{-13}:\\
\;\;\;\;\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 b < 8.39999999999999955e-13Initial program 80.8%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.4
Applied rewrites65.4%
Applied rewrites72.8%
if 8.39999999999999955e-13 < b Initial program 74.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-*.f6483.7
Applied rewrites83.7%
Final simplification75.6%
(FPCore (a b) :precision binary64 (/ (PI) (* (* 2.0 (+ b a)) (* b a))))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right)}{\left(2 \cdot \left(b + a\right)\right) \cdot \left(b \cdot a\right)}
\end{array}
Initial program 79.3%
Applied rewrites90.5%
Applied rewrites99.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-rgt-identityN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
frac-timesN/A
*-lft-identityN/A
lower-/.f64N/A
lower-*.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f6499.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.2
lift-*.f64N/A
*-commutativeN/A
lift-*.f6499.2
Applied rewrites99.2%
Final simplification99.2%
(FPCore (a b) :precision binary64 (* (/ 0.5 (* (* (+ b a) b) a)) (PI)))
\begin{array}{l}
\\
\frac{0.5}{\left(\left(b + a\right) \cdot b\right) \cdot a} \cdot \mathsf{PI}\left(\right)
\end{array}
Initial program 79.3%
Applied rewrites90.5%
Applied rewrites99.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-rgt-identityN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f6492.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6492.6
Applied rewrites92.6%
Final simplification92.6%
(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.3%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
Applied rewrites63.7%
Final simplification63.7%
(FPCore (a b) :precision binary64 (* (/ (PI) (* (* a a) b)) 0.5))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right)}{\left(a \cdot a\right) \cdot b} \cdot 0.5
\end{array}
Initial program 79.3%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
Final simplification58.2%
(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.3%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
Applied rewrites58.2%
Final simplification58.2%
herbie shell --seed 2024255
(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))))