
(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 7 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) (+ b a)) (* (* b a) 2.0)))
\begin{array}{l}
\\
\frac{\frac{\mathsf{PI}\left(\right)}{b + a}}{\left(b \cdot a\right) \cdot 2}
\end{array}
Initial program 81.0%
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 rewrites88.0%
Applied rewrites81.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
Applied rewrites99.7%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* (PI) (/ 0.5 (* (* a b) b))))
(t_1 (/ (* 0.5 (PI)) (* (* a b) a))))
(if (<= a -7.8e+31)
t_1
(if (<= a -1020000000.0)
t_0
(if (<= a -0.2)
(* (PI) (/ 0.5 (* (* a a) b)))
(if (or (<= a 9.6e-7) (not (<= a 1.9e+284))) t_0 t_1))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot b}\\
t_1 := \frac{0.5 \cdot \mathsf{PI}\left(\right)}{\left(a \cdot b\right) \cdot a}\\
\mathbf{if}\;a \leq -7.8 \cdot 10^{+31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -1020000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq -0.2:\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot a\right) \cdot b}\\
\mathbf{elif}\;a \leq 9.6 \cdot 10^{-7} \lor \neg \left(a \leq 1.9 \cdot 10^{+284}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -7.79999999999999999e31 or 9.59999999999999914e-7 < a < 1.8999999999999999e284Initial program 79.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6481.4
Applied rewrites81.4%
Applied rewrites81.3%
Applied rewrites92.7%
if -7.79999999999999999e31 < a < -1.02e9 or -0.20000000000000001 < a < 9.59999999999999914e-7 or 1.8999999999999999e284 < a Initial program 82.4%
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 rewrites88.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-*.f6470.5
Applied rewrites70.5%
Applied rewrites70.5%
Applied rewrites82.6%
if -1.02e9 < a < -0.20000000000000001Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
Applied rewrites100.0%
Final simplification87.3%
(FPCore (a b)
:precision binary64
(if (or (<= b -0.000375)
(not
(or (<= b -2.6e-300)
(not (or (<= b -7.2e-301) (not (<= b 1.52e-37)))))))
(* (PI) (/ 0.5 (* (* a b) b)))
(* (PI) (/ 0.5 (* (* a a) b)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.000375 \lor \neg \left(b \leq -2.6 \cdot 10^{-300} \lor \neg \left(b \leq -7.2 \cdot 10^{-301} \lor \neg \left(b \leq 1.52 \cdot 10^{-37}\right)\right)\right):\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot a\right) \cdot b}\\
\end{array}
\end{array}
if b < -3.7500000000000001e-4 or -2.59999999999999997e-300 < b < -7.20000000000000015e-301 or 1.52e-37 < b Initial program 79.6%
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.9%
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-*.f6476.5
Applied rewrites76.5%
Applied rewrites76.5%
Applied rewrites88.1%
if -3.7500000000000001e-4 < b < -2.59999999999999997e-300 or -7.20000000000000015e-301 < b < 1.52e-37Initial program 82.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6474.5
Applied rewrites74.5%
Applied rewrites74.4%
Applied rewrites74.4%
Final simplification82.0%
(FPCore (a b) :precision binary64 (/ (PI) (* (+ a b) (* 2.0 (* a b)))))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right)}{\left(a + b\right) \cdot \left(2 \cdot \left(a \cdot b\right)\right)}
\end{array}
Initial program 81.0%
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 rewrites88.0%
Applied rewrites81.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
associate-/l/N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lower-neg.f6499.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
Applied rewrites99.1%
Final simplification99.1%
(FPCore (a b) :precision binary64 (/ (PI) (* (* (+ a b) b) (* 2.0 a))))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right)}{\left(\left(a + b\right) \cdot b\right) \cdot \left(2 \cdot a\right)}
\end{array}
Initial program 81.0%
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 rewrites88.0%
Applied rewrites81.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6492.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6492.7
Applied rewrites92.7%
(FPCore (a b) :precision binary64 (* (/ (PI) (* (* b a) b)) 0.5))
\begin{array}{l}
\\
\frac{\mathsf{PI}\left(\right)}{\left(b \cdot a\right) \cdot b} \cdot 0.5
\end{array}
Initial program 81.0%
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 rewrites88.0%
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-*.f6453.8
Applied rewrites53.8%
Applied rewrites60.3%
(FPCore (a b) :precision binary64 (* (PI) (/ 0.5 (* (* a b) b))))
\begin{array}{l}
\\
\mathsf{PI}\left(\right) \cdot \frac{0.5}{\left(a \cdot b\right) \cdot b}
\end{array}
Initial program 81.0%
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 rewrites88.0%
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-*.f6453.8
Applied rewrites53.8%
Applied rewrites53.8%
Applied rewrites60.3%
herbie shell --seed 2024338
(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))))