
(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 (if (or (<= a -1.16e+168) (not (<= a 6.5e+95))) (* (/ (/ (PI) a) (* b a)) 0.5) (* (/ (PI) (* (* (+ b a) 2.0) (- a))) (/ -1.0 b))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.16 \cdot 10^{+168} \lor \neg \left(a \leq 6.5 \cdot 10^{+95}\right):\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a}}{b \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(\left(b + a\right) \cdot 2\right) \cdot \left(-a\right)} \cdot \frac{-1}{b}\\
\end{array}
\end{array}
if a < -1.1599999999999999e168 or 6.5e95 < a Initial program 65.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
pow2N/A
lower-*.f6484.4
Applied rewrites84.4%
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.9
Applied rewrites97.9%
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
if -1.1599999999999999e168 < a < 6.5e95Initial program 85.9%
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6489.9
Applied rewrites89.9%
Taylor expanded in a around inf
lower-/.f6453.1
Applied rewrites53.1%
Taylor expanded in a around inf
mul-1-negN/A
lower-neg.f6499.6
Applied rewrites99.6%
*-rgt-identityN/A
lower-/.f64N/A
lower-PI.f64N/A
associate-*r*N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-neg.f6499.6
Applied rewrites99.6%
Final simplification99.6%
(FPCore (a b) :precision binary64 (/ (* (/ (PI) 2.0) (pow (* b a) -1.0)) (+ b a)))
\begin{array}{l}
\\
\frac{\frac{\mathsf{PI}\left(\right)}{2} \cdot {\left(b \cdot a\right)}^{-1}}{b + a}
\end{array}
Initial program 79.6%
associate-*r/N/A
difference-of-squaresN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6488.5
Applied rewrites88.5%
associate-*l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
inv-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower--.f64N/A
inv-powN/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f6499.6
Applied rewrites99.6%
Taylor expanded in a around 0
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6499.6
Applied rewrites99.6%
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites99.6%
(FPCore (a b) :precision binary64 (* (/ (/ (PI) 2.0) (+ a b)) (/ 1.0 (* b a))))
\begin{array}{l}
\\
\frac{\frac{\mathsf{PI}\left(\right)}{2}}{a + b} \cdot \frac{1}{b \cdot a}
\end{array}
Initial program 79.6%
associate-*r/N/A
difference-of-squaresN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6488.5
Applied rewrites88.5%
associate-*l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
inv-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower--.f64N/A
inv-powN/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f6499.6
Applied rewrites99.6%
Taylor expanded in a around 0
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6499.6
Applied rewrites99.6%
unpow-1N/A
lower-/.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
(FPCore (a b) :precision binary64 (if (or (<= a -34000.0) (not (<= a 3.4e-17))) (* (/ (/ (PI) a) (* b a)) 0.5) (* (/ (PI) (* b (* b a))) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -34000 \lor \neg \left(a \leq 3.4 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a}}{b \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5\\
\end{array}
\end{array}
if a < -34000 or 3.3999999999999998e-17 < a Initial program 78.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
pow2N/A
lower-*.f6483.9
Applied rewrites83.9%
associate-*l*N/A
lower-*.f64N/A
lower-*.f6491.7
Applied rewrites91.7%
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f6493.1
Applied rewrites93.1%
if -34000 < a < 3.3999999999999998e-17Initial program 81.4%
associate-*r/N/A
difference-of-squaresN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6485.5
Applied rewrites85.5%
associate-*l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
inv-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower--.f64N/A
inv-powN/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f6499.6
Applied rewrites99.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-*.f6472.0
Applied rewrites72.0%
associate-*l*N/A
lower-*.f64N/A
lower-*.f6486.6
Applied rewrites86.6%
Final simplification90.2%
(FPCore (a b) :precision binary64 (if (or (<= a -34000.0) (not (<= a 3.4e-17))) (* (/ (PI) (* a (* a b))) 0.5) (* (/ (PI) (* b (* b a))) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -34000 \lor \neg \left(a \leq 3.4 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{b \cdot \left(b \cdot a\right)} \cdot 0.5\\
\end{array}
\end{array}
if a < -34000 or 3.3999999999999998e-17 < a Initial program 78.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
pow2N/A
lower-*.f6483.9
Applied rewrites83.9%
associate-*l*N/A
lower-*.f64N/A
lower-*.f6491.7
Applied rewrites91.7%
if -34000 < a < 3.3999999999999998e-17Initial program 81.4%
associate-*r/N/A
difference-of-squaresN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower--.f6485.5
Applied rewrites85.5%
associate-*l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
inv-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower--.f64N/A
inv-powN/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f6499.6
Applied rewrites99.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-*.f6472.0
Applied rewrites72.0%
associate-*l*N/A
lower-*.f64N/A
lower-*.f6486.6
Applied rewrites86.6%
Final simplification89.4%
(FPCore (a b) :precision binary64 (if (or (<= a -34000.0) (not (<= a 3.4e-17))) (* (/ (PI) (* a (* a b))) 0.5) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -34000 \lor \neg \left(a \leq 3.4 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \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 < -34000 or 3.3999999999999998e-17 < a Initial program 78.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
pow2N/A
lower-*.f6483.9
Applied rewrites83.9%
associate-*l*N/A
lower-*.f64N/A
lower-*.f6491.7
Applied rewrites91.7%
if -34000 < a < 3.3999999999999998e-17Initial program 81.4%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-*.f6472.0
Applied rewrites72.0%
Final simplification82.8%
(FPCore (a b) :precision binary64 (* (/ (PI) (* a (* a b))) 0.5))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right)}{a \cdot \left(a \cdot b\right)} \cdot 0.5
\end{array}
Initial program 79.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
pow2N/A
lower-*.f6459.7
Applied rewrites59.7%
associate-*l*N/A
lower-*.f64N/A
lower-*.f6464.0
Applied rewrites64.0%
herbie shell --seed 2025044
(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))))