
(FPCore (x y) :precision binary64 (+ (+ (* x y) x) y))
double code(double x, double y) {
return ((x * y) + x) + y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * y) + x) + y
end function
public static double code(double x, double y) {
return ((x * y) + x) + y;
}
def code(x, y): return ((x * y) + x) + y
function code(x, y) return Float64(Float64(Float64(x * y) + x) + y) end
function tmp = code(x, y) tmp = ((x * y) + x) + y; end
code[x_, y_] := N[(N[(N[(x * y), $MachinePrecision] + x), $MachinePrecision] + y), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + x\right) + y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ (+ (* x y) x) y))
double code(double x, double y) {
return ((x * y) + x) + y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * y) + x) + y
end function
public static double code(double x, double y) {
return ((x * y) + x) + y;
}
def code(x, y): return ((x * y) + x) + y
function code(x, y) return Float64(Float64(Float64(x * y) + x) + y) end
function tmp = code(x, y) tmp = ((x * y) + x) + y; end
code[x_, y_] := N[(N[(N[(x * y), $MachinePrecision] + x), $MachinePrecision] + y), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + x\right) + y
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (fma (+ y 1.0) x y))
assert(x < y);
double code(double x, double y) {
return fma((y + 1.0), x, y);
}
x, y = sort([x, y]) function code(x, y) return fma(Float64(y + 1.0), x, y) end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y + 1.0), $MachinePrecision] * x + y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\mathsf{fma}\left(y + 1, x, y\right)
\end{array}
Initial program 100.0%
*-commutative100.0%
distribute-lft1-in100.0%
fma-define100.0%
Simplified100.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y -1.0)
(* y x)
(if (<= y 5.2e-84)
x
(if (<= y 5.3e-71)
y
(if (<= y 1.8e-50)
x
(if (or (<= y 1.02e+121) (and (not (<= y 3e+143)) (<= y 1.4e+243)))
y
(* y x)))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = y * x;
} else if (y <= 5.2e-84) {
tmp = x;
} else if (y <= 5.3e-71) {
tmp = y;
} else if (y <= 1.8e-50) {
tmp = x;
} else if ((y <= 1.02e+121) || (!(y <= 3e+143) && (y <= 1.4e+243))) {
tmp = y;
} else {
tmp = y * x;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = y * x
else if (y <= 5.2d-84) then
tmp = x
else if (y <= 5.3d-71) then
tmp = y
else if (y <= 1.8d-50) then
tmp = x
else if ((y <= 1.02d+121) .or. (.not. (y <= 3d+143)) .and. (y <= 1.4d+243)) then
tmp = y
else
tmp = y * x
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = y * x;
} else if (y <= 5.2e-84) {
tmp = x;
} else if (y <= 5.3e-71) {
tmp = y;
} else if (y <= 1.8e-50) {
tmp = x;
} else if ((y <= 1.02e+121) || (!(y <= 3e+143) && (y <= 1.4e+243))) {
tmp = y;
} else {
tmp = y * x;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= -1.0: tmp = y * x elif y <= 5.2e-84: tmp = x elif y <= 5.3e-71: tmp = y elif y <= 1.8e-50: tmp = x elif (y <= 1.02e+121) or (not (y <= 3e+143) and (y <= 1.4e+243)): tmp = y else: tmp = y * x return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(y * x); elseif (y <= 5.2e-84) tmp = x; elseif (y <= 5.3e-71) tmp = y; elseif (y <= 1.8e-50) tmp = x; elseif ((y <= 1.02e+121) || (!(y <= 3e+143) && (y <= 1.4e+243))) tmp = y; else tmp = Float64(y * x); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= -1.0)
tmp = y * x;
elseif (y <= 5.2e-84)
tmp = x;
elseif (y <= 5.3e-71)
tmp = y;
elseif (y <= 1.8e-50)
tmp = x;
elseif ((y <= 1.02e+121) || (~((y <= 3e+143)) && (y <= 1.4e+243)))
tmp = y;
else
tmp = y * x;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, -1.0], N[(y * x), $MachinePrecision], If[LessEqual[y, 5.2e-84], x, If[LessEqual[y, 5.3e-71], y, If[LessEqual[y, 1.8e-50], x, If[Or[LessEqual[y, 1.02e+121], And[N[Not[LessEqual[y, 3e+143]], $MachinePrecision], LessEqual[y, 1.4e+243]]], y, N[(y * x), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-84}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5.3 \cdot 10^{-71}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-50}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{+121} \lor \neg \left(y \leq 3 \cdot 10^{+143}\right) \land y \leq 1.4 \cdot 10^{+243}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -1 or 1.02000000000000005e121 < y < 3.0000000000000001e143 or 1.4e243 < y Initial program 99.9%
Taylor expanded in x around inf 58.6%
+-commutative58.6%
Simplified58.6%
Taylor expanded in y around inf 58.5%
if -1 < y < 5.2e-84 or 5.29999999999999999e-71 < y < 1.7999999999999999e-50Initial program 100.0%
Taylor expanded in y around 0 74.0%
if 5.2e-84 < y < 5.29999999999999999e-71 or 1.7999999999999999e-50 < y < 1.02000000000000005e121 or 3.0000000000000001e143 < y < 1.4e243Initial program 100.0%
Taylor expanded in x around 0 50.5%
Final simplification63.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (+ y 1.0) x)))
(if (<= x -4.2e-28)
t_0
(if (<= x -1.85e-85)
y
(if (<= x -3.9e-155) x (if (<= x 2.85e-11) y t_0))))))assert(x < y);
double code(double x, double y) {
double t_0 = (y + 1.0) * x;
double tmp;
if (x <= -4.2e-28) {
tmp = t_0;
} else if (x <= -1.85e-85) {
tmp = y;
} else if (x <= -3.9e-155) {
tmp = x;
} else if (x <= 2.85e-11) {
tmp = y;
} else {
tmp = t_0;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (y + 1.0d0) * x
if (x <= (-4.2d-28)) then
tmp = t_0
else if (x <= (-1.85d-85)) then
tmp = y
else if (x <= (-3.9d-155)) then
tmp = x
else if (x <= 2.85d-11) then
tmp = y
else
tmp = t_0
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = (y + 1.0) * x;
double tmp;
if (x <= -4.2e-28) {
tmp = t_0;
} else if (x <= -1.85e-85) {
tmp = y;
} else if (x <= -3.9e-155) {
tmp = x;
} else if (x <= 2.85e-11) {
tmp = y;
} else {
tmp = t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (y + 1.0) * x tmp = 0 if x <= -4.2e-28: tmp = t_0 elif x <= -1.85e-85: tmp = y elif x <= -3.9e-155: tmp = x elif x <= 2.85e-11: tmp = y else: tmp = t_0 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(y + 1.0) * x) tmp = 0.0 if (x <= -4.2e-28) tmp = t_0; elseif (x <= -1.85e-85) tmp = y; elseif (x <= -3.9e-155) tmp = x; elseif (x <= 2.85e-11) tmp = y; else tmp = t_0; end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (y + 1.0) * x;
tmp = 0.0;
if (x <= -4.2e-28)
tmp = t_0;
elseif (x <= -1.85e-85)
tmp = y;
elseif (x <= -3.9e-155)
tmp = x;
elseif (x <= 2.85e-11)
tmp = y;
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(N[(y + 1.0), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -4.2e-28], t$95$0, If[LessEqual[x, -1.85e-85], y, If[LessEqual[x, -3.9e-155], x, If[LessEqual[x, 2.85e-11], y, t$95$0]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(y + 1\right) \cdot x\\
\mathbf{if}\;x \leq -4.2 \cdot 10^{-28}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{-85}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \leq -3.9 \cdot 10^{-155}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.85 \cdot 10^{-11}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4.20000000000000013e-28 or 2.8499999999999999e-11 < x Initial program 100.0%
Taylor expanded in x around inf 96.4%
+-commutative96.4%
Simplified96.4%
if -4.20000000000000013e-28 < x < -1.84999999999999992e-85 or -3.9000000000000003e-155 < x < 2.8499999999999999e-11Initial program 100.0%
Taylor expanded in x around 0 79.6%
if -1.84999999999999992e-85 < x < -3.9000000000000003e-155Initial program 100.0%
Taylor expanded in y around 0 36.0%
Final simplification87.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.85e-28) (+ x (* y x)) (if (<= x -1.85e-85) y (if (<= x -3.9e-155) x (* y (+ 1.0 x))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.85e-28) {
tmp = x + (y * x);
} else if (x <= -1.85e-85) {
tmp = y;
} else if (x <= -3.9e-155) {
tmp = x;
} else {
tmp = y * (1.0 + x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.85d-28)) then
tmp = x + (y * x)
else if (x <= (-1.85d-85)) then
tmp = y
else if (x <= (-3.9d-155)) then
tmp = x
else
tmp = y * (1.0d0 + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.85e-28) {
tmp = x + (y * x);
} else if (x <= -1.85e-85) {
tmp = y;
} else if (x <= -3.9e-155) {
tmp = x;
} else {
tmp = y * (1.0 + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.85e-28: tmp = x + (y * x) elif x <= -1.85e-85: tmp = y elif x <= -3.9e-155: tmp = x else: tmp = y * (1.0 + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.85e-28) tmp = Float64(x + Float64(y * x)); elseif (x <= -1.85e-85) tmp = y; elseif (x <= -3.9e-155) tmp = x; else tmp = Float64(y * Float64(1.0 + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.85e-28)
tmp = x + (y * x);
elseif (x <= -1.85e-85)
tmp = y;
elseif (x <= -3.9e-155)
tmp = x;
else
tmp = y * (1.0 + x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.85e-28], N[(x + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.85e-85], y, If[LessEqual[x, -3.9e-155], x, N[(y * N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{-28}:\\
\;\;\;\;x + y \cdot x\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{-85}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \leq -3.9 \cdot 10^{-155}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 + x\right)\\
\end{array}
\end{array}
if x < -1.8500000000000001e-28Initial program 100.0%
Taylor expanded in x around inf 95.3%
+-commutative95.3%
Simplified95.3%
distribute-lft-in95.3%
*-rgt-identity95.3%
Applied egg-rr95.3%
if -1.8500000000000001e-28 < x < -1.84999999999999992e-85Initial program 100.0%
Taylor expanded in x around 0 83.5%
if -1.84999999999999992e-85 < x < -3.9000000000000003e-155Initial program 100.0%
Taylor expanded in y around 0 36.0%
if -3.9000000000000003e-155 < x Initial program 100.0%
Taylor expanded in y around inf 67.3%
Final simplification74.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.25e-29) (* (+ y 1.0) x) (if (<= x -1.85e-85) y (if (<= x -3.9e-155) x (* y (+ 1.0 x))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.25e-29) {
tmp = (y + 1.0) * x;
} else if (x <= -1.85e-85) {
tmp = y;
} else if (x <= -3.9e-155) {
tmp = x;
} else {
tmp = y * (1.0 + x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.25d-29)) then
tmp = (y + 1.0d0) * x
else if (x <= (-1.85d-85)) then
tmp = y
else if (x <= (-3.9d-155)) then
tmp = x
else
tmp = y * (1.0d0 + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.25e-29) {
tmp = (y + 1.0) * x;
} else if (x <= -1.85e-85) {
tmp = y;
} else if (x <= -3.9e-155) {
tmp = x;
} else {
tmp = y * (1.0 + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.25e-29: tmp = (y + 1.0) * x elif x <= -1.85e-85: tmp = y elif x <= -3.9e-155: tmp = x else: tmp = y * (1.0 + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.25e-29) tmp = Float64(Float64(y + 1.0) * x); elseif (x <= -1.85e-85) tmp = y; elseif (x <= -3.9e-155) tmp = x; else tmp = Float64(y * Float64(1.0 + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.25e-29)
tmp = (y + 1.0) * x;
elseif (x <= -1.85e-85)
tmp = y;
elseif (x <= -3.9e-155)
tmp = x;
else
tmp = y * (1.0 + x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.25e-29], N[(N[(y + 1.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, -1.85e-85], y, If[LessEqual[x, -3.9e-155], x, N[(y * N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{-29}:\\
\;\;\;\;\left(y + 1\right) \cdot x\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{-85}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \leq -3.9 \cdot 10^{-155}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 + x\right)\\
\end{array}
\end{array}
if x < -1.24999999999999996e-29Initial program 100.0%
Taylor expanded in x around inf 95.3%
+-commutative95.3%
Simplified95.3%
if -1.24999999999999996e-29 < x < -1.84999999999999992e-85Initial program 100.0%
Taylor expanded in x around 0 83.5%
if -1.84999999999999992e-85 < x < -3.9000000000000003e-155Initial program 100.0%
Taylor expanded in y around 0 36.0%
if -3.9000000000000003e-155 < x Initial program 100.0%
Taylor expanded in y around inf 67.3%
Final simplification74.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5.5e-28) x (if (<= x -1.85e-85) y (if (<= x -3.9e-155) x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5.5e-28) {
tmp = x;
} else if (x <= -1.85e-85) {
tmp = y;
} else if (x <= -3.9e-155) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-5.5d-28)) then
tmp = x
else if (x <= (-1.85d-85)) then
tmp = y
else if (x <= (-3.9d-155)) then
tmp = x
else
tmp = y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -5.5e-28) {
tmp = x;
} else if (x <= -1.85e-85) {
tmp = y;
} else if (x <= -3.9e-155) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -5.5e-28: tmp = x elif x <= -1.85e-85: tmp = y elif x <= -3.9e-155: tmp = x else: tmp = y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -5.5e-28) tmp = x; elseif (x <= -1.85e-85) tmp = y; elseif (x <= -3.9e-155) tmp = x; else tmp = y; end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -5.5e-28)
tmp = x;
elseif (x <= -1.85e-85)
tmp = y;
elseif (x <= -3.9e-155)
tmp = x;
else
tmp = y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -5.5e-28], x, If[LessEqual[x, -1.85e-85], y, If[LessEqual[x, -3.9e-155], x, y]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-28}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{-85}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \leq -3.9 \cdot 10^{-155}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if x < -5.49999999999999967e-28 or -1.84999999999999992e-85 < x < -3.9000000000000003e-155Initial program 100.0%
Taylor expanded in y around 0 40.9%
if -5.49999999999999967e-28 < x < -1.84999999999999992e-85 or -3.9000000000000003e-155 < x Initial program 100.0%
Taylor expanded in x around 0 49.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (+ y (+ x (* y x))))
assert(x < y);
double code(double x, double y) {
return y + (x + (y * x));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = y + (x + (y * x))
end function
assert x < y;
public static double code(double x, double y) {
return y + (x + (y * x));
}
[x, y] = sort([x, y]) def code(x, y): return y + (x + (y * x))
x, y = sort([x, y]) function code(x, y) return Float64(y + Float64(x + Float64(y * x))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = y + (x + (y * x));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(y + N[(x + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
y + \left(x + y \cdot x\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 x)
assert(x < y);
double code(double x, double y) {
return x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x
end function
assert x < y;
public static double code(double x, double y) {
return x;
}
[x, y] = sort([x, y]) def code(x, y): return x
x, y = sort([x, y]) function code(x, y) return x end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := x
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 35.6%
herbie shell --seed 2024089
(FPCore (x y)
:name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
:precision binary64
(+ (+ (* x y) x) y))