
(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 6 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)) (* a (+ b b))))
\begin{array}{l}
\\
\frac{\frac{\mathsf{PI}\left(\right)}{a + b}}{a \cdot \left(b + b\right)}
\end{array}
Initial program 76.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6499.4
Applied rewrites99.4%
Applied rewrites99.7%
lift-*.f64N/A
count-2-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6499.7
Applied rewrites99.7%
(FPCore (a b)
:precision binary64
(if (<= a -550.0)
(* (/ 0.5 (* (* b a) a)) (PI))
(if (<= a 430.0)
(* (/ (PI) (* (* b b) a)) 0.5)
(/ (* (PI) 0.5) (* (* a b) a)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -550:\\
\;\;\;\;\frac{0.5}{\left(b \cdot a\right) \cdot a} \cdot \mathsf{PI}\left(\right)\\
\mathbf{elif}\;a \leq 430:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(a \cdot b\right) \cdot a}\\
\end{array}
\end{array}
if a < -550Initial program 62.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6479.9
Applied rewrites79.9%
Applied rewrites80.8%
Applied rewrites80.9%
Applied rewrites95.2%
if -550 < a < 430Initial program 81.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites71.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6499.6
Applied rewrites99.6%
Applied rewrites99.7%
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-*.f6478.7
Applied rewrites78.7%
if 430 < a Initial program 81.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6480.1
Applied rewrites80.1%
Applied rewrites80.5%
Applied rewrites90.8%
(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 76.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites79.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6499.4
Applied rewrites99.4%
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6499.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
(FPCore (a b) :precision binary64 (/ (* (PI) 0.5) (* (* a b) a)))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(a \cdot b\right) \cdot a}
\end{array}
Initial program 76.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6455.6
Applied rewrites55.6%
Applied rewrites55.9%
Applied rewrites62.4%
(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 76.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6455.6
Applied rewrites55.6%
Applied rewrites55.9%
Applied rewrites55.9%
Applied rewrites62.4%
(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 76.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6455.6
Applied rewrites55.6%
Applied rewrites55.9%
Applied rewrites55.9%
herbie shell --seed 2025010
(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))))