
(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 11 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
(if (<=
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0))))))
INFINITY)
(+
(fma
4.0
(fma a (fma a a a) (* b (* b (fma a -3.0 1.0))))
(pow (hypot a b) 4.0))
-1.0)
(+ (+ (* 2.0 (pow (* a b) 2.0)) (pow a 4.0)) (+ -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)))))) <= ((double) INFINITY)) {
tmp = fma(4.0, fma(a, fma(a, a, a), (b * (b * fma(a, -3.0, 1.0)))), pow(hypot(a, b), 4.0)) + -1.0;
} else {
tmp = ((2.0 * pow((a * b), 2.0)) + pow(a, 4.0)) + (-1.0 + ((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)))))) <= Inf) tmp = Float64(fma(4.0, fma(a, fma(a, a, a), Float64(b * Float64(b * fma(a, -3.0, 1.0)))), (hypot(a, b) ^ 4.0)) + -1.0); else tmp = Float64(Float64(Float64(2.0 * (Float64(a * b) ^ 2.0)) + (a ^ 4.0)) + Float64(-1.0 + Float64(Float64(b * b) * 4.0))); end return 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], Infinity], N[(N[(4.0 * N[(a * N[(a * a + a), $MachinePrecision] + N[(b * N[(b * N[(a * -3.0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(2.0 * N[Power[N[(a * b), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision] + N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $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 \infty:\\
\;\;\;\;\mathsf{fma}\left(4, \mathsf{fma}\left(a, \mathsf{fma}\left(a, a, a\right), b \cdot \left(b \cdot \mathsf{fma}\left(a, -3, 1\right)\right)\right), {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4}\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot {\left(a \cdot b\right)}^{2} + {a}^{4}\right) + \left(-1 + \left(b \cdot b\right) \cdot 4\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) < +inf.0Initial program 99.8%
sub-neg99.8%
Simplified100.0%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) Initial program 0.0%
associate--l+0.0%
fma-def0.0%
Simplified6.1%
Taylor expanded in a around inf 6.1%
fma-def6.1%
*-commutative6.1%
unpow26.1%
unpow26.1%
Simplified6.1%
Taylor expanded in a around 0 87.9%
unpow287.9%
Simplified87.9%
fma-udef87.9%
unswap-sqr100.0%
pow2100.0%
Applied egg-rr100.0%
Final simplification100.0%
(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)
(+ (+ (* 2.0 (pow (* a b) 2.0)) (pow a 4.0)) (+ -1.0 (* (* b b) 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 = ((2.0 * pow((a * b), 2.0)) + pow(a, 4.0)) + (-1.0 + ((b * b) * 4.0));
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = Math.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.POSITIVE_INFINITY) {
tmp = t_0 + -1.0;
} else {
tmp = ((2.0 * Math.pow((a * b), 2.0)) + Math.pow(a, 4.0)) + (-1.0 + ((b * b) * 4.0));
}
return tmp;
}
def code(a, b): t_0 = math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0))))) tmp = 0 if t_0 <= math.inf: tmp = t_0 + -1.0 else: tmp = ((2.0 * math.pow((a * b), 2.0)) + math.pow(a, 4.0)) + (-1.0 + ((b * b) * 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(Float64(2.0 * (Float64(a * b) ^ 2.0)) + (a ^ 4.0)) + Float64(-1.0 + Float64(Float64(b * b) * 4.0))); end return tmp end
function tmp_2 = code(a, b) t_0 = (((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0))))); tmp = 0.0; if (t_0 <= Inf) tmp = t_0 + -1.0; else tmp = ((2.0 * ((a * b) ^ 2.0)) + (a ^ 4.0)) + (-1.0 + ((b * b) * 4.0)); end tmp_2 = 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[(N[(2.0 * N[Power[N[(a * b), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision] + N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $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(2 \cdot {\left(a \cdot b\right)}^{2} + {a}^{4}\right) + \left(-1 + \left(b \cdot b\right) \cdot 4\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) < +inf.0Initial program 99.8%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) Initial program 0.0%
associate--l+0.0%
fma-def0.0%
Simplified6.1%
Taylor expanded in a around inf 6.1%
fma-def6.1%
*-commutative6.1%
unpow26.1%
unpow26.1%
Simplified6.1%
Taylor expanded in a around 0 87.9%
unpow287.9%
Simplified87.9%
fma-udef87.9%
unswap-sqr100.0%
pow2100.0%
Applied egg-rr100.0%
Final simplification99.9%
(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)
(+
(+ -1.0 (* (* b b) 4.0))
(fma 2.0 (* (* a a) (* b b)) (* (* a a) (* a a)))))))
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 = (-1.0 + ((b * b) * 4.0)) + fma(2.0, ((a * a) * (b * b)), ((a * a) * (a * a)));
}
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(-1.0 + Float64(Float64(b * b) * 4.0)) + fma(2.0, Float64(Float64(a * a) * Float64(b * b)), Float64(Float64(a * a) * Float64(a * a)))); 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[(-1.0 + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(N[(a * a), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $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(-1 + \left(b \cdot b\right) \cdot 4\right) + \mathsf{fma}\left(2, \left(a \cdot a\right) \cdot \left(b \cdot b\right), \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) < +inf.0Initial program 99.8%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) Initial program 0.0%
associate--l+0.0%
fma-def0.0%
Simplified6.1%
Taylor expanded in a around inf 6.1%
fma-def6.1%
*-commutative6.1%
unpow26.1%
unpow26.1%
Simplified6.1%
Taylor expanded in a around 0 87.9%
unpow287.9%
Simplified87.9%
metadata-eval87.1%
pow-prod-up87.1%
pow-prod-down87.1%
pow287.1%
Applied egg-rr87.9%
Final simplification96.7%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* (* b b) 4.0)))
(if (<= a -88.0)
(pow a 4.0)
(if (<= a 510000.0)
(+ t_0 (+ -1.0 (pow b 4.0)))
(if (<= a 2e+74)
(+ (+ -1.0 t_0) (+ (pow a 4.0) (* 2.0 (* (* a a) (* b b)))))
(* (* a a) (* a a)))))))
double code(double a, double b) {
double t_0 = (b * b) * 4.0;
double tmp;
if (a <= -88.0) {
tmp = pow(a, 4.0);
} else if (a <= 510000.0) {
tmp = t_0 + (-1.0 + pow(b, 4.0));
} else if (a <= 2e+74) {
tmp = (-1.0 + t_0) + (pow(a, 4.0) + (2.0 * ((a * a) * (b * b))));
} else {
tmp = (a * a) * (a * a);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) * 4.0d0
if (a <= (-88.0d0)) then
tmp = a ** 4.0d0
else if (a <= 510000.0d0) then
tmp = t_0 + ((-1.0d0) + (b ** 4.0d0))
else if (a <= 2d+74) then
tmp = ((-1.0d0) + t_0) + ((a ** 4.0d0) + (2.0d0 * ((a * a) * (b * b))))
else
tmp = (a * a) * (a * a)
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = (b * b) * 4.0;
double tmp;
if (a <= -88.0) {
tmp = Math.pow(a, 4.0);
} else if (a <= 510000.0) {
tmp = t_0 + (-1.0 + Math.pow(b, 4.0));
} else if (a <= 2e+74) {
tmp = (-1.0 + t_0) + (Math.pow(a, 4.0) + (2.0 * ((a * a) * (b * b))));
} else {
tmp = (a * a) * (a * a);
}
return tmp;
}
def code(a, b): t_0 = (b * b) * 4.0 tmp = 0 if a <= -88.0: tmp = math.pow(a, 4.0) elif a <= 510000.0: tmp = t_0 + (-1.0 + math.pow(b, 4.0)) elif a <= 2e+74: tmp = (-1.0 + t_0) + (math.pow(a, 4.0) + (2.0 * ((a * a) * (b * b)))) else: tmp = (a * a) * (a * a) return tmp
function code(a, b) t_0 = Float64(Float64(b * b) * 4.0) tmp = 0.0 if (a <= -88.0) tmp = a ^ 4.0; elseif (a <= 510000.0) tmp = Float64(t_0 + Float64(-1.0 + (b ^ 4.0))); elseif (a <= 2e+74) tmp = Float64(Float64(-1.0 + t_0) + Float64((a ^ 4.0) + Float64(2.0 * Float64(Float64(a * a) * Float64(b * b))))); else tmp = Float64(Float64(a * a) * Float64(a * a)); end return tmp end
function tmp_2 = code(a, b) t_0 = (b * b) * 4.0; tmp = 0.0; if (a <= -88.0) tmp = a ^ 4.0; elseif (a <= 510000.0) tmp = t_0 + (-1.0 + (b ^ 4.0)); elseif (a <= 2e+74) tmp = (-1.0 + t_0) + ((a ^ 4.0) + (2.0 * ((a * a) * (b * b)))); else tmp = (a * a) * (a * a); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]}, If[LessEqual[a, -88.0], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 510000.0], N[(t$95$0 + N[(-1.0 + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2e+74], N[(N[(-1.0 + t$95$0), $MachinePrecision] + N[(N[Power[a, 4.0], $MachinePrecision] + N[(2.0 * N[(N[(a * a), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(b \cdot b\right) \cdot 4\\
\mathbf{if}\;a \leq -88:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 510000:\\
\;\;\;\;t_0 + \left(-1 + {b}^{4}\right)\\
\mathbf{elif}\;a \leq 2 \cdot 10^{+74}:\\
\;\;\;\;\left(-1 + t_0\right) + \left({a}^{4} + 2 \cdot \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\
\end{array}
\end{array}
if a < -88Initial program 36.6%
associate--l+36.6%
fma-def36.6%
Simplified43.6%
Taylor expanded in a around inf 90.2%
if -88 < a < 5.1e5Initial program 99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
fma-def99.9%
add-cbrt-cube90.5%
pow390.5%
pow-pow90.5%
add-sqr-sqrt90.5%
hypot-udef90.5%
hypot-udef90.5%
pow290.5%
metadata-eval90.5%
Applied egg-rr90.5%
Taylor expanded in a around 0 87.7%
associate--l+87.7%
+-commutative87.7%
associate--l+87.7%
associate-+r+87.7%
+-commutative87.7%
associate-*r*87.7%
distribute-rgt-out98.5%
unpow298.5%
*-commutative98.5%
sub-neg98.5%
metadata-eval98.5%
Simplified98.5%
Taylor expanded in a around 0 98.5%
if 5.1e5 < a < 1.9999999999999999e74Initial program 58.8%
associate--l+58.8%
fma-def58.8%
Simplified58.8%
Taylor expanded in a around inf 54.8%
fma-def54.8%
*-commutative54.8%
unpow254.8%
unpow254.8%
Simplified54.8%
Taylor expanded in a around 0 95.7%
unpow295.7%
Simplified95.7%
fma-udef95.7%
unswap-sqr95.7%
pow295.7%
Applied egg-rr95.7%
unpow-prod-down95.7%
pow295.7%
pow295.7%
Applied egg-rr95.7%
if 1.9999999999999999e74 < a Initial program 55.3%
associate--l+55.3%
fma-def55.3%
Simplified55.3%
Taylor expanded in a around inf 100.0%
metadata-eval100.0%
pow-prod-up100.0%
pow-prod-down100.0%
pow2100.0%
Applied egg-rr100.0%
Final simplification96.7%
(FPCore (a b)
:precision binary64
(if (<= a -88.0)
(pow a 4.0)
(if (<= a 3.5e+17)
(+ (* (* b b) 4.0) (+ -1.0 (pow b 4.0)))
(+ (pow a 4.0) (+ -1.0 (* (+ a 1.0) (* (* a a) 4.0)))))))
double code(double a, double b) {
double tmp;
if (a <= -88.0) {
tmp = pow(a, 4.0);
} else if (a <= 3.5e+17) {
tmp = ((b * b) * 4.0) + (-1.0 + pow(b, 4.0));
} else {
tmp = pow(a, 4.0) + (-1.0 + ((a + 1.0) * ((a * a) * 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 <= (-88.0d0)) then
tmp = a ** 4.0d0
else if (a <= 3.5d+17) then
tmp = ((b * b) * 4.0d0) + ((-1.0d0) + (b ** 4.0d0))
else
tmp = (a ** 4.0d0) + ((-1.0d0) + ((a + 1.0d0) * ((a * a) * 4.0d0)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -88.0) {
tmp = Math.pow(a, 4.0);
} else if (a <= 3.5e+17) {
tmp = ((b * b) * 4.0) + (-1.0 + Math.pow(b, 4.0));
} else {
tmp = Math.pow(a, 4.0) + (-1.0 + ((a + 1.0) * ((a * a) * 4.0)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -88.0: tmp = math.pow(a, 4.0) elif a <= 3.5e+17: tmp = ((b * b) * 4.0) + (-1.0 + math.pow(b, 4.0)) else: tmp = math.pow(a, 4.0) + (-1.0 + ((a + 1.0) * ((a * a) * 4.0))) return tmp
function code(a, b) tmp = 0.0 if (a <= -88.0) tmp = a ^ 4.0; elseif (a <= 3.5e+17) tmp = Float64(Float64(Float64(b * b) * 4.0) + Float64(-1.0 + (b ^ 4.0))); else tmp = Float64((a ^ 4.0) + Float64(-1.0 + Float64(Float64(a + 1.0) * Float64(Float64(a * a) * 4.0)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -88.0) tmp = a ^ 4.0; elseif (a <= 3.5e+17) tmp = ((b * b) * 4.0) + (-1.0 + (b ^ 4.0)); else tmp = (a ^ 4.0) + (-1.0 + ((a + 1.0) * ((a * a) * 4.0))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -88.0], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 3.5e+17], N[(N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision] + N[(-1.0 + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 4.0], $MachinePrecision] + N[(-1.0 + N[(N[(a + 1.0), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -88:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 3.5 \cdot 10^{+17}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 4 + \left(-1 + {b}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{4} + \left(-1 + \left(a + 1\right) \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right)\\
\end{array}
\end{array}
if a < -88Initial program 36.6%
associate--l+36.6%
fma-def36.6%
Simplified43.6%
Taylor expanded in a around inf 90.2%
if -88 < a < 3.5e17Initial program 97.7%
associate--l+97.7%
fma-def97.7%
Simplified97.7%
fma-def97.7%
add-cbrt-cube88.5%
pow388.5%
pow-pow88.5%
add-sqr-sqrt88.5%
hypot-udef88.5%
hypot-udef88.5%
pow288.5%
metadata-eval88.5%
Applied egg-rr88.5%
Taylor expanded in a around 0 85.7%
associate--l+85.7%
+-commutative85.7%
associate--l+85.7%
associate-+r+85.7%
+-commutative85.7%
associate-*r*85.7%
distribute-rgt-out96.3%
unpow296.3%
*-commutative96.3%
sub-neg96.3%
metadata-eval96.3%
Simplified96.3%
Taylor expanded in a around 0 98.5%
if 3.5e17 < a Initial program 59.0%
associate--l+59.0%
fma-def59.0%
Simplified59.0%
Taylor expanded in b around 0 90.0%
associate--l+90.0%
associate-*r*90.0%
unpow290.0%
Simplified90.0%
Final simplification94.5%
(FPCore (a b) :precision binary64 (if (<= a -88.0) (pow a 4.0) (if (<= a 4.5e+17) (+ (* (* b b) 4.0) (+ -1.0 (pow b 4.0))) (pow a 4.0))))
double code(double a, double b) {
double tmp;
if (a <= -88.0) {
tmp = pow(a, 4.0);
} else if (a <= 4.5e+17) {
tmp = ((b * b) * 4.0) + (-1.0 + pow(b, 4.0));
} else {
tmp = pow(a, 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 <= (-88.0d0)) then
tmp = a ** 4.0d0
else if (a <= 4.5d+17) then
tmp = ((b * b) * 4.0d0) + ((-1.0d0) + (b ** 4.0d0))
else
tmp = a ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -88.0) {
tmp = Math.pow(a, 4.0);
} else if (a <= 4.5e+17) {
tmp = ((b * b) * 4.0) + (-1.0 + Math.pow(b, 4.0));
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -88.0: tmp = math.pow(a, 4.0) elif a <= 4.5e+17: tmp = ((b * b) * 4.0) + (-1.0 + math.pow(b, 4.0)) else: tmp = math.pow(a, 4.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -88.0) tmp = a ^ 4.0; elseif (a <= 4.5e+17) tmp = Float64(Float64(Float64(b * b) * 4.0) + Float64(-1.0 + (b ^ 4.0))); else tmp = a ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -88.0) tmp = a ^ 4.0; elseif (a <= 4.5e+17) tmp = ((b * b) * 4.0) + (-1.0 + (b ^ 4.0)); else tmp = a ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -88.0], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 4.5e+17], N[(N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision] + N[(-1.0 + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -88:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 4.5 \cdot 10^{+17}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 4 + \left(-1 + {b}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if a < -88 or 4.5e17 < a Initial program 48.6%
associate--l+48.6%
fma-def48.6%
Simplified51.9%
Taylor expanded in a around inf 90.1%
if -88 < a < 4.5e17Initial program 97.7%
associate--l+97.7%
fma-def97.7%
Simplified97.7%
fma-def97.7%
add-cbrt-cube88.5%
pow388.5%
pow-pow88.5%
add-sqr-sqrt88.5%
hypot-udef88.5%
hypot-udef88.5%
pow288.5%
metadata-eval88.5%
Applied egg-rr88.5%
Taylor expanded in a around 0 85.7%
associate--l+85.7%
+-commutative85.7%
associate--l+85.7%
associate-+r+85.7%
+-commutative85.7%
associate-*r*85.7%
distribute-rgt-out96.3%
unpow296.3%
*-commutative96.3%
sub-neg96.3%
metadata-eval96.3%
Simplified96.3%
Taylor expanded in a around 0 98.5%
Final simplification94.5%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e+26) (+ (* (* a a) (* a a)) (+ -1.0 (* (* a a) 4.0))) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+26) {
tmp = ((a * a) * (a * a)) + (-1.0 + ((a * a) * 4.0));
} else {
tmp = pow(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 ((b * b) <= 2d+26) then
tmp = ((a * a) * (a * a)) + ((-1.0d0) + ((a * a) * 4.0d0))
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+26) {
tmp = ((a * a) * (a * a)) + (-1.0 + ((a * a) * 4.0));
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e+26: tmp = ((a * a) * (a * a)) + (-1.0 + ((a * a) * 4.0)) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e+26) tmp = Float64(Float64(Float64(a * a) * Float64(a * a)) + Float64(-1.0 + Float64(Float64(a * a) * 4.0))); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e+26) tmp = ((a * a) * (a * a)) + (-1.0 + ((a * a) * 4.0)); else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+26], N[(N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] + N[(-1.0 + N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+26}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right) + \left(-1 + \left(a \cdot a\right) \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if (*.f64 b b) < 2.0000000000000001e26Initial program 85.6%
associate--l+85.6%
fma-def85.6%
Simplified85.6%
Taylor expanded in b around 0 83.1%
associate--l+83.1%
associate-*r*83.1%
unpow283.1%
Simplified83.1%
metadata-eval49.2%
pow-prod-up49.1%
pow-prod-down49.1%
pow249.1%
Applied egg-rr83.0%
Taylor expanded in a around 0 95.0%
unpow295.0%
Simplified95.0%
if 2.0000000000000001e26 < (*.f64 b b) Initial program 60.2%
associate--l+60.2%
fma-def60.2%
Simplified63.7%
Taylor expanded in b around inf 89.5%
Final simplification92.5%
(FPCore (a b) :precision binary64 (if (<= (* b b) 3.3e+307) (+ (* (* a a) (* a a)) (+ -1.0 (* (* a a) 4.0))) (+ -1.0 (* (* b b) 4.0))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 3.3e+307) {
tmp = ((a * a) * (a * a)) + (-1.0 + ((a * a) * 4.0));
} else {
tmp = -1.0 + ((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 ((b * b) <= 3.3d+307) then
tmp = ((a * a) * (a * a)) + ((-1.0d0) + ((a * a) * 4.0d0))
else
tmp = (-1.0d0) + ((b * b) * 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 3.3e+307) {
tmp = ((a * a) * (a * a)) + (-1.0 + ((a * a) * 4.0));
} else {
tmp = -1.0 + ((b * b) * 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 3.3e+307: tmp = ((a * a) * (a * a)) + (-1.0 + ((a * a) * 4.0)) else: tmp = -1.0 + ((b * b) * 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 3.3e+307) tmp = Float64(Float64(Float64(a * a) * Float64(a * a)) + Float64(-1.0 + Float64(Float64(a * a) * 4.0))); else tmp = Float64(-1.0 + Float64(Float64(b * b) * 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 3.3e+307) tmp = ((a * a) * (a * a)) + (-1.0 + ((a * a) * 4.0)); else tmp = -1.0 + ((b * b) * 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 3.3e+307], N[(N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] + N[(-1.0 + N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 3.3 \cdot 10^{+307}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right) + \left(-1 + \left(a \cdot a\right) \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot 4\\
\end{array}
\end{array}
if (*.f64 b b) < 3.2999999999999999e307Initial program 81.6%
associate--l+81.6%
fma-def81.6%
Simplified81.6%
Taylor expanded in b around 0 67.3%
associate--l+67.3%
associate-*r*67.3%
unpow267.3%
Simplified67.3%
metadata-eval47.0%
pow-prod-up46.9%
pow-prod-down46.9%
pow246.9%
Applied egg-rr67.2%
Taylor expanded in a around 0 79.4%
unpow279.4%
Simplified79.4%
if 3.2999999999999999e307 < (*.f64 b b) Initial program 49.2%
associate--l+49.2%
fma-def49.2%
Simplified55.9%
Taylor expanded in a around inf 33.9%
fma-def33.9%
*-commutative33.9%
unpow233.9%
unpow233.9%
Simplified33.9%
Taylor expanded in a around 0 40.7%
sub-neg40.7%
metadata-eval40.7%
+-commutative40.7%
+-commutative40.7%
associate-*r*40.7%
distribute-rgt-out64.4%
unpow264.4%
*-commutative64.4%
Simplified64.4%
Taylor expanded in a around 0 100.0%
Final simplification84.1%
(FPCore (a b) :precision binary64 (if (or (<= a -4.7e-14) (not (<= a 3.3e-15))) (* (* a a) (* a a)) -1.0))
double code(double a, double b) {
double tmp;
if ((a <= -4.7e-14) || !(a <= 3.3e-15)) {
tmp = (a * a) * (a * a);
} else {
tmp = -1.0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-4.7d-14)) .or. (.not. (a <= 3.3d-15))) then
tmp = (a * a) * (a * a)
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -4.7e-14) || !(a <= 3.3e-15)) {
tmp = (a * a) * (a * a);
} else {
tmp = -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -4.7e-14) or not (a <= 3.3e-15): tmp = (a * a) * (a * a) else: tmp = -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -4.7e-14) || !(a <= 3.3e-15)) tmp = Float64(Float64(a * a) * Float64(a * a)); else tmp = -1.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -4.7e-14) || ~((a <= 3.3e-15))) tmp = (a * a) * (a * a); else tmp = -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -4.7e-14], N[Not[LessEqual[a, 3.3e-15]], $MachinePrecision]], N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision], -1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.7 \cdot 10^{-14} \lor \neg \left(a \leq 3.3 \cdot 10^{-15}\right):\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if a < -4.7000000000000002e-14 or 3.3e-15 < a Initial program 49.9%
associate--l+49.9%
fma-def49.9%
Simplified52.9%
Taylor expanded in a around inf 84.5%
metadata-eval84.5%
pow-prod-up84.4%
pow-prod-down84.4%
pow284.4%
Applied egg-rr84.4%
if -4.7000000000000002e-14 < a < 3.3e-15Initial program 99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in b around 0 53.8%
associate--l+53.8%
associate-*r*53.8%
unpow253.8%
Simplified53.8%
Taylor expanded in a around 0 53.8%
Final simplification69.6%
(FPCore (a b) :precision binary64 (if (or (<= a -88.0) (not (<= a 3.4e+17))) (* (* a a) (* a a)) (+ -1.0 (* (* b b) 4.0))))
double code(double a, double b) {
double tmp;
if ((a <= -88.0) || !(a <= 3.4e+17)) {
tmp = (a * a) * (a * a);
} else {
tmp = -1.0 + ((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 <= (-88.0d0)) .or. (.not. (a <= 3.4d+17))) then
tmp = (a * a) * (a * a)
else
tmp = (-1.0d0) + ((b * b) * 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -88.0) || !(a <= 3.4e+17)) {
tmp = (a * a) * (a * a);
} else {
tmp = -1.0 + ((b * b) * 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -88.0) or not (a <= 3.4e+17): tmp = (a * a) * (a * a) else: tmp = -1.0 + ((b * b) * 4.0) return tmp
function code(a, b) tmp = 0.0 if ((a <= -88.0) || !(a <= 3.4e+17)) tmp = Float64(Float64(a * a) * Float64(a * a)); else tmp = Float64(-1.0 + Float64(Float64(b * b) * 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -88.0) || ~((a <= 3.4e+17))) tmp = (a * a) * (a * a); else tmp = -1.0 + ((b * b) * 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -88.0], N[Not[LessEqual[a, 3.4e+17]], $MachinePrecision]], N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -88 \lor \neg \left(a \leq 3.4 \cdot 10^{+17}\right):\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot 4\\
\end{array}
\end{array}
if a < -88 or 3.4e17 < a Initial program 48.6%
associate--l+48.6%
fma-def48.6%
Simplified51.9%
Taylor expanded in a around inf 90.1%
metadata-eval90.1%
pow-prod-up90.0%
pow-prod-down90.0%
pow290.0%
Applied egg-rr90.0%
if -88 < a < 3.4e17Initial program 97.7%
associate--l+97.7%
fma-def97.7%
Simplified97.7%
Taylor expanded in a around inf 63.8%
fma-def63.8%
*-commutative63.8%
unpow263.8%
unpow263.8%
Simplified63.8%
Taylor expanded in a around 0 61.4%
sub-neg61.4%
metadata-eval61.4%
+-commutative61.4%
+-commutative61.4%
associate-*r*61.4%
distribute-rgt-out72.0%
unpow272.0%
*-commutative72.0%
Simplified72.0%
Taylor expanded in a around 0 74.3%
Final simplification81.8%
(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 74.1%
associate--l+74.1%
fma-def74.1%
Simplified75.7%
Taylor expanded in b around 0 56.8%
associate--l+56.8%
associate-*r*56.8%
unpow256.8%
Simplified56.8%
Taylor expanded in a around 0 26.4%
Final simplification26.4%
herbie shell --seed 2023234
(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))