
(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 (+ a b)) (PI)) (/ (pow b -1.0) a)))
\begin{array}{l}
\\
\left(\frac{0.5}{a + b} \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{{b}^{-1}}{a}
\end{array}
Initial program 79.3%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
*-lft-identityN/A
*-rgt-identityN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
*-lft-identityN/A
*-rgt-identityN/A
Applied rewrites87.5%
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
associate-*r/N/A
frac-timesN/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites92.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6492.6
Applied rewrites92.6%
Taylor expanded in a around 0
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.5
Applied rewrites99.5%
Final simplification99.5%
(FPCore (a b)
:precision binary64
(let* ((t_0 (/ (* (- b a) (PI)) (* (* a b) (* (* 2.0 (+ a b)) (- b a)))))
(t_1 (- (PI))))
(if (<= b -8.5e+76)
(/ (* t_1 (/ -0.5 b)) (* b a))
(if (<= b -5.4e-107)
t_0
(if (<= b 5.6e-110)
(* (/ (PI) a) (/ 0.5 (* b a)))
(if (<= b 8.4e+46) t_0 (* (/ -0.5 b) (/ t_1 (* b a)))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(b - a\right) \cdot \mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot \left(\left(2 \cdot \left(a + b\right)\right) \cdot \left(b - a\right)\right)}\\
t_1 := -\mathsf{PI}\left(\right)\\
\mathbf{if}\;b \leq -8.5 \cdot 10^{+76}:\\
\;\;\;\;\frac{t\_1 \cdot \frac{-0.5}{b}}{b \cdot a}\\
\mathbf{elif}\;b \leq -5.4 \cdot 10^{-107}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 5.6 \cdot 10^{-110}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{a} \cdot \frac{0.5}{b \cdot a}\\
\mathbf{elif}\;b \leq 8.4 \cdot 10^{+46}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{b} \cdot \frac{t\_1}{b \cdot a}\\
\end{array}
\end{array}
if b < -8.49999999999999992e76Initial program 70.0%
Taylor expanded in a around 0
Applied rewrites67.6%
Applied rewrites92.6%
Taylor expanded in a around 0
Applied rewrites98.5%
Applied rewrites98.6%
if -8.49999999999999992e76 < b < -5.3999999999999999e-107 or 5.6000000000000001e-110 < b < 8.4e46Initial program 97.2%
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 rewrites95.1%
if -5.3999999999999999e-107 < b < 5.6000000000000001e-110Initial program 74.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.6
Applied rewrites74.6%
Applied rewrites91.8%
if 8.4e46 < b Initial program 68.9%
Taylor expanded in a around 0
Applied rewrites79.3%
Applied rewrites96.1%
Taylor expanded in a around 0
Applied rewrites98.0%
(FPCore (a b)
:precision binary64
(if (<= a -5.4e-77)
(* (PI) (/ 0.5 (* (* a b) a)))
(if (<= a 2.7e+34)
(* (/ -0.5 b) (/ (- (PI)) (* b a)))
(* (/ (PI) a) (/ 0.5 (* b a))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot a}\\
\mathbf{elif}\;a \leq 2.7 \cdot 10^{+34}:\\
\;\;\;\;\frac{-0.5}{b} \cdot \frac{-\mathsf{PI}\left(\right)}{b \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{a} \cdot \frac{0.5}{b \cdot a}\\
\end{array}
\end{array}
if a < -5.4000000000000001e-77Initial program 81.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.3
Applied rewrites80.3%
Applied rewrites80.3%
Applied rewrites89.3%
if -5.4000000000000001e-77 < a < 2.7e34Initial program 80.8%
Taylor expanded in a around 0
Applied rewrites67.4%
Applied rewrites81.1%
Taylor expanded in a around 0
Applied rewrites87.4%
if 2.7e34 < a Initial program 74.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.7
Applied rewrites81.7%
Applied rewrites95.4%
(FPCore (a b)
:precision binary64
(if (<= a -5.4e-77)
(* (PI) (/ 0.5 (* (* a b) a)))
(if (<= a 2.7e+34)
(/ (* (/ (PI) (* b a)) 0.5) b)
(* (/ (PI) a) (/ 0.5 (* b a))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot a}\\
\mathbf{elif}\;a \leq 2.7 \cdot 10^{+34}:\\
\;\;\;\;\frac{\frac{\mathsf{PI}\left(\right)}{b \cdot a} \cdot 0.5}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{a} \cdot \frac{0.5}{b \cdot a}\\
\end{array}
\end{array}
if a < -5.4000000000000001e-77Initial program 81.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.3
Applied rewrites80.3%
Applied rewrites80.3%
Applied rewrites89.3%
if -5.4000000000000001e-77 < a < 2.7e34Initial program 80.8%
Taylor expanded in b around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites87.3%
Taylor expanded in a around 0
Applied rewrites87.3%
if 2.7e34 < a Initial program 74.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.7
Applied rewrites81.7%
Applied rewrites95.4%
(FPCore (a b)
:precision binary64
(if (<= a -5.4e-77)
(* (PI) (/ 0.5 (* (* a b) a)))
(if (<= a 2.7e+34)
(/ (* (- (PI)) -0.5) (* (* b a) b))
(* (/ (PI) a) (/ 0.5 (* b a))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot a}\\
\mathbf{elif}\;a \leq 2.7 \cdot 10^{+34}:\\
\;\;\;\;\frac{\left(-\mathsf{PI}\left(\right)\right) \cdot -0.5}{\left(b \cdot a\right) \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{a} \cdot \frac{0.5}{b \cdot a}\\
\end{array}
\end{array}
if a < -5.4000000000000001e-77Initial program 81.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.3
Applied rewrites80.3%
Applied rewrites80.3%
Applied rewrites89.3%
if -5.4000000000000001e-77 < a < 2.7e34Initial program 80.8%
Taylor expanded in a around 0
Applied rewrites67.4%
Applied rewrites81.1%
Taylor expanded in a around 0
Applied rewrites87.4%
Applied rewrites87.1%
if 2.7e34 < a Initial program 74.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.7
Applied rewrites81.7%
Applied rewrites95.4%
(FPCore (a b)
:precision binary64
(if (<= a -5.4e-77)
(* (PI) (/ 0.5 (* (* a b) a)))
(if (<= a 2.7e+34)
(/ (* (- (PI)) -0.5) (* (* b a) b))
(* (PI) (/ (/ 0.5 a) (* a b))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot a}\\
\mathbf{elif}\;a \leq 2.7 \cdot 10^{+34}:\\
\;\;\;\;\frac{\left(-\mathsf{PI}\left(\right)\right) \cdot -0.5}{\left(b \cdot a\right) \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{\frac{0.5}{a}}{a \cdot b}\\
\end{array}
\end{array}
if a < -5.4000000000000001e-77Initial program 81.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.3
Applied rewrites80.3%
Applied rewrites80.3%
Applied rewrites89.3%
if -5.4000000000000001e-77 < a < 2.7e34Initial program 80.8%
Taylor expanded in a around 0
Applied rewrites67.4%
Applied rewrites81.1%
Taylor expanded in a around 0
Applied rewrites87.4%
Applied rewrites87.1%
if 2.7e34 < a Initial program 74.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.7
Applied rewrites81.7%
Applied rewrites81.7%
Applied rewrites95.3%
(FPCore (a b)
:precision binary64
(if (<= a -5.4e-77)
(* (PI) (/ 0.5 (* (* a b) a)))
(if (<= a 2.3e+35)
(/ (* (- (PI)) -0.5) (* (* b a) b))
(* (/ (PI) (* (* b a) a)) 0.5))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot a}\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{+35}:\\
\;\;\;\;\frac{\left(-\mathsf{PI}\left(\right)\right) \cdot -0.5}{\left(b \cdot a\right) \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
\end{array}
\end{array}
if a < -5.4000000000000001e-77Initial program 81.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.3
Applied rewrites80.3%
Applied rewrites80.3%
Applied rewrites89.3%
if -5.4000000000000001e-77 < a < 2.2999999999999998e35Initial program 81.1%
Taylor expanded in a around 0
Applied rewrites67.1%
Applied rewrites80.6%
Taylor expanded in a around 0
Applied rewrites86.8%
Applied rewrites86.5%
if 2.2999999999999998e35 < a Initial program 73.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
Applied rewrites95.9%
(FPCore (a b)
:precision binary64
(if (<= a -5.4e-77)
(* (PI) (/ 0.5 (* (* a b) a)))
(if (<= a 2.3e+35)
(* (/ (PI) (* (* b b) a)) 0.5)
(* (/ (PI) (* (* b a) a)) 0.5))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot a}\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{+35}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot b\right) \cdot a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot a} \cdot 0.5\\
\end{array}
\end{array}
if a < -5.4000000000000001e-77Initial program 81.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.3
Applied rewrites80.3%
Applied rewrites80.3%
Applied rewrites89.3%
if -5.4000000000000001e-77 < a < 2.2999999999999998e35Initial program 81.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-*.f6473.3
Applied rewrites73.3%
if 2.2999999999999998e35 < a Initial program 73.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
Applied rewrites95.9%
(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.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6456.3
Applied rewrites56.3%
Applied rewrites62.1%
(FPCore (a b) :precision binary64 (* (PI) (/ 0.5 (* (* a b) a))))
\begin{array}{l}
\\
\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot a}
\end{array}
Initial program 79.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6456.3
Applied rewrites56.3%
Applied rewrites56.3%
Applied rewrites62.1%
(FPCore (a b) :precision binary64 (* (PI) (/ 0.5 (* (* a a) b))))
\begin{array}{l}
\\
\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot a\right) \cdot b}
\end{array}
Initial program 79.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6456.3
Applied rewrites56.3%
Applied rewrites56.3%
herbie shell --seed 2024351
(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))))