
(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 12 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 (* (/ (/ 0.5 (- b a)) (* a b)) (* (/ (PI) (+ a b)) (- b a))))
\begin{array}{l}
\\
\frac{\frac{0.5}{b - a}}{a \cdot b} \cdot \left(\frac{\mathsf{PI}\left(\right)}{a + b} \cdot \left(b - a\right)\right)
\end{array}
Initial program 79.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift-/.f64N/A
div-invN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites88.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6498.1
Applied rewrites98.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6499.6
Applied rewrites99.6%
Final simplification99.6%
(FPCore (a b)
:precision binary64
(if (<= b 3.5e-136)
(/ (/ (* 0.5 (PI)) (* a b)) a)
(if (<= b 3.3e+83)
(/ (* (PI) (- b a)) (* (* (+ a b) (- b a)) (* 2.0 (* a b))))
(/ (* (/ (PI) b) 0.5) (* a b)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.5 \cdot 10^{-136}:\\
\;\;\;\;\frac{\frac{0.5 \cdot \mathsf{PI}\left(\right)}{a \cdot b}}{a}\\
\mathbf{elif}\;b \leq 3.3 \cdot 10^{+83}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot \left(b - a\right)}{\left(\left(a + b\right) \cdot \left(b - a\right)\right) \cdot \left(2 \cdot \left(a \cdot b\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{b} \cdot 0.5}{a \cdot b}\\
\end{array}
\end{array}
if b < 3.50000000000000029e-136Initial program 77.1%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6458.6
Applied rewrites58.6%
Applied rewrites68.9%
if 3.50000000000000029e-136 < b < 3.29999999999999985e83Initial program 94.9%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites88.6%
if 3.29999999999999985e83 < b Initial program 72.0%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites74.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6499.1
Applied rewrites99.1%
Final simplification77.0%
(FPCore (a b) :precision binary64 (* (/ (* (PI) (- b a)) (* (* a b) (+ a b))) (/ 0.5 (- b a))))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right) \cdot \left(b - a\right)}{\left(a \cdot b\right) \cdot \left(a + b\right)} \cdot \frac{0.5}{b - a}
\end{array}
Initial program 79.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift-/.f64N/A
div-invN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites88.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6498.1
Applied rewrites98.1%
Final simplification98.1%
(FPCore (a b) :precision binary64 (if (<= b 2.3e-66) (* (/ (PI) (* (* a b) a)) 0.5) (* (PI) (/ (/ 0.5 (- b a)) (* a b)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.3 \cdot 10^{-66}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{\frac{0.5}{b - a}}{a \cdot b}\\
\end{array}
\end{array}
if b < 2.29999999999999992e-66Initial program 78.4%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6460.2
Applied rewrites60.2%
Applied rewrites69.9%
if 2.29999999999999992e-66 < b Initial program 82.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift-/.f64N/A
div-invN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites74.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6497.1
Applied rewrites97.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6499.6
Applied rewrites99.6%
Taylor expanded in b around inf
lower-PI.f6492.7
Applied rewrites92.7%
(FPCore (a b) :precision binary64 (if (<= a -2.9e-62) (/ (* (/ (PI) a) 0.5) (* a b)) (/ (* (/ (PI) b) 0.5) (* a b))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{-62}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a} \cdot 0.5}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{b} \cdot 0.5}{a \cdot b}\\
\end{array}
\end{array}
if a < -2.89999999999999986e-62Initial program 76.6%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites84.1%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6489.2
Applied rewrites89.2%
if -2.89999999999999986e-62 < a Initial program 80.9%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites83.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6470.8
Applied rewrites70.8%
(FPCore (a b) :precision binary64 (if (<= a -2.9e-62) (/ (* (/ (PI) a) 0.5) (* a b)) (/ (* (/ 0.5 a) (PI)) (* b b))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{-62}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a} \cdot 0.5}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{a} \cdot \mathsf{PI}\left(\right)}{b \cdot b}\\
\end{array}
\end{array}
if a < -2.89999999999999986e-62Initial program 76.6%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites84.1%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f6489.2
Applied rewrites89.2%
if -2.89999999999999986e-62 < a Initial program 80.9%
Taylor expanded in b around inf
lower-/.f64N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-PI.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6458.5
Applied rewrites58.5%
Taylor expanded in b around inf
Applied rewrites62.5%
Final simplification70.8%
(FPCore (a b) :precision binary64 (if (<= a -2.9e-62) (* (/ 0.5 (* a b)) (/ (PI) a)) (/ (* (/ 0.5 a) (PI)) (* b b))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{-62}:\\
\;\;\;\;\frac{0.5}{a \cdot b} \cdot \frac{\mathsf{PI}\left(\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{a} \cdot \mathsf{PI}\left(\right)}{b \cdot b}\\
\end{array}
\end{array}
if a < -2.89999999999999986e-62Initial program 76.6%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.9
Applied rewrites74.9%
Applied rewrites74.9%
Applied rewrites89.2%
if -2.89999999999999986e-62 < a Initial program 80.9%
Taylor expanded in b around inf
lower-/.f64N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-PI.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6458.5
Applied rewrites58.5%
Taylor expanded in b around inf
Applied rewrites62.5%
Final simplification70.8%
(FPCore (a b) :precision binary64 (if (<= a -2.9e-62) (* (/ 0.5 (* a b)) (/ (PI) a)) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{-62}:\\
\;\;\;\;\frac{0.5}{a \cdot b} \cdot \frac{\mathsf{PI}\left(\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
\end{array}
\end{array}
if a < -2.89999999999999986e-62Initial program 76.6%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.9
Applied rewrites74.9%
Applied rewrites74.9%
Applied rewrites89.2%
if -2.89999999999999986e-62 < a Initial program 80.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6462.3
Applied rewrites62.3%
Final simplification70.7%
(FPCore (a b) :precision binary64 (if (<= a -2.9e-62) (* (/ (PI) (* (* a b) a)) 0.5) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.9 \cdot 10^{-62}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \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 < -2.89999999999999986e-62Initial program 76.6%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.9
Applied rewrites74.9%
Applied rewrites88.7%
if -2.89999999999999986e-62 < a Initial program 80.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6462.3
Applied rewrites62.3%
(FPCore (a b) :precision binary64 (* (/ (PI) (* (* a b) a)) 0.5))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a} \cdot 0.5
\end{array}
Initial program 79.5%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
Applied rewrites63.8%
(FPCore (a b) :precision binary64 (* (/ 0.5 (* (* a b) a)) (PI)))
\begin{array}{l}
\\
\frac{0.5}{\left(a \cdot b\right) \cdot a} \cdot \mathsf{PI}\left(\right)
\end{array}
Initial program 79.5%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
Applied rewrites56.6%
Applied rewrites63.8%
Final simplification63.8%
(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.5%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
Applied rewrites56.6%
Final simplification56.6%
herbie shell --seed 2024276
(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))))