
(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 (/ (* (PI) (/ 0.5 (+ b a))) (* b a)))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right) \cdot \frac{0.5}{b + a}}{b \cdot a}
\end{array}
Initial program 77.2%
Applied rewrites89.5%
Applied rewrites99.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
*-rgt-identityN/A
lower-*.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (a b) :precision binary64 (let* ((t_0 (* (PI) 0.5))) (if (<= a -1.95e+96) (/ (/ t_0 (* b a)) a) (/ t_0 (* (* (+ b a) a) b)))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot 0.5\\
\mathbf{if}\;a \leq -1.95 \cdot 10^{+96}:\\
\;\;\;\;\frac{\frac{t\_0}{b \cdot a}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\
\end{array}
\end{array}
if a < -1.95e96Initial program 60.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-*.f6475.3
Applied rewrites75.3%
Applied rewrites99.7%
if -1.95e96 < a Initial program 81.9%
Applied rewrites92.8%
Applied rewrites99.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
*-rgt-identityN/A
lift-*.f64N/A
Applied rewrites95.6%
Final simplification96.5%
(FPCore (a b) :precision binary64 (if (<= a -3.1e+93) (* (/ 0.5 a) (/ (PI) (* b a))) (/ (* (PI) 0.5) (* (* (+ b a) a) b))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{+93}:\\
\;\;\;\;\frac{0.5}{a} \cdot \frac{\mathsf{PI}\left(\right)}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\
\end{array}
\end{array}
if a < -3.10000000000000019e93Initial program 60.8%
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-*.f6475.7
Applied rewrites75.7%
Applied rewrites99.8%
if -3.10000000000000019e93 < a Initial program 81.8%
Applied rewrites92.7%
Applied rewrites99.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
*-rgt-identityN/A
lift-*.f64N/A
Applied rewrites95.5%
Final simplification96.5%
(FPCore (a b) :precision binary64 (if (<= a -2e+96) (* (/ (PI) (* (* b a) a)) 0.5) (/ (* (PI) 0.5) (* (* (+ b a) a) b))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{+96}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right) \cdot 0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b}\\
\end{array}
\end{array}
if a < -2.0000000000000001e96Initial program 60.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-*.f6475.3
Applied rewrites75.3%
Applied rewrites95.5%
if -2.0000000000000001e96 < a Initial program 81.9%
Applied rewrites92.8%
Applied rewrites99.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
*-rgt-identityN/A
lift-*.f64N/A
Applied rewrites95.6%
Final simplification95.5%
(FPCore (a b) :precision binary64 (if (<= a -3.3e+96) (* (/ (PI) (* (* b a) a)) 0.5) (* (/ 0.5 (* (* (+ b a) a) b)) (PI))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.3 \cdot 10^{+96}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\left(\left(b + a\right) \cdot a\right) \cdot b} \cdot \mathsf{PI}\left(\right)\\
\end{array}
\end{array}
if a < -3.29999999999999984e96Initial program 60.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-*.f6475.3
Applied rewrites75.3%
Applied rewrites95.5%
if -3.29999999999999984e96 < a Initial program 81.9%
Applied rewrites92.8%
Applied rewrites99.6%
lift-*.f64N/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
*-rgt-identity99.6
Applied rewrites99.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-+.f64N/A
distribute-rgt-outN/A
lower-*.f64N/A
distribute-rgt-outN/A
lift-+.f64N/A
lower-*.f6495.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6495.5
Applied rewrites95.5%
Final simplification95.5%
(FPCore (a b) :precision binary64 (* (/ (/ 0.5 (+ b a)) (* b a)) (PI)))
\begin{array}{l}
\\
\frac{\frac{0.5}{b + a}}{b \cdot a} \cdot \mathsf{PI}\left(\right)
\end{array}
Initial program 77.2%
Applied rewrites89.5%
Applied rewrites99.6%
lift-*.f64N/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
*-rgt-identity99.6
Applied rewrites99.6%
Final simplification99.6%
(FPCore (a b) :precision binary64 (if (<= a -2.3e-32) (* (/ (PI) (* (* b a) a)) 0.5) (* (/ (PI) (* (* b a) b)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.3 \cdot 10^{-32}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot b} \cdot 0.5\\
\end{array}
\end{array}
if a < -2.3000000000000001e-32Initial program 71.3%
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-*.f6475.9
Applied rewrites75.9%
Applied rewrites90.4%
if -2.3000000000000001e-32 < a Initial program 79.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
frac-timesN/A
frac-2negN/A
distribute-lft-neg-outN/A
lower-/.f64N/A
Applied rewrites77.0%
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-*.f6459.3
Applied rewrites59.3%
Applied rewrites67.1%
Final simplification74.1%
(FPCore (a b) :precision binary64 (if (<= a -2.3e-32) (* (/ (PI) (* (* b a) a)) 0.5) (* (/ 0.5 (* (* b b) a)) (PI))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.3 \cdot 10^{-32}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\left(b \cdot b\right) \cdot a} \cdot \mathsf{PI}\left(\right)\\
\end{array}
\end{array}
if a < -2.3000000000000001e-32Initial program 71.3%
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-*.f6475.9
Applied rewrites75.9%
Applied rewrites90.4%
if -2.3000000000000001e-32 < a Initial program 79.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
frac-timesN/A
frac-2negN/A
distribute-lft-neg-outN/A
lower-/.f64N/A
Applied rewrites77.0%
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-*.f6459.3
Applied rewrites59.3%
Applied rewrites59.2%
Final simplification68.6%
(FPCore (a b) :precision binary64 (if (<= a -2.3e-32) (* (/ (PI) (* (* b a) a)) 0.5) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.3 \cdot 10^{-32}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\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.3000000000000001e-32Initial program 71.3%
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-*.f6475.9
Applied rewrites75.9%
Applied rewrites90.4%
if -2.3000000000000001e-32 < a Initial program 79.7%
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-*.f6459.3
Applied rewrites59.3%
Final simplification68.6%
(FPCore (a b) :precision binary64 (* (/ (PI) (* (* b a) a)) 0.5))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5
\end{array}
Initial 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-*.f6458.3
Applied rewrites58.3%
Applied rewrites65.6%
Final simplification65.6%
(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 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-*.f6458.3
Applied rewrites58.3%
Applied rewrites58.3%
Applied rewrites65.5%
Final simplification65.5%
(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 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-*.f6458.3
Applied rewrites58.3%
Applied rewrites58.3%
Final simplification58.3%
herbie shell --seed 2024248
(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))))