
(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 11 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)) (- b a)) (/ (PI) (+ b a))) (- b a)))
\begin{array}{l}
\\
\frac{\left(\frac{0.5}{b \cdot a} \cdot \left(b - a\right)\right) \cdot \frac{\mathsf{PI}\left(\right)}{b + a}}{b - a}
\end{array}
Initial program 79.2%
Applied rewrites90.2%
Applied rewrites99.6%
Final simplification99.6%
(FPCore (a b) :precision binary64 (/ 1.0 (* (/ (* b a) (* 0.5 (PI))) (+ b a))))
\begin{array}{l}
\\
\frac{1}{\frac{b \cdot a}{0.5 \cdot \mathsf{PI}\left(\right)} \cdot \left(b + a\right)}
\end{array}
Initial program 79.2%
Applied rewrites90.2%
Applied rewrites98.8%
Applied rewrites98.8%
(FPCore (a b) :precision binary64 (if (<= a -9.2e-99) (/ (/ (* 0.5 (PI)) (* b a)) a) (/ (/ (PI) b) (* 2.0 (* b a)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.2 \cdot 10^{-99}:\\
\;\;\;\;\frac{\frac{0.5 \cdot \mathsf{PI}\left(\right)}{b \cdot a}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{b}}{2 \cdot \left(b \cdot a\right)}\\
\end{array}
\end{array}
if a < -9.1999999999999994e-99Initial program 79.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-*.f6473.8
Applied rewrites73.8%
Applied rewrites82.9%
if -9.1999999999999994e-99 < a Initial program 79.2%
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 rewrites86.3%
Taylor expanded in b around inf
lower-/.f64N/A
lower-PI.f6472.5
Applied rewrites72.5%
Final simplification76.1%
(FPCore (a b) :precision binary64 (if (<= a -9.2e-99) (/ (/ (* 0.5 (PI)) (* b a)) a) (* (/ (/ (PI) (* b a)) b) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.2 \cdot 10^{-99}:\\
\;\;\;\;\frac{\frac{0.5 \cdot \mathsf{PI}\left(\right)}{b \cdot a}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{b \cdot a}}{b} \cdot 0.5\\
\end{array}
\end{array}
if a < -9.1999999999999994e-99Initial program 79.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-*.f6473.8
Applied rewrites73.8%
Applied rewrites82.9%
if -9.1999999999999994e-99 < a Initial program 79.2%
Applied rewrites89.5%
Applied rewrites99.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
unpow2N/A
associate-/r*N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f6472.5
Applied rewrites72.5%
Final simplification76.1%
(FPCore (a b) :precision binary64 (if (<= a -3.2e-184) (/ (/ (* 0.5 (PI)) (* b a)) a) (/ (PI) (* (* 2.0 (* b a)) (- b a)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.2 \cdot 10^{-184}:\\
\;\;\;\;\frac{\frac{0.5 \cdot \mathsf{PI}\left(\right)}{b \cdot a}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(2 \cdot \left(b \cdot a\right)\right) \cdot \left(b - a\right)}\\
\end{array}
\end{array}
if a < -3.2e-184Initial program 81.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-*.f6467.0
Applied rewrites67.0%
Applied rewrites74.9%
if -3.2e-184 < a Initial program 77.9%
Applied rewrites89.2%
Applied rewrites98.5%
Taylor expanded in b around inf
lower-PI.f6472.9
Applied rewrites72.9%
Final simplification73.7%
(FPCore (a b) :precision binary64 (if (<= a -3.2e-184) (* (/ (PI) a) (/ 0.5 (* b a))) (/ (PI) (* (* 2.0 (* b a)) (- b a)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.2 \cdot 10^{-184}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{a} \cdot \frac{0.5}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(2 \cdot \left(b \cdot a\right)\right) \cdot \left(b - a\right)}\\
\end{array}
\end{array}
if a < -3.2e-184Initial program 81.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-*.f6467.0
Applied rewrites67.0%
Applied rewrites74.9%
if -3.2e-184 < a Initial program 77.9%
Applied rewrites89.2%
Applied rewrites98.5%
Taylor expanded in b around inf
lower-PI.f6472.9
Applied rewrites72.9%
Final simplification73.7%
(FPCore (a b) :precision binary64 (if (<= a -3.2e-184) (* (/ (PI) (* (* b a) a)) 0.5) (/ (PI) (* (* 2.0 (* b a)) (- b a)))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.2 \cdot 10^{-184}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(2 \cdot \left(b \cdot a\right)\right) \cdot \left(b - a\right)}\\
\end{array}
\end{array}
if a < -3.2e-184Initial program 81.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-*.f6467.0
Applied rewrites67.0%
Applied rewrites74.4%
if -3.2e-184 < a Initial program 77.9%
Applied rewrites89.2%
Applied rewrites98.5%
Taylor expanded in b around inf
lower-PI.f6472.9
Applied rewrites72.9%
Final simplification73.5%
(FPCore (a b) :precision binary64 (if (<= a -9.2e-99) (* (/ (PI) (* (* b a) a)) 0.5) (* (/ (PI) (* (* b b) a)) 0.5)))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.2 \cdot 10^{-99}:\\
\;\;\;\;\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 < -9.1999999999999994e-99Initial program 79.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-*.f6473.8
Applied rewrites73.8%
Applied rewrites82.3%
if -9.1999999999999994e-99 < a Initial program 79.2%
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-*.f6464.0
Applied rewrites64.0%
Final simplification70.4%
(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 79.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.4
Applied rewrites58.4%
Applied rewrites64.3%
Final simplification64.3%
(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 79.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.4
Applied rewrites58.4%
Applied rewrites58.3%
Applied rewrites64.2%
Final simplification64.2%
(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.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.4
Applied rewrites58.4%
Applied rewrites58.3%
Final simplification58.3%
herbie shell --seed 2024243
(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))))