
(FPCore (x y) :precision binary64 (+ (+ (* x 2.0) (* x x)) (* y y)))
double code(double x, double y) {
return ((x * 2.0) + (x * x)) + (y * y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * 2.0d0) + (x * x)) + (y * y)
end function
public static double code(double x, double y) {
return ((x * 2.0) + (x * x)) + (y * y);
}
def code(x, y): return ((x * 2.0) + (x * x)) + (y * y)
function code(x, y) return Float64(Float64(Float64(x * 2.0) + Float64(x * x)) + Float64(y * y)) end
function tmp = code(x, y) tmp = ((x * 2.0) + (x * x)) + (y * y); end
code[x_, y_] := N[(N[(N[(x * 2.0), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 + x \cdot x\right) + y \cdot y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ (+ (* x 2.0) (* x x)) (* y y)))
double code(double x, double y) {
return ((x * 2.0) + (x * x)) + (y * y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * 2.0d0) + (x * x)) + (y * y)
end function
public static double code(double x, double y) {
return ((x * 2.0) + (x * x)) + (y * y);
}
def code(x, y): return ((x * 2.0) + (x * x)) + (y * y)
function code(x, y) return Float64(Float64(Float64(x * 2.0) + Float64(x * x)) + Float64(y * y)) end
function tmp = code(x, y) tmp = ((x * 2.0) + (x * x)) + (y * y); end
code[x_, y_] := N[(N[(N[(x * 2.0), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 + x \cdot x\right) + y \cdot y
\end{array}
(FPCore (x y) :precision binary64 (+ (* y y) (+ (* x x) (* x 2.0))))
double code(double x, double y) {
return (y * y) + ((x * x) + (x * 2.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y * y) + ((x * x) + (x * 2.0d0))
end function
public static double code(double x, double y) {
return (y * y) + ((x * x) + (x * 2.0));
}
def code(x, y): return (y * y) + ((x * x) + (x * 2.0))
function code(x, y) return Float64(Float64(y * y) + Float64(Float64(x * x) + Float64(x * 2.0))) end
function tmp = code(x, y) tmp = (y * y) + ((x * x) + (x * 2.0)); end
code[x_, y_] := N[(N[(y * y), $MachinePrecision] + N[(N[(x * x), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot y + \left(x \cdot x + x \cdot 2\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (<= (* y y) 1.1e-54) (+ (* x x) (* x 2.0)) (if (or (<= (* y y) 3.9e-28) (not (<= (* y y) 2.6e+156))) (* y y) (* x x))))
double code(double x, double y) {
double tmp;
if ((y * y) <= 1.1e-54) {
tmp = (x * x) + (x * 2.0);
} else if (((y * y) <= 3.9e-28) || !((y * y) <= 2.6e+156)) {
tmp = y * y;
} else {
tmp = x * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y * y) <= 1.1d-54) then
tmp = (x * x) + (x * 2.0d0)
else if (((y * y) <= 3.9d-28) .or. (.not. ((y * y) <= 2.6d+156))) then
tmp = y * y
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y * y) <= 1.1e-54) {
tmp = (x * x) + (x * 2.0);
} else if (((y * y) <= 3.9e-28) || !((y * y) <= 2.6e+156)) {
tmp = y * y;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y * y) <= 1.1e-54: tmp = (x * x) + (x * 2.0) elif ((y * y) <= 3.9e-28) or not ((y * y) <= 2.6e+156): tmp = y * y else: tmp = x * x return tmp
function code(x, y) tmp = 0.0 if (Float64(y * y) <= 1.1e-54) tmp = Float64(Float64(x * x) + Float64(x * 2.0)); elseif ((Float64(y * y) <= 3.9e-28) || !(Float64(y * y) <= 2.6e+156)) tmp = Float64(y * y); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y * y) <= 1.1e-54) tmp = (x * x) + (x * 2.0); elseif (((y * y) <= 3.9e-28) || ~(((y * y) <= 2.6e+156))) tmp = y * y; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(y * y), $MachinePrecision], 1.1e-54], N[(N[(x * x), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(y * y), $MachinePrecision], 3.9e-28], N[Not[LessEqual[N[(y * y), $MachinePrecision], 2.6e+156]], $MachinePrecision]], N[(y * y), $MachinePrecision], N[(x * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot y \leq 1.1 \cdot 10^{-54}:\\
\;\;\;\;x \cdot x + x \cdot 2\\
\mathbf{elif}\;y \cdot y \leq 3.9 \cdot 10^{-28} \lor \neg \left(y \cdot y \leq 2.6 \cdot 10^{+156}\right):\\
\;\;\;\;y \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 y y) < 1.1e-54Initial program 100.0%
Taylor expanded in x around inf 73.1%
unpow273.1%
distribute-lft-in61.3%
*-rgt-identity61.3%
associate-*l*74.1%
distribute-lft-out74.1%
associate-*r/74.1%
metadata-eval74.1%
unpow274.1%
unpow274.1%
associate-/l*74.3%
Simplified74.3%
Taylor expanded in x around inf 95.3%
distribute-lft-in95.3%
Applied egg-rr95.3%
if 1.1e-54 < (*.f64 y y) < 3.89999999999999999e-28 or 2.60000000000000019e156 < (*.f64 y y) Initial program 100.0%
Taylor expanded in x around 0 90.5%
unpow290.5%
Simplified90.5%
if 3.89999999999999999e-28 < (*.f64 y y) < 2.60000000000000019e156Initial program 100.0%
Taylor expanded in x around inf 84.8%
unpow284.8%
distribute-lft-in58.8%
*-rgt-identity58.8%
associate-*l*85.3%
distribute-lft-out85.3%
associate-*r/85.3%
metadata-eval85.3%
unpow285.3%
unpow285.3%
associate-/l*85.2%
Simplified85.2%
Taylor expanded in x around inf 62.7%
Taylor expanded in x around inf 62.8%
unpow262.8%
Simplified62.8%
Final simplification87.8%
(FPCore (x y) :precision binary64 (if (<= (* y y) 1e-54) (* x (+ x 2.0)) (if (or (<= (* y y) 5.4e-32) (not (<= (* y y) 2.6e+156))) (* y y) (* x x))))
double code(double x, double y) {
double tmp;
if ((y * y) <= 1e-54) {
tmp = x * (x + 2.0);
} else if (((y * y) <= 5.4e-32) || !((y * y) <= 2.6e+156)) {
tmp = y * y;
} else {
tmp = x * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y * y) <= 1d-54) then
tmp = x * (x + 2.0d0)
else if (((y * y) <= 5.4d-32) .or. (.not. ((y * y) <= 2.6d+156))) then
tmp = y * y
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y * y) <= 1e-54) {
tmp = x * (x + 2.0);
} else if (((y * y) <= 5.4e-32) || !((y * y) <= 2.6e+156)) {
tmp = y * y;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y * y) <= 1e-54: tmp = x * (x + 2.0) elif ((y * y) <= 5.4e-32) or not ((y * y) <= 2.6e+156): tmp = y * y else: tmp = x * x return tmp
function code(x, y) tmp = 0.0 if (Float64(y * y) <= 1e-54) tmp = Float64(x * Float64(x + 2.0)); elseif ((Float64(y * y) <= 5.4e-32) || !(Float64(y * y) <= 2.6e+156)) tmp = Float64(y * y); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y * y) <= 1e-54) tmp = x * (x + 2.0); elseif (((y * y) <= 5.4e-32) || ~(((y * y) <= 2.6e+156))) tmp = y * y; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(y * y), $MachinePrecision], 1e-54], N[(x * N[(x + 2.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(y * y), $MachinePrecision], 5.4e-32], N[Not[LessEqual[N[(y * y), $MachinePrecision], 2.6e+156]], $MachinePrecision]], N[(y * y), $MachinePrecision], N[(x * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot y \leq 10^{-54}:\\
\;\;\;\;x \cdot \left(x + 2\right)\\
\mathbf{elif}\;y \cdot y \leq 5.4 \cdot 10^{-32} \lor \neg \left(y \cdot y \leq 2.6 \cdot 10^{+156}\right):\\
\;\;\;\;y \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 y y) < 1e-54Initial program 100.0%
Taylor expanded in x around inf 73.1%
unpow273.1%
distribute-lft-in61.3%
*-rgt-identity61.3%
associate-*l*74.1%
distribute-lft-out74.1%
associate-*r/74.1%
metadata-eval74.1%
unpow274.1%
unpow274.1%
associate-/l*74.3%
Simplified74.3%
Taylor expanded in x around inf 95.3%
if 1e-54 < (*.f64 y y) < 5.39999999999999962e-32 or 2.60000000000000019e156 < (*.f64 y y) Initial program 100.0%
Taylor expanded in x around 0 90.5%
unpow290.5%
Simplified90.5%
if 5.39999999999999962e-32 < (*.f64 y y) < 2.60000000000000019e156Initial program 100.0%
Taylor expanded in x around inf 84.8%
unpow284.8%
distribute-lft-in58.8%
*-rgt-identity58.8%
associate-*l*85.3%
distribute-lft-out85.3%
associate-*r/85.3%
metadata-eval85.3%
unpow285.3%
unpow285.3%
associate-/l*85.2%
Simplified85.2%
Taylor expanded in x around inf 62.7%
Taylor expanded in x around inf 62.8%
unpow262.8%
Simplified62.8%
Final simplification87.7%
(FPCore (x y)
:precision binary64
(if (<= x -1.45e+35)
(* x x)
(if (<= x -2.4e-117)
(* y y)
(if (<= x -2.7e-197)
(* x 2.0)
(if (<= x 18000000000000.0) (* y y) (* x x))))))
double code(double x, double y) {
double tmp;
if (x <= -1.45e+35) {
tmp = x * x;
} else if (x <= -2.4e-117) {
tmp = y * y;
} else if (x <= -2.7e-197) {
tmp = x * 2.0;
} else if (x <= 18000000000000.0) {
tmp = y * y;
} else {
tmp = x * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.45d+35)) then
tmp = x * x
else if (x <= (-2.4d-117)) then
tmp = y * y
else if (x <= (-2.7d-197)) then
tmp = x * 2.0d0
else if (x <= 18000000000000.0d0) then
tmp = y * y
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.45e+35) {
tmp = x * x;
} else if (x <= -2.4e-117) {
tmp = y * y;
} else if (x <= -2.7e-197) {
tmp = x * 2.0;
} else if (x <= 18000000000000.0) {
tmp = y * y;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.45e+35: tmp = x * x elif x <= -2.4e-117: tmp = y * y elif x <= -2.7e-197: tmp = x * 2.0 elif x <= 18000000000000.0: tmp = y * y else: tmp = x * x return tmp
function code(x, y) tmp = 0.0 if (x <= -1.45e+35) tmp = Float64(x * x); elseif (x <= -2.4e-117) tmp = Float64(y * y); elseif (x <= -2.7e-197) tmp = Float64(x * 2.0); elseif (x <= 18000000000000.0) tmp = Float64(y * y); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.45e+35) tmp = x * x; elseif (x <= -2.4e-117) tmp = y * y; elseif (x <= -2.7e-197) tmp = x * 2.0; elseif (x <= 18000000000000.0) tmp = y * y; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.45e+35], N[(x * x), $MachinePrecision], If[LessEqual[x, -2.4e-117], N[(y * y), $MachinePrecision], If[LessEqual[x, -2.7e-197], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, 18000000000000.0], N[(y * y), $MachinePrecision], N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{+35}:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;x \leq -2.4 \cdot 10^{-117}:\\
\;\;\;\;y \cdot y\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-197}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq 18000000000000:\\
\;\;\;\;y \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < -1.44999999999999997e35 or 1.8e13 < x Initial program 100.0%
Taylor expanded in x around inf 86.7%
unpow286.7%
distribute-lft-in60.1%
*-rgt-identity60.1%
associate-*l*86.7%
distribute-lft-out86.7%
associate-*r/86.7%
metadata-eval86.7%
unpow286.7%
unpow286.7%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 89.5%
Taylor expanded in x around inf 89.5%
unpow289.5%
Simplified89.5%
if -1.44999999999999997e35 < x < -2.40000000000000014e-117 or -2.70000000000000017e-197 < x < 1.8e13Initial program 100.0%
Taylor expanded in x around 0 60.8%
unpow260.8%
Simplified60.8%
if -2.40000000000000014e-117 < x < -2.70000000000000017e-197Initial program 100.0%
Taylor expanded in x around inf 41.7%
unpow241.7%
distribute-lft-in41.7%
*-rgt-identity41.7%
associate-*l*64.0%
distribute-lft-out64.0%
associate-*r/64.0%
metadata-eval64.0%
unpow264.0%
unpow264.0%
associate-/l*64.2%
Simplified64.2%
Taylor expanded in x around inf 68.7%
Taylor expanded in x around 0 68.7%
Final simplification74.2%
(FPCore (x y) :precision binary64 (if (<= (* y y) 5e-141) (+ (* x x) (* x 2.0)) (+ (* x x) (* y y))))
double code(double x, double y) {
double tmp;
if ((y * y) <= 5e-141) {
tmp = (x * x) + (x * 2.0);
} else {
tmp = (x * x) + (y * y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y * y) <= 5d-141) then
tmp = (x * x) + (x * 2.0d0)
else
tmp = (x * x) + (y * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y * y) <= 5e-141) {
tmp = (x * x) + (x * 2.0);
} else {
tmp = (x * x) + (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y * y) <= 5e-141: tmp = (x * x) + (x * 2.0) else: tmp = (x * x) + (y * y) return tmp
function code(x, y) tmp = 0.0 if (Float64(y * y) <= 5e-141) tmp = Float64(Float64(x * x) + Float64(x * 2.0)); else tmp = Float64(Float64(x * x) + Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y * y) <= 5e-141) tmp = (x * x) + (x * 2.0); else tmp = (x * x) + (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(y * y), $MachinePrecision], 5e-141], N[(N[(x * x), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot y \leq 5 \cdot 10^{-141}:\\
\;\;\;\;x \cdot x + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + y \cdot y\\
\end{array}
\end{array}
if (*.f64 y y) < 4.9999999999999999e-141Initial program 100.0%
Taylor expanded in x around inf 72.8%
unpow272.8%
distribute-lft-in60.2%
*-rgt-identity60.2%
associate-*l*73.9%
distribute-lft-out73.9%
associate-*r/73.9%
metadata-eval73.9%
unpow273.9%
unpow273.9%
associate-/l*74.1%
Simplified74.1%
Taylor expanded in x around inf 98.8%
distribute-lft-in98.8%
Applied egg-rr98.8%
if 4.9999999999999999e-141 < (*.f64 y y) Initial program 100.0%
Taylor expanded in x around inf 98.0%
unpow298.0%
Simplified98.0%
(FPCore (x y) :precision binary64 (if (or (<= x -2.0) (not (<= x 2.0))) (* x x) (* x 2.0)))
double code(double x, double y) {
double tmp;
if ((x <= -2.0) || !(x <= 2.0)) {
tmp = x * x;
} else {
tmp = x * 2.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-2.0d0)) .or. (.not. (x <= 2.0d0))) then
tmp = x * x
else
tmp = x * 2.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -2.0) || !(x <= 2.0)) {
tmp = x * x;
} else {
tmp = x * 2.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -2.0) or not (x <= 2.0): tmp = x * x else: tmp = x * 2.0 return tmp
function code(x, y) tmp = 0.0 if ((x <= -2.0) || !(x <= 2.0)) tmp = Float64(x * x); else tmp = Float64(x * 2.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -2.0) || ~((x <= 2.0))) tmp = x * x; else tmp = x * 2.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -2.0], N[Not[LessEqual[x, 2.0]], $MachinePrecision]], N[(x * x), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \lor \neg \left(x \leq 2\right):\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -2 or 2 < x Initial program 100.0%
Taylor expanded in x around inf 87.8%
unpow287.8%
distribute-lft-in63.4%
*-rgt-identity63.4%
associate-*l*87.7%
distribute-lft-out87.7%
associate-*r/87.7%
metadata-eval87.7%
unpow287.7%
unpow287.7%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 84.9%
Taylor expanded in x around inf 83.4%
unpow283.4%
Simplified83.4%
if -2 < x < 2Initial program 100.0%
Taylor expanded in x around inf 45.4%
unpow245.4%
distribute-lft-in45.5%
*-rgt-identity45.5%
associate-*l*60.4%
distribute-lft-out60.4%
associate-*r/60.4%
metadata-eval60.4%
unpow260.4%
unpow260.4%
associate-/l*60.5%
Simplified60.5%
Taylor expanded in x around inf 47.4%
Taylor expanded in x around 0 45.8%
Final simplification63.8%
(FPCore (x y) :precision binary64 (+ (* y y) (* x (+ x 2.0))))
double code(double x, double y) {
return (y * y) + (x * (x + 2.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y * y) + (x * (x + 2.0d0))
end function
public static double code(double x, double y) {
return (y * y) + (x * (x + 2.0));
}
def code(x, y): return (y * y) + (x * (x + 2.0))
function code(x, y) return Float64(Float64(y * y) + Float64(x * Float64(x + 2.0))) end
function tmp = code(x, y) tmp = (y * y) + (x * (x + 2.0)); end
code[x_, y_] := N[(N[(y * y), $MachinePrecision] + N[(x * N[(x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot y + x \cdot \left(x + 2\right)
\end{array}
Initial program 100.0%
distribute-lft-out100.0%
*-commutative100.0%
+-commutative100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (* x 2.0))
double code(double x, double y) {
return x * 2.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * 2.0d0
end function
public static double code(double x, double y) {
return x * 2.0;
}
def code(x, y): return x * 2.0
function code(x, y) return Float64(x * 2.0) end
function tmp = code(x, y) tmp = x * 2.0; end
code[x_, y_] := N[(x * 2.0), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 2
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 65.8%
unpow265.8%
distribute-lft-in54.1%
*-rgt-identity54.1%
associate-*l*73.5%
distribute-lft-out73.5%
associate-*r/73.5%
metadata-eval73.5%
unpow273.5%
unpow273.5%
associate-/l*79.5%
Simplified79.5%
Taylor expanded in x around inf 65.4%
Taylor expanded in x around 0 25.4%
Final simplification25.4%
(FPCore (x y) :precision binary64 (+ (* y y) (+ (* 2.0 x) (* x x))))
double code(double x, double y) {
return (y * y) + ((2.0 * x) + (x * x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y * y) + ((2.0d0 * x) + (x * x))
end function
public static double code(double x, double y) {
return (y * y) + ((2.0 * x) + (x * x));
}
def code(x, y): return (y * y) + ((2.0 * x) + (x * x))
function code(x, y) return Float64(Float64(y * y) + Float64(Float64(2.0 * x) + Float64(x * x))) end
function tmp = code(x, y) tmp = (y * y) + ((2.0 * x) + (x * x)); end
code[x_, y_] := N[(N[(y * y), $MachinePrecision] + N[(N[(2.0 * x), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot y + \left(2 \cdot x + x \cdot x\right)
\end{array}
herbie shell --seed 2024097
(FPCore (x y)
:name "Numeric.Log:$clog1p from log-domain-0.10.2.1, A"
:precision binary64
:alt
(+ (* y y) (+ (* 2.0 x) (* x x)))
(+ (+ (* x 2.0) (* x x)) (* y y)))