
(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 (hypot a b) 4.0)))
(if (<= a -5e+102)
(pow a 4.0)
(if (<= a 38000.0)
(+ (fma 4.0 (fma a (fma a a a) (* b (* b (fma a -3.0 1.0)))) t_0) -1.0)
(+ t_0 (+ -1.0 (* 4.0 (pow a 3.0))))))))
double code(double a, double b) {
double t_0 = pow(hypot(a, b), 4.0);
double tmp;
if (a <= -5e+102) {
tmp = pow(a, 4.0);
} else if (a <= 38000.0) {
tmp = fma(4.0, fma(a, fma(a, a, a), (b * (b * fma(a, -3.0, 1.0)))), t_0) + -1.0;
} else {
tmp = t_0 + (-1.0 + (4.0 * pow(a, 3.0)));
}
return tmp;
}
function code(a, b) t_0 = hypot(a, b) ^ 4.0 tmp = 0.0 if (a <= -5e+102) tmp = a ^ 4.0; elseif (a <= 38000.0) tmp = Float64(fma(4.0, fma(a, fma(a, a, a), Float64(b * Float64(b * fma(a, -3.0, 1.0)))), t_0) + -1.0); else tmp = Float64(t_0 + Float64(-1.0 + Float64(4.0 * (a ^ 3.0)))); end return tmp end
code[a_, b_] := Block[{t$95$0 = N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision]}, If[LessEqual[a, -5e+102], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 38000.0], 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] + t$95$0), $MachinePrecision] + -1.0), $MachinePrecision], N[(t$95$0 + N[(-1.0 + N[(4.0 * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4}\\
\mathbf{if}\;a \leq -5 \cdot 10^{+102}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 38000:\\
\;\;\;\;\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), t_0\right) + -1\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-1 + 4 \cdot {a}^{3}\right)\\
\end{array}
\end{array}
if a < -5e102Initial program 0.0%
associate--l+0.0%
fma-def0.0%
Simplified10.6%
Taylor expanded in a around inf 100.0%
if -5e102 < a < 38000Initial program 99.9%
sub-neg99.9%
Simplified100.0%
if 38000 < a Initial program 69.9%
associate--l+69.9%
fma-def69.9%
Simplified69.9%
fma-def69.9%
add-sqr-sqrt69.9%
hypot-udef69.9%
hypot-udef69.9%
pow-prod-down69.9%
pow-prod-up70.0%
metadata-eval70.0%
expm1-log1p-u68.7%
expm1-udef68.7%
Applied egg-rr68.7%
expm1-def68.7%
expm1-log1p70.0%
Simplified70.0%
Taylor expanded in a around inf 100.0%
Final simplification100.0%
(FPCore (a b)
:precision binary64
(let* ((t_0 (pow (hypot a b) 4.0)))
(if (<= a -5e+102)
(pow a 4.0)
(if (<= a 63.0)
(+
t_0
(+
-1.0
(* 4.0 (fma (* a a) (+ a 1.0) (* (* b b) (+ 1.0 (* a -3.0)))))))
(+ t_0 (+ -1.0 (* 4.0 (pow a 3.0))))))))
double code(double a, double b) {
double t_0 = pow(hypot(a, b), 4.0);
double tmp;
if (a <= -5e+102) {
tmp = pow(a, 4.0);
} else if (a <= 63.0) {
tmp = t_0 + (-1.0 + (4.0 * fma((a * a), (a + 1.0), ((b * b) * (1.0 + (a * -3.0))))));
} else {
tmp = t_0 + (-1.0 + (4.0 * pow(a, 3.0)));
}
return tmp;
}
function code(a, b) t_0 = hypot(a, b) ^ 4.0 tmp = 0.0 if (a <= -5e+102) tmp = a ^ 4.0; elseif (a <= 63.0) tmp = Float64(t_0 + Float64(-1.0 + Float64(4.0 * fma(Float64(a * a), Float64(a + 1.0), Float64(Float64(b * b) * Float64(1.0 + Float64(a * -3.0))))))); else tmp = Float64(t_0 + Float64(-1.0 + Float64(4.0 * (a ^ 3.0)))); end return tmp end
code[a_, b_] := Block[{t$95$0 = N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision]}, If[LessEqual[a, -5e+102], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 63.0], N[(t$95$0 + N[(-1.0 + N[(4.0 * N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 + N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.0 + N[(4.0 * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4}\\
\mathbf{if}\;a \leq -5 \cdot 10^{+102}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 63:\\
\;\;\;\;t_0 + \left(-1 + 4 \cdot \mathsf{fma}\left(a \cdot a, a + 1, \left(b \cdot b\right) \cdot \left(1 + a \cdot -3\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-1 + 4 \cdot {a}^{3}\right)\\
\end{array}
\end{array}
if a < -5e102Initial program 0.0%
associate--l+0.0%
fma-def0.0%
Simplified10.6%
Taylor expanded in a around inf 100.0%
if -5e102 < a < 63Initial program 99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
fma-def99.9%
add-sqr-sqrt99.9%
hypot-udef99.9%
hypot-udef99.9%
pow-prod-down99.9%
pow-prod-up100.0%
metadata-eval100.0%
expm1-log1p-u98.8%
expm1-udef98.8%
Applied egg-rr98.8%
expm1-def98.8%
expm1-log1p100.0%
Simplified100.0%
if 63 < a Initial program 69.9%
associate--l+69.9%
fma-def69.9%
Simplified69.9%
fma-def69.9%
add-sqr-sqrt69.9%
hypot-udef69.9%
hypot-udef69.9%
pow-prod-down69.9%
pow-prod-up70.0%
metadata-eval70.0%
expm1-log1p-u68.7%
expm1-udef68.7%
Applied egg-rr68.7%
expm1-def68.7%
expm1-log1p70.0%
Simplified70.0%
Taylor expanded in a around inf 100.0%
Final simplification100.0%
(FPCore (a b)
:precision binary64
(if (<= a -4.6e+63)
(pow a 4.0)
(if (<= a 13500.0)
(+
-1.0
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0)))))))
(+ (pow (hypot a b) 4.0) (+ -1.0 (* 4.0 (pow a 3.0)))))))
double code(double a, double b) {
double tmp;
if (a <= -4.6e+63) {
tmp = pow(a, 4.0);
} else if (a <= 13500.0) {
tmp = -1.0 + (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0))))));
} else {
tmp = pow(hypot(a, b), 4.0) + (-1.0 + (4.0 * pow(a, 3.0)));
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -4.6e+63) {
tmp = Math.pow(a, 4.0);
} else if (a <= 13500.0) {
tmp = -1.0 + (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0))))));
} else {
tmp = Math.pow(Math.hypot(a, b), 4.0) + (-1.0 + (4.0 * Math.pow(a, 3.0)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -4.6e+63: tmp = math.pow(a, 4.0) elif a <= 13500.0: tmp = -1.0 + (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))))) else: tmp = math.pow(math.hypot(a, b), 4.0) + (-1.0 + (4.0 * math.pow(a, 3.0))) return tmp
function code(a, b) tmp = 0.0 if (a <= -4.6e+63) tmp = a ^ 4.0; elseif (a <= 13500.0) tmp = Float64(-1.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))))))); else tmp = Float64((hypot(a, b) ^ 4.0) + Float64(-1.0 + Float64(4.0 * (a ^ 3.0)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -4.6e+63) tmp = a ^ 4.0; elseif (a <= 13500.0) tmp = -1.0 + ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))))); else tmp = (hypot(a, b) ^ 4.0) + (-1.0 + (4.0 * (a ^ 3.0))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -4.6e+63], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 13500.0], N[(-1.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]), $MachinePrecision], N[(N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision] + N[(-1.0 + N[(4.0 * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.6 \cdot 10^{+63}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 13500:\\
\;\;\;\;-1 + \left({\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)\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left(-1 + 4 \cdot {a}^{3}\right)\\
\end{array}
\end{array}
if a < -4.59999999999999986e63Initial program 17.5%
associate--l+17.5%
fma-def17.5%
Simplified26.3%
Taylor expanded in a around inf 100.0%
if -4.59999999999999986e63 < a < 13500Initial program 99.9%
if 13500 < a Initial program 69.9%
associate--l+69.9%
fma-def69.9%
Simplified69.9%
fma-def69.9%
add-sqr-sqrt69.9%
hypot-udef69.9%
hypot-udef69.9%
pow-prod-down69.9%
pow-prod-up70.0%
metadata-eval70.0%
expm1-log1p-u68.7%
expm1-udef68.7%
Applied egg-rr68.7%
expm1-def68.7%
expm1-log1p70.0%
Simplified70.0%
Taylor expanded in a around inf 100.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) (+ -1.0 t_0) (pow a 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 = -1.0 + t_0;
} else {
tmp = pow(a, 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 = -1.0 + t_0;
} else {
tmp = Math.pow(a, 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 = -1.0 + t_0 else: tmp = math.pow(a, 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(-1.0 + t_0); else tmp = a ^ 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 = -1.0 + t_0; else tmp = a ^ 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[(-1.0 + t$95$0), $MachinePrecision], N[Power[a, 4.0], $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:\\
\;\;\;\;-1 + t_0\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\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.9%
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%
Simplified7.4%
Taylor expanded in a around inf 93.0%
Final simplification98.0%
(FPCore (a b)
:precision binary64
(if (<= a -7.5e+55)
(pow a 4.0)
(if (<= a 26000000000.0)
(+ (* 4.0 (* b b)) (+ -1.0 (pow b 4.0)))
(+ (pow a 4.0) (+ -1.0 (* (+ a 1.0) (* 4.0 (* a a))))))))
double code(double a, double b) {
double tmp;
if (a <= -7.5e+55) {
tmp = pow(a, 4.0);
} else if (a <= 26000000000.0) {
tmp = (4.0 * (b * b)) + (-1.0 + pow(b, 4.0));
} else {
tmp = pow(a, 4.0) + (-1.0 + ((a + 1.0) * (4.0 * (a * a))));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-7.5d+55)) then
tmp = a ** 4.0d0
else if (a <= 26000000000.0d0) then
tmp = (4.0d0 * (b * b)) + ((-1.0d0) + (b ** 4.0d0))
else
tmp = (a ** 4.0d0) + ((-1.0d0) + ((a + 1.0d0) * (4.0d0 * (a * a))))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -7.5e+55) {
tmp = Math.pow(a, 4.0);
} else if (a <= 26000000000.0) {
tmp = (4.0 * (b * b)) + (-1.0 + Math.pow(b, 4.0));
} else {
tmp = Math.pow(a, 4.0) + (-1.0 + ((a + 1.0) * (4.0 * (a * a))));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -7.5e+55: tmp = math.pow(a, 4.0) elif a <= 26000000000.0: tmp = (4.0 * (b * b)) + (-1.0 + math.pow(b, 4.0)) else: tmp = math.pow(a, 4.0) + (-1.0 + ((a + 1.0) * (4.0 * (a * a)))) return tmp
function code(a, b) tmp = 0.0 if (a <= -7.5e+55) tmp = a ^ 4.0; elseif (a <= 26000000000.0) tmp = Float64(Float64(4.0 * Float64(b * b)) + Float64(-1.0 + (b ^ 4.0))); else tmp = Float64((a ^ 4.0) + Float64(-1.0 + Float64(Float64(a + 1.0) * Float64(4.0 * Float64(a * a))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -7.5e+55) tmp = a ^ 4.0; elseif (a <= 26000000000.0) tmp = (4.0 * (b * b)) + (-1.0 + (b ^ 4.0)); else tmp = (a ^ 4.0) + (-1.0 + ((a + 1.0) * (4.0 * (a * a)))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -7.5e+55], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 26000000000.0], N[(N[(4.0 * N[(b * b), $MachinePrecision]), $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[(4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.5 \cdot 10^{+55}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 26000000000:\\
\;\;\;\;4 \cdot \left(b \cdot b\right) + \left(-1 + {b}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{4} + \left(-1 + \left(a + 1\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)\\
\end{array}
\end{array}
if a < -7.50000000000000014e55Initial program 18.9%
associate--l+18.9%
fma-def18.9%
Simplified27.6%
Taylor expanded in a around inf 100.0%
if -7.50000000000000014e55 < a < 2.6e10Initial program 98.3%
associate--l+98.3%
fma-def98.3%
Simplified98.3%
Taylor expanded in a around 0 95.2%
associate--l+95.2%
fma-def95.2%
unpow295.2%
sub-neg95.2%
metadata-eval95.2%
Simplified95.2%
fma-udef95.2%
Applied egg-rr95.2%
if 2.6e10 < a Initial program 71.9%
associate--l+71.9%
fma-def71.9%
Simplified71.9%
Taylor expanded in b around 0 95.7%
associate--l+95.7%
associate-*r*95.7%
unpow295.7%
Simplified95.7%
Final simplification96.4%
(FPCore (a b)
:precision binary64
(if (<= a -4e+53)
(pow a 4.0)
(if (<= a 33000000000.0)
(+ (* 4.0 (* b b)) (+ -1.0 (pow b 4.0)))
(pow a 4.0))))
double code(double a, double b) {
double tmp;
if (a <= -4e+53) {
tmp = pow(a, 4.0);
} else if (a <= 33000000000.0) {
tmp = (4.0 * (b * b)) + (-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 <= (-4d+53)) then
tmp = a ** 4.0d0
else if (a <= 33000000000.0d0) then
tmp = (4.0d0 * (b * b)) + ((-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 <= -4e+53) {
tmp = Math.pow(a, 4.0);
} else if (a <= 33000000000.0) {
tmp = (4.0 * (b * b)) + (-1.0 + Math.pow(b, 4.0));
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -4e+53: tmp = math.pow(a, 4.0) elif a <= 33000000000.0: tmp = (4.0 * (b * b)) + (-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 <= -4e+53) tmp = a ^ 4.0; elseif (a <= 33000000000.0) tmp = Float64(Float64(4.0 * Float64(b * b)) + 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 <= -4e+53) tmp = a ^ 4.0; elseif (a <= 33000000000.0) tmp = (4.0 * (b * b)) + (-1.0 + (b ^ 4.0)); else tmp = a ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -4e+53], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 33000000000.0], N[(N[(4.0 * N[(b * b), $MachinePrecision]), $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 -4 \cdot 10^{+53}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 33000000000:\\
\;\;\;\;4 \cdot \left(b \cdot b\right) + \left(-1 + {b}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if a < -4e53 or 3.3e10 < a Initial program 47.5%
associate--l+47.5%
fma-def47.5%
Simplified51.5%
Taylor expanded in a around inf 97.5%
if -4e53 < a < 3.3e10Initial program 98.3%
associate--l+98.3%
fma-def98.3%
Simplified98.3%
Taylor expanded in a around 0 95.2%
associate--l+95.2%
fma-def95.2%
unpow295.2%
sub-neg95.2%
metadata-eval95.2%
Simplified95.2%
fma-udef95.2%
Applied egg-rr95.2%
Final simplification96.3%
(FPCore (a b)
:precision binary64
(let* ((t_0 (+ -1.0 (* a (* a 4.0)))))
(if (<= b 7.2e-293)
t_0
(if (<= b 5.4e-232)
(pow a 4.0)
(if (<= b 5.2e-6) t_0 (if (<= b 8.5e+66) (pow a 4.0) (pow b 4.0)))))))
double code(double a, double b) {
double t_0 = -1.0 + (a * (a * 4.0));
double tmp;
if (b <= 7.2e-293) {
tmp = t_0;
} else if (b <= 5.4e-232) {
tmp = pow(a, 4.0);
} else if (b <= 5.2e-6) {
tmp = t_0;
} else if (b <= 8.5e+66) {
tmp = pow(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) :: t_0
real(8) :: tmp
t_0 = (-1.0d0) + (a * (a * 4.0d0))
if (b <= 7.2d-293) then
tmp = t_0
else if (b <= 5.4d-232) then
tmp = a ** 4.0d0
else if (b <= 5.2d-6) then
tmp = t_0
else if (b <= 8.5d+66) then
tmp = a ** 4.0d0
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = -1.0 + (a * (a * 4.0));
double tmp;
if (b <= 7.2e-293) {
tmp = t_0;
} else if (b <= 5.4e-232) {
tmp = Math.pow(a, 4.0);
} else if (b <= 5.2e-6) {
tmp = t_0;
} else if (b <= 8.5e+66) {
tmp = Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): t_0 = -1.0 + (a * (a * 4.0)) tmp = 0 if b <= 7.2e-293: tmp = t_0 elif b <= 5.4e-232: tmp = math.pow(a, 4.0) elif b <= 5.2e-6: tmp = t_0 elif b <= 8.5e+66: tmp = math.pow(a, 4.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) t_0 = Float64(-1.0 + Float64(a * Float64(a * 4.0))) tmp = 0.0 if (b <= 7.2e-293) tmp = t_0; elseif (b <= 5.4e-232) tmp = a ^ 4.0; elseif (b <= 5.2e-6) tmp = t_0; elseif (b <= 8.5e+66) tmp = a ^ 4.0; else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) t_0 = -1.0 + (a * (a * 4.0)); tmp = 0.0; if (b <= 7.2e-293) tmp = t_0; elseif (b <= 5.4e-232) tmp = a ^ 4.0; elseif (b <= 5.2e-6) tmp = t_0; elseif (b <= 8.5e+66) tmp = a ^ 4.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(-1.0 + N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 7.2e-293], t$95$0, If[LessEqual[b, 5.4e-232], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[b, 5.2e-6], t$95$0, If[LessEqual[b, 8.5e+66], N[Power[a, 4.0], $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 + a \cdot \left(a \cdot 4\right)\\
\mathbf{if}\;b \leq 7.2 \cdot 10^{-293}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;b \leq 5.4 \cdot 10^{-232}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;b \leq 5.2 \cdot 10^{-6}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;b \leq 8.5 \cdot 10^{+66}:\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 7.1999999999999997e-293 or 5.3999999999999999e-232 < b < 5.20000000000000019e-6Initial program 75.8%
associate--l+75.8%
fma-def75.8%
Simplified76.3%
Taylor expanded in b around 0 61.4%
associate--l+61.3%
associate-*r*61.3%
unpow261.3%
Simplified61.3%
Taylor expanded in a around 0 57.9%
fma-neg57.9%
unpow257.9%
metadata-eval57.9%
Simplified57.9%
fma-udef57.9%
associate-*r*57.9%
Applied egg-rr57.9%
if 7.1999999999999997e-293 < b < 5.3999999999999999e-232 or 5.20000000000000019e-6 < b < 8.5000000000000004e66Initial program 65.3%
associate--l+65.3%
fma-def65.3%
Simplified65.3%
Taylor expanded in a around inf 81.0%
if 8.5000000000000004e66 < b Initial program 69.5%
associate--l+69.5%
fma-def69.5%
Simplified78.2%
Taylor expanded in b around inf 100.0%
Final simplification68.4%
(FPCore (a b) :precision binary64 (if (<= a -1.32e+48) (pow a 4.0) (if (<= a 8200000000.0) (+ -1.0 (pow b 4.0)) (pow a 4.0))))
double code(double a, double b) {
double tmp;
if (a <= -1.32e+48) {
tmp = pow(a, 4.0);
} else if (a <= 8200000000.0) {
tmp = -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 <= (-1.32d+48)) then
tmp = a ** 4.0d0
else if (a <= 8200000000.0d0) then
tmp = (-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 <= -1.32e+48) {
tmp = Math.pow(a, 4.0);
} else if (a <= 8200000000.0) {
tmp = -1.0 + Math.pow(b, 4.0);
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -1.32e+48: tmp = math.pow(a, 4.0) elif a <= 8200000000.0: tmp = -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 <= -1.32e+48) tmp = a ^ 4.0; elseif (a <= 8200000000.0) tmp = 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 <= -1.32e+48) tmp = a ^ 4.0; elseif (a <= 8200000000.0) tmp = -1.0 + (b ^ 4.0); else tmp = a ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -1.32e+48], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 8200000000.0], N[(-1.0 + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.32 \cdot 10^{+48}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 8200000000:\\
\;\;\;\;-1 + {b}^{4}\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if a < -1.32e48 or 8.2e9 < a Initial program 47.5%
associate--l+47.5%
fma-def47.5%
Simplified51.5%
Taylor expanded in a around inf 97.5%
if -1.32e48 < a < 8.2e9Initial program 98.3%
associate--l+98.3%
fma-def98.3%
Simplified98.3%
fma-def98.3%
add-sqr-sqrt98.3%
hypot-udef98.3%
hypot-udef98.3%
pow-prod-down98.3%
pow-prod-up98.4%
metadata-eval98.4%
expm1-log1p-u97.5%
expm1-udef97.4%
Applied egg-rr97.4%
expm1-def97.5%
expm1-log1p98.4%
Simplified98.4%
Taylor expanded in a around inf 95.5%
Taylor expanded in a around 0 93.3%
Final simplification95.3%
(FPCore (a b) :precision binary64 (if (or (<= a -0.4) (not (<= a 4.8))) (pow a 4.0) (+ -1.0 (* 4.0 (* a (+ a (* a a)))))))
double code(double a, double b) {
double tmp;
if ((a <= -0.4) || !(a <= 4.8)) {
tmp = pow(a, 4.0);
} else {
tmp = -1.0 + (4.0 * (a * (a + (a * a))));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-0.4d0)) .or. (.not. (a <= 4.8d0))) then
tmp = a ** 4.0d0
else
tmp = (-1.0d0) + (4.0d0 * (a * (a + (a * a))))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -0.4) || !(a <= 4.8)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = -1.0 + (4.0 * (a * (a + (a * a))));
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -0.4) or not (a <= 4.8): tmp = math.pow(a, 4.0) else: tmp = -1.0 + (4.0 * (a * (a + (a * a)))) return tmp
function code(a, b) tmp = 0.0 if ((a <= -0.4) || !(a <= 4.8)) tmp = a ^ 4.0; else tmp = Float64(-1.0 + Float64(4.0 * Float64(a * Float64(a + Float64(a * a))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -0.4) || ~((a <= 4.8))) tmp = a ^ 4.0; else tmp = -1.0 + (4.0 * (a * (a + (a * a)))); end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -0.4], N[Not[LessEqual[a, 4.8]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(-1.0 + N[(4.0 * N[(a * N[(a + N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.4 \lor \neg \left(a \leq 4.8\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1 + 4 \cdot \left(a \cdot \left(a + a \cdot a\right)\right)\\
\end{array}
\end{array}
if a < -0.40000000000000002 or 4.79999999999999982 < a Initial program 51.3%
associate--l+51.3%
fma-def51.3%
Simplified54.9%
Taylor expanded in a around inf 89.6%
if -0.40000000000000002 < a < 4.79999999999999982Initial program 99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in b around 0 46.8%
associate--l+46.8%
associate-*r*46.8%
unpow246.8%
Simplified46.8%
Taylor expanded in a around 0 45.7%
sub-neg45.7%
distribute-lft-out45.7%
unpow245.7%
metadata-eval45.7%
Simplified45.7%
+-commutative45.7%
cube-mult45.7%
distribute-lft-out45.7%
Applied egg-rr45.7%
Final simplification69.7%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (* a 4.0))))
(if (<= a -6.8e+153)
(* 4.0 (* a a))
(if (<= a 2e+101)
(/ (+ -1.0 (* t_0 t_0)) (- t_0 -1.0))
(+ -1.0 (* 4.0 (* a (+ a (* a a)))))))))
double code(double a, double b) {
double t_0 = a * (a * 4.0);
double tmp;
if (a <= -6.8e+153) {
tmp = 4.0 * (a * a);
} else if (a <= 2e+101) {
tmp = (-1.0 + (t_0 * t_0)) / (t_0 - -1.0);
} else {
tmp = -1.0 + (4.0 * (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 = a * (a * 4.0d0)
if (a <= (-6.8d+153)) then
tmp = 4.0d0 * (a * a)
else if (a <= 2d+101) then
tmp = ((-1.0d0) + (t_0 * t_0)) / (t_0 - (-1.0d0))
else
tmp = (-1.0d0) + (4.0d0 * (a * (a + (a * a))))
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = a * (a * 4.0);
double tmp;
if (a <= -6.8e+153) {
tmp = 4.0 * (a * a);
} else if (a <= 2e+101) {
tmp = (-1.0 + (t_0 * t_0)) / (t_0 - -1.0);
} else {
tmp = -1.0 + (4.0 * (a * (a + (a * a))));
}
return tmp;
}
def code(a, b): t_0 = a * (a * 4.0) tmp = 0 if a <= -6.8e+153: tmp = 4.0 * (a * a) elif a <= 2e+101: tmp = (-1.0 + (t_0 * t_0)) / (t_0 - -1.0) else: tmp = -1.0 + (4.0 * (a * (a + (a * a)))) return tmp
function code(a, b) t_0 = Float64(a * Float64(a * 4.0)) tmp = 0.0 if (a <= -6.8e+153) tmp = Float64(4.0 * Float64(a * a)); elseif (a <= 2e+101) tmp = Float64(Float64(-1.0 + Float64(t_0 * t_0)) / Float64(t_0 - -1.0)); else tmp = Float64(-1.0 + Float64(4.0 * Float64(a * Float64(a + Float64(a * a))))); end return tmp end
function tmp_2 = code(a, b) t_0 = a * (a * 4.0); tmp = 0.0; if (a <= -6.8e+153) tmp = 4.0 * (a * a); elseif (a <= 2e+101) tmp = (-1.0 + (t_0 * t_0)) / (t_0 - -1.0); else tmp = -1.0 + (4.0 * (a * (a + (a * a)))); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -6.8e+153], N[(4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2e+101], N[(N[(-1.0 + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - -1.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(4.0 * N[(a * N[(a + N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot 4\right)\\
\mathbf{if}\;a \leq -6.8 \cdot 10^{+153}:\\
\;\;\;\;4 \cdot \left(a \cdot a\right)\\
\mathbf{elif}\;a \leq 2 \cdot 10^{+101}:\\
\;\;\;\;\frac{-1 + t_0 \cdot t_0}{t_0 - -1}\\
\mathbf{else}:\\
\;\;\;\;-1 + 4 \cdot \left(a \cdot \left(a + a \cdot a\right)\right)\\
\end{array}
\end{array}
if a < -6.7999999999999995e153Initial program 0.0%
associate--l+0.0%
fma-def0.0%
Simplified0.0%
Taylor expanded in b around 0 0.0%
associate--l+0.0%
associate-*r*0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in a around 0 100.0%
fma-neg100.0%
unpow2100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around inf 100.0%
unpow2100.0%
Simplified100.0%
if -6.7999999999999995e153 < a < 2e101Initial program 86.7%
associate--l+86.7%
fma-def86.7%
Simplified89.6%
Taylor expanded in b around 0 47.8%
associate--l+47.8%
associate-*r*47.8%
unpow247.8%
Simplified47.8%
Taylor expanded in a around 0 32.0%
fma-neg32.0%
unpow232.0%
metadata-eval32.0%
Simplified32.0%
fma-udef32.0%
flip-+48.1%
associate-*r*48.1%
associate-*r*48.1%
metadata-eval48.1%
associate-*r*48.1%
Applied egg-rr48.1%
if 2e101 < a Initial program 72.0%
associate--l+72.0%
fma-def72.0%
Simplified72.0%
Taylor expanded in b around 0 100.0%
associate--l+100.0%
associate-*r*100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in a around 0 100.0%
sub-neg100.0%
distribute-lft-out100.0%
unpow2100.0%
metadata-eval100.0%
Simplified100.0%
+-commutative100.0%
cube-mult100.0%
distribute-lft-out100.0%
Applied egg-rr100.0%
Final simplification64.5%
(FPCore (a b) :precision binary64 (if (<= a -0.4) (* 4.0 (* a a)) (+ -1.0 (* 4.0 (* a (+ a (* a a)))))))
double code(double a, double b) {
double tmp;
if (a <= -0.4) {
tmp = 4.0 * (a * a);
} else {
tmp = -1.0 + (4.0 * (a * (a + (a * a))));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-0.4d0)) then
tmp = 4.0d0 * (a * a)
else
tmp = (-1.0d0) + (4.0d0 * (a * (a + (a * a))))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -0.4) {
tmp = 4.0 * (a * a);
} else {
tmp = -1.0 + (4.0 * (a * (a + (a * a))));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -0.4: tmp = 4.0 * (a * a) else: tmp = -1.0 + (4.0 * (a * (a + (a * a)))) return tmp
function code(a, b) tmp = 0.0 if (a <= -0.4) tmp = Float64(4.0 * Float64(a * a)); else tmp = Float64(-1.0 + Float64(4.0 * Float64(a * Float64(a + Float64(a * a))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -0.4) tmp = 4.0 * (a * a); else tmp = -1.0 + (4.0 * (a * (a + (a * a)))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -0.4], N[(4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(4.0 * N[(a * N[(a + N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.4:\\
\;\;\;\;4 \cdot \left(a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + 4 \cdot \left(a \cdot \left(a + a \cdot a\right)\right)\\
\end{array}
\end{array}
if a < -0.40000000000000002Initial program 32.8%
associate--l+32.8%
fma-def32.8%
Simplified39.9%
Taylor expanded in b around 0 20.5%
associate--l+20.5%
associate-*r*20.5%
unpow220.5%
Simplified20.5%
Taylor expanded in a around 0 47.8%
fma-neg47.8%
unpow247.8%
metadata-eval47.8%
Simplified47.8%
Taylor expanded in a around inf 47.9%
unpow247.9%
Simplified47.9%
if -0.40000000000000002 < a Initial program 88.6%
associate--l+88.6%
fma-def88.6%
Simplified88.6%
Taylor expanded in b around 0 64.2%
associate--l+64.2%
associate-*r*64.2%
unpow264.2%
Simplified64.2%
Taylor expanded in a around 0 56.2%
sub-neg56.2%
distribute-lft-out56.2%
unpow256.2%
metadata-eval56.2%
Simplified56.2%
+-commutative56.2%
cube-mult56.2%
distribute-lft-out56.2%
Applied egg-rr56.2%
Final simplification53.9%
(FPCore (a b) :precision binary64 (if (or (<= a -0.4) (not (<= a 0.42))) (* 4.0 (* a a)) -1.0))
double code(double a, double b) {
double tmp;
if ((a <= -0.4) || !(a <= 0.42)) {
tmp = 4.0 * (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 <= (-0.4d0)) .or. (.not. (a <= 0.42d0))) then
tmp = 4.0d0 * (a * a)
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -0.4) || !(a <= 0.42)) {
tmp = 4.0 * (a * a);
} else {
tmp = -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -0.4) or not (a <= 0.42): tmp = 4.0 * (a * a) else: tmp = -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -0.4) || !(a <= 0.42)) tmp = Float64(4.0 * Float64(a * a)); else tmp = -1.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -0.4) || ~((a <= 0.42))) tmp = 4.0 * (a * a); else tmp = -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -0.4], N[Not[LessEqual[a, 0.42]], $MachinePrecision]], N[(4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision], -1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.4 \lor \neg \left(a \leq 0.42\right):\\
\;\;\;\;4 \cdot \left(a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if a < -0.40000000000000002 or 0.419999999999999984 < a Initial program 51.3%
associate--l+51.3%
fma-def51.3%
Simplified54.9%
Taylor expanded in b around 0 56.7%
associate--l+56.7%
associate-*r*56.7%
unpow256.7%
Simplified56.7%
Taylor expanded in a around 0 56.4%
fma-neg56.4%
unpow256.4%
metadata-eval56.4%
Simplified56.4%
Taylor expanded in a around inf 56.4%
unpow256.4%
Simplified56.4%
if -0.40000000000000002 < a < 0.419999999999999984Initial program 99.9%
associate--l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in b around 0 46.8%
associate--l+46.8%
associate-*r*46.8%
unpow246.8%
Simplified46.8%
Taylor expanded in a around 0 44.8%
Final simplification51.2%
(FPCore (a b) :precision binary64 (+ -1.0 (* a (* a 4.0))))
double code(double a, double b) {
return -1.0 + (a * (a * 4.0));
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (-1.0d0) + (a * (a * 4.0d0))
end function
public static double code(double a, double b) {
return -1.0 + (a * (a * 4.0));
}
def code(a, b): return -1.0 + (a * (a * 4.0))
function code(a, b) return Float64(-1.0 + Float64(a * Float64(a * 4.0))) end
function tmp = code(a, b) tmp = -1.0 + (a * (a * 4.0)); end
code[a_, b_] := N[(-1.0 + N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1 + a \cdot \left(a \cdot 4\right)
\end{array}
Initial program 73.3%
associate--l+73.3%
fma-def73.3%
Simplified75.3%
Taylor expanded in b around 0 52.2%
associate--l+52.2%
associate-*r*52.2%
unpow252.2%
Simplified52.2%
Taylor expanded in a around 0 51.4%
fma-neg51.4%
unpow251.4%
metadata-eval51.4%
Simplified51.4%
fma-udef51.4%
associate-*r*51.4%
Applied egg-rr51.4%
Final simplification51.4%
(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.3%
associate--l+73.3%
fma-def73.3%
Simplified75.3%
Taylor expanded in b around 0 52.2%
associate--l+52.2%
associate-*r*52.2%
unpow252.2%
Simplified52.2%
Taylor expanded in a around 0 20.7%
Final simplification20.7%
herbie shell --seed 2023230
(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))