
(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)) a) b) (* -2.0 (+ b a))))
\begin{array}{l}
\\
\frac{\frac{\frac{-\mathsf{PI}\left(\right)}{a}}{b}}{-2 \cdot \left(b + a\right)}
\end{array}
Initial program 79.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
Applied rewrites99.6%
Taylor expanded in a around 0
mul-1-negN/A
associate-/r*N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-PI.f6499.7
Applied rewrites99.7%
(FPCore (a b) :precision binary64 (if (or (<= a -0.4) (not (<= a 4.4e-28))) (/ (* (/ (PI) a) 0.5) (* b a)) (* (/ 0.5 b) (/ (PI) (* a b)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.4 \lor \neg \left(a \leq 4.4 \cdot 10^{-28}\right):\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a} \cdot 0.5}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{b} \cdot \frac{\mathsf{PI}\left(\right)}{a \cdot b}\\
\end{array}
\end{array}
if a < -0.40000000000000002 or 4.39999999999999992e-28 < a Initial program 75.7%
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.8
Applied rewrites79.8%
Applied rewrites91.6%
if -0.40000000000000002 < a < 4.39999999999999992e-28Initial program 83.4%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites87.9%
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-*.f6476.5
Applied rewrites76.5%
Applied rewrites76.4%
Applied rewrites88.7%
Final simplification90.1%
(FPCore (a b) :precision binary64 (if (or (<= a -0.4) (not (<= a 2.55e-70))) (/ (* 0.5 (PI)) (* (* a b) a)) (* (/ 0.5 b) (/ (PI) (* a b)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.4 \lor \neg \left(a \leq 2.55 \cdot 10^{-70}\right):\\
\;\;\;\;\frac{0.5 \cdot \mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{b} \cdot \frac{\mathsf{PI}\left(\right)}{a \cdot b}\\
\end{array}
\end{array}
if a < -0.40000000000000002 or 2.55000000000000013e-70 < a Initial program 77.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-*.f6478.4
Applied rewrites78.4%
Applied rewrites89.3%
Applied rewrites88.9%
if -0.40000000000000002 < a < 2.55000000000000013e-70Initial program 82.2%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites87.0%
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.1
Applied rewrites78.1%
Applied rewrites78.0%
Applied rewrites91.1%
Final simplification89.9%
(FPCore (a b) :precision binary64 (if (or (<= a -0.4) (not (<= a 2.55e-70))) (/ (* 0.5 (PI)) (* (* a b) a)) (* (/ (PI) (* (* a b) b)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.4 \lor \neg \left(a \leq 2.55 \cdot 10^{-70}\right):\\
\;\;\;\;\frac{0.5 \cdot \mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot b} \cdot 0.5\\
\end{array}
\end{array}
if a < -0.40000000000000002 or 2.55000000000000013e-70 < a Initial program 77.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-*.f6478.4
Applied rewrites78.4%
Applied rewrites89.3%
Applied rewrites88.9%
if -0.40000000000000002 < a < 2.55000000000000013e-70Initial program 82.2%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites87.0%
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.1
Applied rewrites78.1%
Applied rewrites90.2%
Final simplification89.5%
(FPCore (a b) :precision binary64 (/ (/ (- (PI)) (* a b)) (* -2.0 (+ b a))))
\begin{array}{l}
\\
\frac{\frac{-\mathsf{PI}\left(\right)}{a \cdot b}}{-2 \cdot \left(b + a\right)}
\end{array}
Initial program 79.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
Applied rewrites99.6%
Taylor expanded in a around 0
mul-1-negN/A
associate-/r*N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-PI.f6499.7
Applied rewrites99.7%
Applied rewrites99.7%
(FPCore (a b) :precision binary64 (/ (* (/ 0.5 (+ a b)) (PI)) (* a b)))
\begin{array}{l}
\\
\frac{\frac{0.5}{a + b} \cdot \mathsf{PI}\left(\right)}{a \cdot b}
\end{array}
Initial program 79.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
Applied rewrites99.6%
Applied rewrites99.6%
(FPCore (a b) :precision binary64 (* (/ (PI) (* (* a b) b)) 0.5))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot b} \cdot 0.5
\end{array}
Initial program 79.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.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-*.f6458.1
Applied rewrites58.1%
Applied rewrites63.6%
(FPCore (a b) :precision binary64 (* (PI) (/ 0.5 (* (* a b) b))))
\begin{array}{l}
\\
\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot b}
\end{array}
Initial program 79.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites88.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-*.f6458.1
Applied rewrites58.1%
Applied rewrites58.1%
Applied rewrites63.5%
herbie shell --seed 2024343
(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))))