
(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 9 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)) (* a b)))
\begin{array}{l}
\\
\frac{\frac{\mathsf{PI}\left(\right)}{\left(a + b\right) \cdot 2}}{a \cdot b}
\end{array}
Initial program 83.6%
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 rewrites90.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
Applied rewrites86.0%
Applied rewrites99.7%
(FPCore (a b) :precision binary64 (if (or (<= b -4.5e+15) (not (<= b 3.1e+18))) (/ (/ (PI) b) (* 2.0 (* a b))) (/ (/ (* 0.5 (PI)) (* b a)) a)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.5 \cdot 10^{+15} \lor \neg \left(b \leq 3.1 \cdot 10^{+18}\right):\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{b}}{2 \cdot \left(a \cdot b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5 \cdot \mathsf{PI}\left(\right)}{b \cdot a}}{a}\\
\end{array}
\end{array}
if b < -4.5e15 or 3.1e18 < b Initial program 82.0%
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 rewrites92.8%
Taylor expanded in a around 0
lower-/.f64N/A
lower-PI.f6495.2
Applied rewrites95.2%
if -4.5e15 < b < 3.1e18Initial program 85.1%
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-*.f6477.2
Applied rewrites77.2%
Applied rewrites77.3%
Applied rewrites88.9%
Final simplification91.9%
(FPCore (a b) :precision binary64 (if (or (<= b -3.5e+15) (not (<= b 3.1e+18))) (* (/ (PI) (* (* b b) a)) 0.5) (* (/ (PI) (* b a)) (/ 0.5 a))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.5 \cdot 10^{+15} \lor \neg \left(b \leq 3.1 \cdot 10^{+18}\right):\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{b \cdot a} \cdot \frac{0.5}{a}\\
\end{array}
\end{array}
if b < -3.5e15 or 3.1e18 < b Initial program 82.0%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-rgt-identityN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
lower--.f6492.8
Applied rewrites92.8%
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-*.f6488.7
Applied rewrites88.7%
if -3.5e15 < b < 3.1e18Initial program 85.1%
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-*.f6477.2
Applied rewrites77.2%
Applied rewrites77.3%
Applied rewrites88.8%
Final simplification88.8%
(FPCore (a b)
:precision binary64
(if (<= b -4.5e+15)
(* (/ (/ (PI) (* b b)) a) 0.5)
(if (<= b 3.1e+18)
(/ (/ (* 0.5 (PI)) (* b a)) a)
(* (/ (PI) (* (* b b) a)) 0.5))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{b \cdot b}}{a} \cdot 0.5\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{+18}:\\
\;\;\;\;\frac{\frac{0.5 \cdot \mathsf{PI}\left(\right)}{b \cdot a}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
\end{array}
\end{array}
if b < -4.5e15Initial program 83.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6486.8
Applied rewrites86.8%
if -4.5e15 < b < 3.1e18Initial program 85.1%
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-*.f6477.2
Applied rewrites77.2%
Applied rewrites77.3%
Applied rewrites88.9%
if 3.1e18 < b Initial program 80.2%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-rgt-identityN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
lower--.f6495.1
Applied rewrites95.1%
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-*.f6490.8
Applied rewrites90.8%
Final simplification88.8%
(FPCore (a b)
:precision binary64
(if (<= b -4.5e+15)
(* (/ (/ (PI) (* b b)) a) 0.5)
(if (<= b 3.1e+18)
(/ (* (/ (PI) a) 0.5) (* b a))
(* (/ (PI) (* (* b b) a)) 0.5))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{b \cdot b}}{a} \cdot 0.5\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{+18}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a} \cdot 0.5}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
\end{array}
\end{array}
if b < -4.5e15Initial program 83.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6486.8
Applied rewrites86.8%
if -4.5e15 < b < 3.1e18Initial program 85.1%
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-*.f6477.2
Applied rewrites77.2%
Applied rewrites88.8%
if 3.1e18 < b Initial program 80.2%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-rgt-identityN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
lower--.f6495.1
Applied rewrites95.1%
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-*.f6490.8
Applied rewrites90.8%
Final simplification88.8%
(FPCore (a b)
:precision binary64
(if (<= b -4.5e+15)
(* (/ (/ (PI) (* b b)) a) 0.5)
(if (<= b 3.1e+18)
(* (/ (PI) (* b a)) (/ 0.5 a))
(* (/ (PI) (* (* b b) a)) 0.5))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{b \cdot b}}{a} \cdot 0.5\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{+18}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{b \cdot a} \cdot \frac{0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
\end{array}
\end{array}
if b < -4.5e15Initial program 83.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6486.8
Applied rewrites86.8%
if -4.5e15 < b < 3.1e18Initial program 85.1%
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-*.f6477.2
Applied rewrites77.2%
Applied rewrites77.3%
Applied rewrites88.8%
if 3.1e18 < b Initial program 80.2%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-rgt-identityN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
lower--.f6495.1
Applied rewrites95.1%
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-*.f6490.8
Applied rewrites90.8%
Final simplification88.8%
(FPCore (a b) :precision binary64 (if (or (<= b -3.5e+15) (not (<= b 3.1e+18))) (* (/ (PI) (* (* b b) a)) 0.5) (/ (* (PI) 0.5) (* (* b a) a))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.5 \cdot 10^{+15} \lor \neg \left(b \leq 3.1 \cdot 10^{+18}\right):\\
\;\;\;\;\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(b \cdot a\right) \cdot a}\\
\end{array}
\end{array}
if b < -3.5e15 or 3.1e18 < b Initial program 82.0%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-rgt-identityN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
lower--.f6492.8
Applied rewrites92.8%
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-*.f6488.7
Applied rewrites88.7%
if -3.5e15 < b < 3.1e18Initial program 85.1%
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-*.f6477.2
Applied rewrites77.2%
Applied rewrites77.3%
Applied rewrites88.3%
Final simplification88.5%
(FPCore (a b) :precision binary64 (/ (* (PI) 0.5) (* (* b a) a)))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(b \cdot a\right) \cdot a}
\end{array}
Initial program 83.6%
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-*.f6460.9
Applied rewrites60.9%
Applied rewrites60.9%
Applied rewrites66.7%
Final simplification66.7%
(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 83.6%
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-*.f6460.9
Applied rewrites60.9%
Applied rewrites60.9%
Applied rewrites66.7%
Final simplification66.7%
herbie shell --seed 2024354
(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))))