
(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) 0.5) (+ a b)) (/ 1.0 (* a b))))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right) \cdot 0.5}{a + b} \cdot \frac{1}{a \cdot b}
\end{array}
Initial program 74.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
associate-*r/N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
*-commutativeN/A
*-rgt-identityN/A
*-lft-identityN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites86.7%
Taylor expanded in b around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (a b) :precision binary64 (if (<= a -2e-105) (/ (/ (* (PI) 0.5) a) (* a b)) (* (/ (/ (PI) (* a b)) b) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{-105}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right) \cdot 0.5}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{a \cdot b}}{b} \cdot 0.5\\
\end{array}
\end{array}
if a < -1.99999999999999993e-105Initial program 77.2%
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-*.f6472.1
Applied rewrites72.1%
Applied rewrites72.0%
Applied rewrites78.7%
if -1.99999999999999993e-105 < a Initial program 73.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
associate-*r/N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
*-commutativeN/A
*-rgt-identityN/A
*-lft-identityN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites82.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l*N/A
Applied rewrites99.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
associate-*r*N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f6474.0
Applied rewrites74.0%
Final simplification75.5%
(FPCore (a b) :precision binary64 (if (<= a -2e-105) (/ (/ (* (PI) 0.5) a) (* a b)) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{-105}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right) \cdot 0.5}{a}}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
\end{array}
\end{array}
if a < -1.99999999999999993e-105Initial program 77.2%
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-*.f6472.1
Applied rewrites72.1%
Applied rewrites72.0%
Applied rewrites78.7%
if -1.99999999999999993e-105 < a Initial program 73.4%
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.2
Applied rewrites62.2%
(FPCore (a b) :precision binary64 (if (<= a -2e-105) (* (/ (PI) a) (/ 0.5 (* a b))) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{-105}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{a} \cdot \frac{0.5}{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
\end{array}
\end{array}
if a < -1.99999999999999993e-105Initial program 77.2%
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-*.f6472.1
Applied rewrites72.1%
Applied rewrites78.7%
if -1.99999999999999993e-105 < a Initial program 73.4%
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.2
Applied rewrites62.2%
Final simplification67.3%
(FPCore (a b) :precision binary64 (* (/ 0.5 (+ a b)) (/ (PI) (* a b))))
\begin{array}{l}
\\
\frac{0.5}{a + b} \cdot \frac{\mathsf{PI}\left(\right)}{a \cdot b}
\end{array}
Initial program 74.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
associate-*r/N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
*-commutativeN/A
*-rgt-identityN/A
*-lft-identityN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites86.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l*N/A
Applied rewrites99.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-rgt-identityN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
Final simplification99.6%
(FPCore (a b) :precision binary64 (if (<= a -2e-105) (* (/ (PI) (* (* a b) a)) 0.5) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{-105}:\\
\;\;\;\;\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 < -1.99999999999999993e-105Initial program 77.2%
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-*.f6472.1
Applied rewrites72.1%
Applied rewrites79.1%
if -1.99999999999999993e-105 < a Initial program 73.4%
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.2
Applied rewrites62.2%
(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 74.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-*.f6457.6
Applied rewrites57.6%
Applied rewrites62.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 74.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-*.f6457.6
Applied rewrites57.6%
Applied rewrites57.6%
Applied rewrites62.8%
Final simplification62.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 74.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-*.f6457.6
Applied rewrites57.6%
Applied rewrites57.6%
Final simplification57.6%
herbie shell --seed 2024270
(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))))