
(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}
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (/ (/ (/ (* (PI) 0.5) a) b) (+ a b)))
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{\frac{\frac{\mathsf{PI}\left(\right) \cdot 0.5}{a}}{b}}{a + b}
\end{array}
Initial program 78.6%
Applied rewrites87.4%
Applied rewrites99.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
lower-/.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (/ (/ (* 0.5 (PI)) (* b a)) (+ a b)))
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{\frac{0.5 \cdot \mathsf{PI}\left(\right)}{b \cdot a}}{a + b}
\end{array}
Initial program 78.6%
Applied rewrites87.4%
Applied rewrites99.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/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-/r*N/A
lift-*.f64N/A
lower-/.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (if (<= a -1.9e-69) (* (/ (PI) (* (* b a) a)) 0.5) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9 \cdot 10^{-69}:\\
\;\;\;\;\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.8999999999999999e-69Initial program 70.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-*.f6467.4
Applied rewrites67.4%
Applied rewrites83.6%
if -1.8999999999999999e-69 < a Initial program 81.6%
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-*.f6464.6
Applied rewrites64.6%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (/ (* 0.5 (PI)) (* (+ b a) (* b a))))
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{0.5 \cdot \mathsf{PI}\left(\right)}{\left(b + a\right) \cdot \left(b \cdot a\right)}
\end{array}
Initial program 78.6%
Applied rewrites87.4%
Applied rewrites99.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/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
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6499.5
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (* (/ (PI) (* (* b a) a)) 0.5))
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5
\end{array}
Initial program 78.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-*.f6457.3
Applied rewrites57.3%
Applied rewrites65.3%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (* (PI) (/ 0.5 (* (* a b) a))))
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot a}
\end{array}
Initial program 78.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-*.f6457.3
Applied rewrites57.3%
Applied rewrites57.3%
Applied rewrites65.3%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (a b) :precision binary64 (* (PI) (/ 0.5 (* (* a a) b))))
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot a\right) \cdot b}
\end{array}
Initial program 78.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-*.f6457.3
Applied rewrites57.3%
Applied rewrites57.3%
herbie shell --seed 2024320
(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))))