
(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 79.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites89.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6498.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.6
Applied rewrites98.6%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-/r*N/A
lift-PI.f64N/A
lift--.f64N/A
associate-*r/N/A
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 (or (<= b -1.35e+14) (not (<= b 2.25e+17))) (/ (* 0.5 (PI)) (* b (* b a))) (/ (* (PI) 0.5) (* (* a b) a))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.35 \cdot 10^{+14} \lor \neg \left(b \leq 2.25 \cdot 10^{+17}\right):\\
\;\;\;\;\frac{0.5 \cdot \mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(a \cdot b\right) \cdot a}\\
\end{array}
\end{array}
if b < -1.35e14 or 2.25e17 < b Initial program 73.4%
Taylor expanded in a around 0
Applied rewrites80.4%
Applied rewrites91.6%
Taylor expanded in a around 0
Applied rewrites91.7%
if -1.35e14 < b < 2.25e17Initial program 84.8%
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-*.f6475.9
Applied rewrites75.9%
Applied rewrites76.0%
Applied rewrites86.5%
Final simplification89.0%
(FPCore (a b) :precision binary64 (if (or (<= b -1.35e+14) (not (<= b 2.25e+17))) (/ (* 0.5 (PI)) (* b (* b a))) (* (/ 0.5 (* (* b a) a)) (PI))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.35 \cdot 10^{+14} \lor \neg \left(b \leq 2.25 \cdot 10^{+17}\right):\\
\;\;\;\;\frac{0.5 \cdot \mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\left(b \cdot a\right) \cdot a} \cdot \mathsf{PI}\left(\right)\\
\end{array}
\end{array}
if b < -1.35e14 or 2.25e17 < b Initial program 73.4%
Taylor expanded in a around 0
Applied rewrites80.4%
Applied rewrites91.6%
Taylor expanded in a around 0
Applied rewrites91.7%
if -1.35e14 < b < 2.25e17Initial program 84.8%
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-*.f6475.9
Applied rewrites75.9%
Applied rewrites76.0%
Applied rewrites75.9%
Applied rewrites86.4%
Final simplification88.9%
(FPCore (a b) :precision binary64 (/ (PI) (* (* (+ b a) 2.0) (* b a))))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right)}{\left(\left(b + a\right) \cdot 2\right) \cdot \left(b \cdot a\right)}
\end{array}
Initial program 79.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites89.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6498.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.6
Applied rewrites98.6%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-/r*N/A
lift-PI.f64N/A
lift--.f64N/A
associate-*r/N/A
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6498.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.6
Applied rewrites98.6%
(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 79.3%
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-*.f6459.0
Applied rewrites59.0%
Applied rewrites59.1%
Applied rewrites59.1%
Applied rewrites64.5%
(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 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-*.f6459.0
Applied rewrites59.0%
Applied rewrites59.1%
Applied rewrites59.1%
herbie shell --seed 2025007
(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))))