
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (+ 1.0 a)) (* (* b b) (- 1.0 (* 3.0 a)))))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (((a * a) * (1.0d0 + a)) + ((b * b) * (1.0d0 - (3.0d0 * a)))))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 + a)) + Float64(Float64(b * b) * Float64(1.0 - Float64(3.0 * a)))))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0; end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 + a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (+ 1.0 a)) (* (* b b) (- 1.0 (* 3.0 a)))))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (((a * a) * (1.0d0 + a)) + ((b * b) * (1.0d0 - (3.0d0 * a)))))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 + a)) + Float64(Float64(b * b) * Float64(1.0 - Float64(3.0 * a)))))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0; end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 + a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1
\end{array}
(FPCore (a b)
:precision binary64
(let* ((t_0
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0))))))))
(if (<= t_0 INFINITY) (+ t_0 -1.0) (* (* a a) (fma a (+ a 4.0) 4.0)))))
double code(double a, double b) {
double t_0 = pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 + -1.0;
} else {
tmp = (a * a) * fma(a, (a + 4.0), 4.0);
}
return tmp;
}
function code(a, b) t_0 = Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(a + 1.0)) + Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0)))))) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(t_0 + -1.0); else tmp = Float64(Float64(a * a) * fma(a, Float64(a + 4.0), 4.0)); end return tmp end
code[a_, b_] := Block[{t$95$0 = N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 + -1.0), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * N[(a * N[(a + 4.0), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right)\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 + -1\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \mathsf{fma}\left(a, a + 4, 4\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (+.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (-.f64 #s(literal 1 binary64) (*.f64 #s(literal 3 binary64) a)))))) < +inf.0Initial program 99.9%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (+.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (-.f64 #s(literal 1 binary64) (*.f64 #s(literal 3 binary64) a)))))) Initial program 0.0%
Taylor expanded in b around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
accelerator-lowering-fma.f6495.7
Simplified95.7%
*-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-+r+N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6495.7
Applied egg-rr95.7%
Taylor expanded in a around inf
Simplified95.7%
Final simplification98.8%
(FPCore (a b)
:precision binary64
(let* ((t_0 (fma a a (* b b)))
(t_1 (* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0)))))))
(if (<= (+ (pow (+ (* a a) (* b b)) 2.0) t_1) INFINITY)
(+ (+ t_1 (/ t_0 (/ 1.0 t_0))) -1.0)
(* (* a a) (fma a (+ a 4.0) 4.0)))))
double code(double a, double b) {
double t_0 = fma(a, a, (b * b));
double t_1 = 4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0))));
double tmp;
if ((pow(((a * a) + (b * b)), 2.0) + t_1) <= ((double) INFINITY)) {
tmp = (t_1 + (t_0 / (1.0 / t_0))) + -1.0;
} else {
tmp = (a * a) * fma(a, (a + 4.0), 4.0);
}
return tmp;
}
function code(a, b) t_0 = fma(a, a, Float64(b * b)) t_1 = Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(a + 1.0)) + Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0))))) tmp = 0.0 if (Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + t_1) <= Inf) tmp = Float64(Float64(t_1 + Float64(t_0 / Float64(1.0 / t_0))) + -1.0); else tmp = Float64(Float64(a * a) * fma(a, Float64(a + 4.0), 4.0)); end return tmp end
code[a_, b_] := Block[{t$95$0 = N[(a * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + t$95$1), $MachinePrecision], Infinity], N[(N[(t$95$1 + N[(t$95$0 / N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * N[(a * N[(a + 4.0), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, a, b \cdot b\right)\\
t_1 := 4 \cdot \left(\left(a \cdot a\right) \cdot \left(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right)\\
\mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + t\_1 \leq \infty:\\
\;\;\;\;\left(t\_1 + \frac{t\_0}{\frac{1}{t\_0}}\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \mathsf{fma}\left(a, a + 4, 4\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (+.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (-.f64 #s(literal 1 binary64) (*.f64 #s(literal 3 binary64) a)))))) < +inf.0Initial program 99.9%
unpow2N/A
flip-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
clear-numN/A
flip-+N/A
/-lowering-/.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6499.9
Applied egg-rr99.9%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (+.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (-.f64 #s(literal 1 binary64) (*.f64 #s(literal 3 binary64) a)))))) Initial program 0.0%
Taylor expanded in b around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
accelerator-lowering-fma.f6495.7
Simplified95.7%
*-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-+r+N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6495.7
Applied egg-rr95.7%
Taylor expanded in a around inf
Simplified95.7%
Final simplification98.8%
(FPCore (a b)
:precision binary64
(if (<=
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0))))))
2e-8)
-1.0
(* (* b b) 4.0)))
double code(double a, double b) {
double tmp;
if ((pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))))) <= 2e-8) {
tmp = -1.0;
} else {
tmp = (b * b) * 4.0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (((a * a) * (a + 1.0d0)) + ((b * b) * (1.0d0 - (a * 3.0d0)))))) <= 2d-8) then
tmp = -1.0d0
else
tmp = (b * b) * 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))))) <= 2e-8) {
tmp = -1.0;
} else {
tmp = (b * b) * 4.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))))) <= 2e-8: tmp = -1.0 else: tmp = (b * b) * 4.0 return tmp
function code(a, b) tmp = 0.0 if (Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(a + 1.0)) + Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0)))))) <= 2e-8) tmp = -1.0; else tmp = Float64(Float64(b * b) * 4.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))))) <= 2e-8) tmp = -1.0; else tmp = (b * b) * 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e-8], -1.0, N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right) \leq 2 \cdot 10^{-8}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 4\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (+.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (-.f64 #s(literal 1 binary64) (*.f64 #s(literal 3 binary64) a)))))) < 2e-8Initial program 100.0%
Taylor expanded in a around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f6498.5
Simplified98.5%
Taylor expanded in b around 0
Simplified98.2%
if 2e-8 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (+.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (-.f64 #s(literal 1 binary64) (*.f64 #s(literal 3 binary64) a)))))) Initial program 64.0%
Taylor expanded in a around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f6463.0
Simplified63.0%
Taylor expanded in b around 0
Simplified37.2%
Taylor expanded in b around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.6
Simplified37.6%
Final simplification54.0%
(FPCore (a b) :precision binary64 (if (<= (* b b) 5e-8) (fma (fma a (+ a 4.0) 4.0) (* a a) -1.0) (fma (* b b) (fma b b 4.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 5e-8) {
tmp = fma(fma(a, (a + 4.0), 4.0), (a * a), -1.0);
} else {
tmp = fma((b * b), fma(b, b, 4.0), -1.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 5e-8) tmp = fma(fma(a, Float64(a + 4.0), 4.0), Float64(a * a), -1.0); else tmp = fma(Float64(b * b), fma(b, b, 4.0), -1.0); end return tmp end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 5e-8], N[(N[(a * N[(a + 4.0), $MachinePrecision] + 4.0), $MachinePrecision] * N[(a * a), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(b * b + 4.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 5 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(a, a + 4, 4\right), a \cdot a, -1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 4\right), -1\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 4.9999999999999998e-8Initial program 84.6%
Taylor expanded in b around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
accelerator-lowering-fma.f6499.8
Simplified99.8%
*-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-+r+N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6499.8
Applied egg-rr99.8%
if 4.9999999999999998e-8 < (*.f64 b b) Initial program 62.3%
Taylor expanded in a around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f6493.8
Simplified93.8%
(FPCore (a b)
:precision binary64
(if (<= a -620000.0)
(* (* a a) (fma a (+ a 4.0) 4.0))
(if (<= a 4.8e+15)
(fma (* b b) (fma b b 4.0) -1.0)
(* a (* a (* a (+ a 4.0)))))))
double code(double a, double b) {
double tmp;
if (a <= -620000.0) {
tmp = (a * a) * fma(a, (a + 4.0), 4.0);
} else if (a <= 4.8e+15) {
tmp = fma((b * b), fma(b, b, 4.0), -1.0);
} else {
tmp = a * (a * (a * (a + 4.0)));
}
return tmp;
}
function code(a, b) tmp = 0.0 if (a <= -620000.0) tmp = Float64(Float64(a * a) * fma(a, Float64(a + 4.0), 4.0)); elseif (a <= 4.8e+15) tmp = fma(Float64(b * b), fma(b, b, 4.0), -1.0); else tmp = Float64(a * Float64(a * Float64(a * Float64(a + 4.0)))); end return tmp end
code[a_, b_] := If[LessEqual[a, -620000.0], N[(N[(a * a), $MachinePrecision] * N[(a * N[(a + 4.0), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.8e+15], N[(N[(b * b), $MachinePrecision] * N[(b * b + 4.0), $MachinePrecision] + -1.0), $MachinePrecision], N[(a * N[(a * N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -620000:\\
\;\;\;\;\left(a \cdot a\right) \cdot \mathsf{fma}\left(a, a + 4, 4\right)\\
\mathbf{elif}\;a \leq 4.8 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 4\right), -1\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(a \cdot \left(a \cdot \left(a + 4\right)\right)\right)\\
\end{array}
\end{array}
if a < -6.2e5Initial program 32.5%
Taylor expanded in b around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
accelerator-lowering-fma.f6493.1
Simplified93.1%
*-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-+r+N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6493.1
Applied egg-rr93.1%
Taylor expanded in a around inf
Simplified93.1%
if -6.2e5 < a < 4.8e15Initial program 98.5%
Taylor expanded in a around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f6499.2
Simplified99.2%
if 4.8e15 < a Initial program 53.3%
Taylor expanded in b around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
accelerator-lowering-fma.f6498.4
Simplified98.4%
*-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-+r+N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6498.4
Applied egg-rr98.4%
Taylor expanded in a around inf
Simplified98.4%
Final simplification97.7%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (* a (* a (+ a 4.0))))))
(if (<= a -1350000.0)
t_0
(if (<= a 6e+15) (fma (* b b) (fma b b 4.0) -1.0) t_0))))
double code(double a, double b) {
double t_0 = a * (a * (a * (a + 4.0)));
double tmp;
if (a <= -1350000.0) {
tmp = t_0;
} else if (a <= 6e+15) {
tmp = fma((b * b), fma(b, b, 4.0), -1.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b) t_0 = Float64(a * Float64(a * Float64(a * Float64(a + 4.0)))) tmp = 0.0 if (a <= -1350000.0) tmp = t_0; elseif (a <= 6e+15) tmp = fma(Float64(b * b), fma(b, b, 4.0), -1.0); else tmp = t_0; end return tmp end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1350000.0], t$95$0, If[LessEqual[a, 6e+15], N[(N[(b * b), $MachinePrecision] * N[(b * b + 4.0), $MachinePrecision] + -1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot \left(a \cdot \left(a + 4\right)\right)\right)\\
\mathbf{if}\;a \leq -1350000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 6 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 4\right), -1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -1.35e6 or 6e15 < a Initial program 43.4%
Taylor expanded in b around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
accelerator-lowering-fma.f6495.8
Simplified95.8%
*-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-+r+N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6495.8
Applied egg-rr95.8%
Taylor expanded in a around inf
Simplified95.7%
if -1.35e6 < a < 6e15Initial program 98.5%
Taylor expanded in a around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f6499.2
Simplified99.2%
Final simplification97.6%
(FPCore (a b) :precision binary64 (if (<= (* b b) 5e-8) (fma (* a a) (* a (+ a 4.0)) -1.0) (fma (* b b) (fma b b 4.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 5e-8) {
tmp = fma((a * a), (a * (a + 4.0)), -1.0);
} else {
tmp = fma((b * b), fma(b, b, 4.0), -1.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 5e-8) tmp = fma(Float64(a * a), Float64(a * Float64(a + 4.0)), -1.0); else tmp = fma(Float64(b * b), fma(b, b, 4.0), -1.0); end return tmp end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 5e-8], N[(N[(a * a), $MachinePrecision] * N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(b * b + 4.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 5 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot a, a \cdot \left(a + 4\right), -1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 4\right), -1\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 4.9999999999999998e-8Initial program 84.6%
Taylor expanded in b around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
accelerator-lowering-fma.f6499.8
Simplified99.8%
Taylor expanded in a around inf
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
+-lowering-+.f6498.9
Simplified98.9%
if 4.9999999999999998e-8 < (*.f64 b b) Initial program 62.3%
Taylor expanded in a around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f6493.8
Simplified93.8%
Final simplification96.4%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (* a (* a a)))))
(if (<= a -1150000.0)
t_0
(if (<= a 1.35e+16) (fma (* b b) (fma b b 4.0) -1.0) t_0))))
double code(double a, double b) {
double t_0 = a * (a * (a * a));
double tmp;
if (a <= -1150000.0) {
tmp = t_0;
} else if (a <= 1.35e+16) {
tmp = fma((b * b), fma(b, b, 4.0), -1.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b) t_0 = Float64(a * Float64(a * Float64(a * a))) tmp = 0.0 if (a <= -1150000.0) tmp = t_0; elseif (a <= 1.35e+16) tmp = fma(Float64(b * b), fma(b, b, 4.0), -1.0); else tmp = t_0; end return tmp end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1150000.0], t$95$0, If[LessEqual[a, 1.35e+16], N[(N[(b * b), $MachinePrecision] * N[(b * b + 4.0), $MachinePrecision] + -1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot \left(a \cdot a\right)\right)\\
\mathbf{if}\;a \leq -1150000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 4\right), -1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -1.15e6 or 1.35e16 < a Initial program 43.4%
Taylor expanded in a around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6495.3
Simplified95.3%
if -1.15e6 < a < 1.35e16Initial program 98.5%
Taylor expanded in a around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f6499.2
Simplified99.2%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (* a (* a a)))))
(if (<= a -3400000.0)
t_0
(if (<= a 2e+16) (* (fma b b 1.0) (fma b b -1.0)) t_0))))
double code(double a, double b) {
double t_0 = a * (a * (a * a));
double tmp;
if (a <= -3400000.0) {
tmp = t_0;
} else if (a <= 2e+16) {
tmp = fma(b, b, 1.0) * fma(b, b, -1.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b) t_0 = Float64(a * Float64(a * Float64(a * a))) tmp = 0.0 if (a <= -3400000.0) tmp = t_0; elseif (a <= 2e+16) tmp = Float64(fma(b, b, 1.0) * fma(b, b, -1.0)); else tmp = t_0; end return tmp end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3400000.0], t$95$0, If[LessEqual[a, 2e+16], N[(N[(b * b + 1.0), $MachinePrecision] * N[(b * b + -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot \left(a \cdot a\right)\right)\\
\mathbf{if}\;a \leq -3400000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 2 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(b, b, 1\right) \cdot \mathsf{fma}\left(b, b, -1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -3.4e6 or 2e16 < a Initial program 43.4%
Taylor expanded in a around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6495.3
Simplified95.3%
if -3.4e6 < a < 2e16Initial program 98.5%
Taylor expanded in a around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f6499.2
Simplified99.2%
flip-+N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
sub-negN/A
accelerator-lowering-fma.f64N/A
metadata-evalN/A
sub-negN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval72.2
Applied egg-rr72.2%
Taylor expanded in b around inf
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6497.9
Simplified97.9%
remove-double-divN/A
difference-of-sqr--1N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f6497.9
Applied egg-rr97.9%
(FPCore (a b) :precision binary64 (let* ((t_0 (* a (* a (* a a))))) (if (<= a -700000.0) t_0 (if (<= a 8e+15) (fma (* b b) 4.0 -1.0) t_0))))
double code(double a, double b) {
double t_0 = a * (a * (a * a));
double tmp;
if (a <= -700000.0) {
tmp = t_0;
} else if (a <= 8e+15) {
tmp = fma((b * b), 4.0, -1.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b) t_0 = Float64(a * Float64(a * Float64(a * a))) tmp = 0.0 if (a <= -700000.0) tmp = t_0; elseif (a <= 8e+15) tmp = fma(Float64(b * b), 4.0, -1.0); else tmp = t_0; end return tmp end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -700000.0], t$95$0, If[LessEqual[a, 8e+15], N[(N[(b * b), $MachinePrecision] * 4.0 + -1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot \left(a \cdot a\right)\right)\\
\mathbf{if}\;a \leq -700000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 8 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot b, 4, -1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < -7e5 or 8e15 < a Initial program 43.4%
Taylor expanded in a around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6495.3
Simplified95.3%
if -7e5 < a < 8e15Initial program 98.5%
Taylor expanded in a around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f6499.2
Simplified99.2%
Taylor expanded in b around 0
Simplified76.9%
(FPCore (a b) :precision binary64 (if (<= (* b b) 400000000000.0) (fma (* a a) 4.0 -1.0) (* b (* b (fma b b 4.0)))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 400000000000.0) {
tmp = fma((a * a), 4.0, -1.0);
} else {
tmp = b * (b * fma(b, b, 4.0));
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 400000000000.0) tmp = fma(Float64(a * a), 4.0, -1.0); else tmp = Float64(b * Float64(b * fma(b, b, 4.0))); end return tmp end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 400000000000.0], N[(N[(a * a), $MachinePrecision] * 4.0 + -1.0), $MachinePrecision], N[(b * N[(b * N[(b * b + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 400000000000:\\
\;\;\;\;\mathsf{fma}\left(a \cdot a, 4, -1\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 4e11Initial program 84.2%
Taylor expanded in b around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
accelerator-lowering-fma.f6498.3
Simplified98.3%
Taylor expanded in a around 0
Simplified80.0%
if 4e11 < (*.f64 b b) Initial program 62.2%
Taylor expanded in a around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f6494.5
Simplified94.5%
flip-+N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
sub-negN/A
accelerator-lowering-fma.f64N/A
metadata-evalN/A
sub-negN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval41.2
Applied egg-rr41.2%
Taylor expanded in b around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
unpow2N/A
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6494.5
Simplified94.5%
(FPCore (a b) :precision binary64 (if (<= (* b b) 1e+16) (fma (* a a) 4.0 -1.0) (* b (* b (* b b)))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 1e+16) {
tmp = fma((a * a), 4.0, -1.0);
} else {
tmp = b * (b * (b * b));
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 1e+16) tmp = fma(Float64(a * a), 4.0, -1.0); else tmp = Float64(b * Float64(b * Float64(b * b))); end return tmp end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 1e+16], N[(N[(a * a), $MachinePrecision] * 4.0 + -1.0), $MachinePrecision], N[(b * N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot a, 4, -1\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot \left(b \cdot b\right)\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 1e16Initial program 84.4%
Taylor expanded in b around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
accelerator-lowering-fma.f6497.6
Simplified97.6%
Taylor expanded in a around 0
Simplified79.6%
if 1e16 < (*.f64 b b) Initial program 61.6%
Taylor expanded in b around inf
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6495.2
Simplified95.2%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e+300) (fma (* a a) 4.0 -1.0) (* (* b b) 4.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+300) {
tmp = fma((a * a), 4.0, -1.0);
} else {
tmp = (b * b) * 4.0;
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e+300) tmp = fma(Float64(a * a), 4.0, -1.0); else tmp = Float64(Float64(b * b) * 4.0); end return tmp end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+300], N[(N[(a * a), $MachinePrecision] * 4.0 + -1.0), $MachinePrecision], N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+300}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot a, 4, -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 4\\
\end{array}
\end{array}
if (*.f64 b b) < 2.0000000000000001e300Initial program 77.9%
Taylor expanded in b around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
accelerator-lowering-fma.f6481.8
Simplified81.8%
Taylor expanded in a around 0
Simplified65.5%
if 2.0000000000000001e300 < (*.f64 b b) Initial program 61.5%
Taylor expanded in a around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f64100.0
Simplified100.0%
Taylor expanded in b around 0
Simplified100.0%
Taylor expanded in b around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64100.0
Simplified100.0%
Final simplification74.3%
(FPCore (a b) :precision binary64 -1.0)
double code(double a, double b) {
return -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = -1.0d0
end function
public static double code(double a, double b) {
return -1.0;
}
def code(a, b): return -1.0
function code(a, b) return -1.0 end
function tmp = code(a, b) tmp = -1.0; end
code[a_, b_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 73.7%
Taylor expanded in a around 0
sub-negN/A
+-commutativeN/A
metadata-evalN/A
pow-sqrN/A
distribute-rgt-outN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
accelerator-lowering-fma.f6472.5
Simplified72.5%
Taylor expanded in b around 0
Simplified27.0%
herbie shell --seed 2024198
(FPCore (a b)
:name "Bouland and Aaronson, Equation (25)"
:precision binary64
(- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (+ 1.0 a)) (* (* b b) (- 1.0 (* 3.0 a)))))) 1.0))