
(FPCore (x y z) :precision binary64 (* (+ x y) (+ z 1.0)))
double code(double x, double y, double z) {
return (x + y) * (z + 1.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) * (z + 1.0d0)
end function
public static double code(double x, double y, double z) {
return (x + y) * (z + 1.0);
}
def code(x, y, z): return (x + y) * (z + 1.0)
function code(x, y, z) return Float64(Float64(x + y) * Float64(z + 1.0)) end
function tmp = code(x, y, z) tmp = (x + y) * (z + 1.0); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) \cdot \left(z + 1\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* (+ x y) (+ z 1.0)))
double code(double x, double y, double z) {
return (x + y) * (z + 1.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) * (z + 1.0d0)
end function
public static double code(double x, double y, double z) {
return (x + y) * (z + 1.0);
}
def code(x, y, z): return (x + y) * (z + 1.0)
function code(x, y, z) return Float64(Float64(x + y) * Float64(z + 1.0)) end
function tmp = code(x, y, z) tmp = (x + y) * (z + 1.0); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) \cdot \left(z + 1\right)
\end{array}
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (+ x (+ y (* z (+ x y)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
return x + (y + (z * (x + y)));
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (y + (z * (x + y)))
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
return x + (y + (z * (x + y)));
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return x + (y + (z * (x + y)))
x, y, z = sort([x, y, z]) function code(x, y, z) return Float64(x + Float64(y + Float64(z * Float64(x + y)))) end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = x + (y + (z * (x + y)));
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(x + N[(y + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
x + \left(y + z \cdot \left(x + y\right)\right)
\end{array}
Initial program 99.9%
Taylor expanded in z around 0 100.0%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ z 1.0))))
(if (<= (+ z 1.0) -8e+191)
(* y z)
(if (<= (+ z 1.0) 0.996)
t_0
(if (<= (+ z 1.0) 1.0000002)
(+ x y)
(if (<= (+ z 1.0) 5e+38) t_0 (* y z)))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = x * (z + 1.0);
double tmp;
if ((z + 1.0) <= -8e+191) {
tmp = y * z;
} else if ((z + 1.0) <= 0.996) {
tmp = t_0;
} else if ((z + 1.0) <= 1.0000002) {
tmp = x + y;
} else if ((z + 1.0) <= 5e+38) {
tmp = t_0;
} else {
tmp = y * z;
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x * (z + 1.0d0)
if ((z + 1.0d0) <= (-8d+191)) then
tmp = y * z
else if ((z + 1.0d0) <= 0.996d0) then
tmp = t_0
else if ((z + 1.0d0) <= 1.0000002d0) then
tmp = x + y
else if ((z + 1.0d0) <= 5d+38) then
tmp = t_0
else
tmp = y * z
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double t_0 = x * (z + 1.0);
double tmp;
if ((z + 1.0) <= -8e+191) {
tmp = y * z;
} else if ((z + 1.0) <= 0.996) {
tmp = t_0;
} else if ((z + 1.0) <= 1.0000002) {
tmp = x + y;
} else if ((z + 1.0) <= 5e+38) {
tmp = t_0;
} else {
tmp = y * z;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): t_0 = x * (z + 1.0) tmp = 0 if (z + 1.0) <= -8e+191: tmp = y * z elif (z + 1.0) <= 0.996: tmp = t_0 elif (z + 1.0) <= 1.0000002: tmp = x + y elif (z + 1.0) <= 5e+38: tmp = t_0 else: tmp = y * z return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = Float64(x * Float64(z + 1.0)) tmp = 0.0 if (Float64(z + 1.0) <= -8e+191) tmp = Float64(y * z); elseif (Float64(z + 1.0) <= 0.996) tmp = t_0; elseif (Float64(z + 1.0) <= 1.0000002) tmp = Float64(x + y); elseif (Float64(z + 1.0) <= 5e+38) tmp = t_0; else tmp = Float64(y * z); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
t_0 = x * (z + 1.0);
tmp = 0.0;
if ((z + 1.0) <= -8e+191)
tmp = y * z;
elseif ((z + 1.0) <= 0.996)
tmp = t_0;
elseif ((z + 1.0) <= 1.0000002)
tmp = x + y;
elseif ((z + 1.0) <= 5e+38)
tmp = t_0;
else
tmp = y * z;
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z + 1.0), $MachinePrecision], -8e+191], N[(y * z), $MachinePrecision], If[LessEqual[N[(z + 1.0), $MachinePrecision], 0.996], t$95$0, If[LessEqual[N[(z + 1.0), $MachinePrecision], 1.0000002], N[(x + y), $MachinePrecision], If[LessEqual[N[(z + 1.0), $MachinePrecision], 5e+38], t$95$0, N[(y * z), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := x \cdot \left(z + 1\right)\\
\mathbf{if}\;z + 1 \leq -8 \cdot 10^{+191}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z + 1 \leq 0.996:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z + 1 \leq 1.0000002:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z + 1 \leq 5 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if (+.f64 z #s(literal 1 binary64)) < -8.00000000000000058e191 or 4.9999999999999997e38 < (+.f64 z #s(literal 1 binary64)) Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around 0 42.5%
if -8.00000000000000058e191 < (+.f64 z #s(literal 1 binary64)) < 0.996 or 1.00000019999999989 < (+.f64 z #s(literal 1 binary64)) < 4.9999999999999997e38Initial program 99.8%
Taylor expanded in x around inf 55.9%
if 0.996 < (+.f64 z #s(literal 1 binary64)) < 1.00000019999999989Initial program 100.0%
Taylor expanded in z around 0 98.4%
+-commutative98.4%
Simplified98.4%
Final simplification71.3%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(if (<= z -8e+191)
(* y z)
(if (<= z -1.0)
(* x z)
(if (<= z 4e-204) y (if (<= z 4.5e+27) x (* y z))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (z <= -8e+191) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 4e-204) {
tmp = y;
} else if (z <= 4.5e+27) {
tmp = x;
} else {
tmp = y * z;
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-8d+191)) then
tmp = y * z
else if (z <= (-1.0d0)) then
tmp = x * z
else if (z <= 4d-204) then
tmp = y
else if (z <= 4.5d+27) then
tmp = x
else
tmp = y * z
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (z <= -8e+191) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 4e-204) {
tmp = y;
} else if (z <= 4.5e+27) {
tmp = x;
} else {
tmp = y * z;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if z <= -8e+191: tmp = y * z elif z <= -1.0: tmp = x * z elif z <= 4e-204: tmp = y elif z <= 4.5e+27: tmp = x else: tmp = y * z return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (z <= -8e+191) tmp = Float64(y * z); elseif (z <= -1.0) tmp = Float64(x * z); elseif (z <= 4e-204) tmp = y; elseif (z <= 4.5e+27) tmp = x; else tmp = Float64(y * z); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (z <= -8e+191)
tmp = y * z;
elseif (z <= -1.0)
tmp = x * z;
elseif (z <= 4e-204)
tmp = y;
elseif (z <= 4.5e+27)
tmp = x;
else
tmp = y * z;
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[z, -8e+191], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 4e-204], y, If[LessEqual[z, 4.5e+27], x, N[(y * z), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+191}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-204}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+27}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -8.00000000000000058e191 or 4.4999999999999999e27 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around 0 42.2%
if -8.00000000000000058e191 < z < -1Initial program 99.9%
Taylor expanded in z around inf 97.6%
Taylor expanded in x around inf 45.7%
if -1 < z < 4e-204Initial program 100.0%
Taylor expanded in z around 0 100.0%
Taylor expanded in x around inf 98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in x around 0 51.3%
if 4e-204 < z < 4.4999999999999999e27Initial program 99.8%
Taylor expanded in z around 0 85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in y around 0 46.7%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z -8e+191) (* y z) (if (<= z -1.0) (* x z) (if (<= z 4.5e+27) (+ x y) (* y z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (z <= -8e+191) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 4.5e+27) {
tmp = x + y;
} else {
tmp = y * z;
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-8d+191)) then
tmp = y * z
else if (z <= (-1.0d0)) then
tmp = x * z
else if (z <= 4.5d+27) then
tmp = x + y
else
tmp = y * z
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (z <= -8e+191) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 4.5e+27) {
tmp = x + y;
} else {
tmp = y * z;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if z <= -8e+191: tmp = y * z elif z <= -1.0: tmp = x * z elif z <= 4.5e+27: tmp = x + y else: tmp = y * z return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (z <= -8e+191) tmp = Float64(y * z); elseif (z <= -1.0) tmp = Float64(x * z); elseif (z <= 4.5e+27) tmp = Float64(x + y); else tmp = Float64(y * z); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (z <= -8e+191)
tmp = y * z;
elseif (z <= -1.0)
tmp = x * z;
elseif (z <= 4.5e+27)
tmp = x + y;
else
tmp = y * z;
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[z, -8e+191], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 4.5e+27], N[(x + y), $MachinePrecision], N[(y * z), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+191}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+27}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -8.00000000000000058e191 or 4.4999999999999999e27 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around 0 42.2%
if -8.00000000000000058e191 < z < -1Initial program 99.9%
Taylor expanded in z around inf 97.6%
Taylor expanded in x around inf 45.7%
if -1 < z < 4.4999999999999999e27Initial program 99.9%
Taylor expanded in z around 0 91.6%
+-commutative91.6%
Simplified91.6%
Final simplification68.0%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z -1.0) (* x z) (if (<= z 3.9e-204) y (if (<= z 0.029) x (* x z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= 3.9e-204) {
tmp = y;
} else if (z <= 0.029) {
tmp = x;
} else {
tmp = x * z;
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.0d0)) then
tmp = x * z
else if (z <= 3.9d-204) then
tmp = y
else if (z <= 0.029d0) then
tmp = x
else
tmp = x * z
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= 3.9e-204) {
tmp = y;
} else if (z <= 0.029) {
tmp = x;
} else {
tmp = x * z;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if z <= -1.0: tmp = x * z elif z <= 3.9e-204: tmp = y elif z <= 0.029: tmp = x else: tmp = x * z return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * z); elseif (z <= 3.9e-204) tmp = y; elseif (z <= 0.029) tmp = x; else tmp = Float64(x * z); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (z <= -1.0)
tmp = x * z;
elseif (z <= 3.9e-204)
tmp = y;
elseif (z <= 0.029)
tmp = x;
else
tmp = x * z;
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 3.9e-204], y, If[LessEqual[z, 0.029], x, N[(x * z), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{-204}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 0.029:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1 or 0.0290000000000000015 < z Initial program 99.9%
Taylor expanded in z around inf 97.3%
Taylor expanded in x around inf 58.6%
if -1 < z < 3.9e-204Initial program 100.0%
Taylor expanded in z around 0 100.0%
Taylor expanded in x around inf 98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in x around 0 51.3%
if 3.9e-204 < z < 0.0290000000000000015Initial program 99.9%
Taylor expanded in z around 0 94.8%
+-commutative94.8%
Simplified94.8%
Taylor expanded in y around 0 51.1%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (+ x y) -4e-289) (* x (+ z 1.0)) (+ y (* y z))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -4e-289) {
tmp = x * (z + 1.0);
} else {
tmp = y + (y * z);
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x + y) <= (-4d-289)) then
tmp = x * (z + 1.0d0)
else
tmp = y + (y * z)
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -4e-289) {
tmp = x * (z + 1.0);
} else {
tmp = y + (y * z);
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if (x + y) <= -4e-289: tmp = x * (z + 1.0) else: tmp = y + (y * z) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (Float64(x + y) <= -4e-289) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(y + Float64(y * z)); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((x + y) <= -4e-289)
tmp = x * (z + 1.0);
else
tmp = y + (y * z);
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -4e-289], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(y + N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -4 \cdot 10^{-289}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y + y \cdot z\\
\end{array}
\end{array}
if (+.f64 x y) < -4e-289Initial program 99.9%
Taylor expanded in x around inf 62.7%
if -4e-289 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0 54.9%
distribute-lft-in54.9%
*-rgt-identity54.9%
Applied egg-rr54.9%
Final simplification58.8%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (+ x y) -4e-289) (* x (+ z 1.0)) (* y (+ z 1.0))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -4e-289) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x + y) <= (-4d-289)) then
tmp = x * (z + 1.0d0)
else
tmp = y * (z + 1.0d0)
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -4e-289) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if (x + y) <= -4e-289: tmp = x * (z + 1.0) else: tmp = y * (z + 1.0) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (Float64(x + y) <= -4e-289) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(y * Float64(z + 1.0)); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((x + y) <= -4e-289)
tmp = x * (z + 1.0);
else
tmp = y * (z + 1.0);
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -4e-289], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -4 \cdot 10^{-289}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -4e-289Initial program 99.9%
Taylor expanded in x around inf 62.7%
if -4e-289 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0 54.9%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* (+ x y) (+ z 1.0)))
assert(x < y && y < z);
double code(double x, double y, double z) {
return (x + y) * (z + 1.0);
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) * (z + 1.0d0)
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
return (x + y) * (z + 1.0);
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return (x + y) * (z + 1.0)
x, y, z = sort([x, y, z]) function code(x, y, z) return Float64(Float64(x + y) * Float64(z + 1.0)) end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = (x + y) * (z + 1.0);
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\left(x + y\right) \cdot \left(z + 1\right)
\end{array}
Initial program 99.9%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 5.2e-81) x y))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= 5.2e-81) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 5.2d-81) then
tmp = x
else
tmp = y
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (y <= 5.2e-81) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if y <= 5.2e-81: tmp = x else: tmp = y return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= 5.2e-81) tmp = x; else tmp = y; end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= 5.2e-81)
tmp = x;
else
tmp = y;
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, 5.2e-81], x, y]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.2 \cdot 10^{-81}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 5.1999999999999998e-81Initial program 99.9%
Taylor expanded in z around 0 46.8%
+-commutative46.8%
Simplified46.8%
Taylor expanded in y around 0 31.6%
if 5.1999999999999998e-81 < y Initial program 99.9%
Taylor expanded in z around 0 100.0%
Taylor expanded in x around inf 66.4%
*-commutative66.4%
Simplified66.4%
Taylor expanded in x around 0 42.4%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 x)
assert(x < y && y < z);
double code(double x, double y, double z) {
return x;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
return x;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return x
x, y, z = sort([x, y, z]) function code(x, y, z) return x end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = x;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := x
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
x
\end{array}
Initial program 99.9%
Taylor expanded in z around 0 48.5%
+-commutative48.5%
Simplified48.5%
Taylor expanded in y around 0 25.4%
herbie shell --seed 2024165
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))