
(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}
(FPCore (x y z) :precision binary64 (+ (+ x y) (* (+ x y) z)))
double code(double x, double y, double z) {
return (x + y) + ((x + y) * z);
}
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) + ((x + y) * z)
end function
public static double code(double x, double y, double z) {
return (x + y) + ((x + y) * z);
}
def code(x, y, z): return (x + y) + ((x + y) * z)
function code(x, y, z) return Float64(Float64(x + y) + Float64(Float64(x + y) * z)) end
function tmp = code(x, y, z) tmp = (x + y) + ((x + y) * z); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] + N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) + \left(x + y\right) \cdot z
\end{array}
Initial program 100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ z 1.0))))
(if (<= (+ z 1.0) -4e+94)
(* y z)
(if (<= (+ z 1.0) 1.0)
t_0
(if (<= (+ z 1.0) 1.0000002)
(+ x y)
(if (<= (+ z 1.0) 5e+68)
t_0
(if (<= (+ z 1.0) 5e+256) (* y z) (* x z))))))))
double code(double x, double y, double z) {
double t_0 = x * (z + 1.0);
double tmp;
if ((z + 1.0) <= -4e+94) {
tmp = y * z;
} else if ((z + 1.0) <= 1.0) {
tmp = t_0;
} else if ((z + 1.0) <= 1.0000002) {
tmp = x + y;
} else if ((z + 1.0) <= 5e+68) {
tmp = t_0;
} else if ((z + 1.0) <= 5e+256) {
tmp = y * z;
} else {
tmp = x * z;
}
return tmp;
}
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) <= (-4d+94)) then
tmp = y * z
else if ((z + 1.0d0) <= 1.0d0) then
tmp = t_0
else if ((z + 1.0d0) <= 1.0000002d0) then
tmp = x + y
else if ((z + 1.0d0) <= 5d+68) then
tmp = t_0
else if ((z + 1.0d0) <= 5d+256) then
tmp = y * z
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (z + 1.0);
double tmp;
if ((z + 1.0) <= -4e+94) {
tmp = y * z;
} else if ((z + 1.0) <= 1.0) {
tmp = t_0;
} else if ((z + 1.0) <= 1.0000002) {
tmp = x + y;
} else if ((z + 1.0) <= 5e+68) {
tmp = t_0;
} else if ((z + 1.0) <= 5e+256) {
tmp = y * z;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z + 1.0) tmp = 0 if (z + 1.0) <= -4e+94: tmp = y * z elif (z + 1.0) <= 1.0: tmp = t_0 elif (z + 1.0) <= 1.0000002: tmp = x + y elif (z + 1.0) <= 5e+68: tmp = t_0 elif (z + 1.0) <= 5e+256: tmp = y * z else: tmp = x * z return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z + 1.0)) tmp = 0.0 if (Float64(z + 1.0) <= -4e+94) tmp = Float64(y * z); elseif (Float64(z + 1.0) <= 1.0) tmp = t_0; elseif (Float64(z + 1.0) <= 1.0000002) tmp = Float64(x + y); elseif (Float64(z + 1.0) <= 5e+68) tmp = t_0; elseif (Float64(z + 1.0) <= 5e+256) tmp = Float64(y * z); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z + 1.0); tmp = 0.0; if ((z + 1.0) <= -4e+94) tmp = y * z; elseif ((z + 1.0) <= 1.0) tmp = t_0; elseif ((z + 1.0) <= 1.0000002) tmp = x + y; elseif ((z + 1.0) <= 5e+68) tmp = t_0; elseif ((z + 1.0) <= 5e+256) tmp = y * z; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z + 1.0), $MachinePrecision], -4e+94], N[(y * z), $MachinePrecision], If[LessEqual[N[(z + 1.0), $MachinePrecision], 1.0], t$95$0, If[LessEqual[N[(z + 1.0), $MachinePrecision], 1.0000002], N[(x + y), $MachinePrecision], If[LessEqual[N[(z + 1.0), $MachinePrecision], 5e+68], t$95$0, If[LessEqual[N[(z + 1.0), $MachinePrecision], 5e+256], N[(y * z), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z + 1\right)\\
\mathbf{if}\;z + 1 \leq -4 \cdot 10^{+94}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z + 1 \leq 1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z + 1 \leq 1.0000002:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z + 1 \leq 5 \cdot 10^{+68}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z + 1 \leq 5 \cdot 10^{+256}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if (+.f64 z #s(literal 1 binary64)) < -4.0000000000000001e94 or 5.0000000000000004e68 < (+.f64 z #s(literal 1 binary64)) < 5.00000000000000015e256Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around 0 52.9%
if -4.0000000000000001e94 < (+.f64 z #s(literal 1 binary64)) < 1 or 1.00000019999999989 < (+.f64 z #s(literal 1 binary64)) < 5.0000000000000004e68Initial program 100.0%
Taylor expanded in x around inf 48.1%
if 1 < (+.f64 z #s(literal 1 binary64)) < 1.00000019999999989Initial program 100.0%
Taylor expanded in z around 0 88.7%
+-commutative88.7%
Simplified88.7%
if 5.00000000000000015e256 < (+.f64 z #s(literal 1 binary64)) Initial program 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in x around inf 66.8%
*-commutative66.8%
Simplified66.8%
Final simplification50.8%
(FPCore (x y z)
:precision binary64
(if (<= z -9.5e+93)
(* y z)
(if (<= z -1.0)
(* x z)
(if (<= z 4.6e-113)
y
(if (<= z 14500000.0) x (if (<= z 4.1e+256) (* y z) (* x z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -9.5e+93) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 4.6e-113) {
tmp = y;
} else if (z <= 14500000.0) {
tmp = x;
} else if (z <= 4.1e+256) {
tmp = y * z;
} else {
tmp = x * z;
}
return tmp;
}
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 <= (-9.5d+93)) then
tmp = y * z
else if (z <= (-1.0d0)) then
tmp = x * z
else if (z <= 4.6d-113) then
tmp = y
else if (z <= 14500000.0d0) then
tmp = x
else if (z <= 4.1d+256) then
tmp = y * z
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -9.5e+93) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 4.6e-113) {
tmp = y;
} else if (z <= 14500000.0) {
tmp = x;
} else if (z <= 4.1e+256) {
tmp = y * z;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9.5e+93: tmp = y * z elif z <= -1.0: tmp = x * z elif z <= 4.6e-113: tmp = y elif z <= 14500000.0: tmp = x elif z <= 4.1e+256: tmp = y * z else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9.5e+93) tmp = Float64(y * z); elseif (z <= -1.0) tmp = Float64(x * z); elseif (z <= 4.6e-113) tmp = y; elseif (z <= 14500000.0) tmp = x; elseif (z <= 4.1e+256) tmp = Float64(y * z); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9.5e+93) tmp = y * z; elseif (z <= -1.0) tmp = x * z; elseif (z <= 4.6e-113) tmp = y; elseif (z <= 14500000.0) tmp = x; elseif (z <= 4.1e+256) tmp = y * z; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9.5e+93], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 4.6e-113], y, If[LessEqual[z, 14500000.0], x, If[LessEqual[z, 4.1e+256], N[(y * z), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+93}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-113}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 14500000:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{+256}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -9.4999999999999991e93 or 1.45e7 < z < 4.10000000000000006e256Initial program 100.0%
Taylor expanded in z around inf 99.6%
Taylor expanded in x around 0 52.4%
if -9.4999999999999991e93 < z < -1 or 4.10000000000000006e256 < z Initial program 100.0%
Taylor expanded in z around inf 96.1%
Taylor expanded in x around inf 45.0%
*-commutative45.0%
Simplified45.0%
if -1 < z < 4.60000000000000016e-113Initial program 100.0%
Taylor expanded in z around 0 97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in y around inf 46.3%
if 4.60000000000000016e-113 < z < 1.45e7Initial program 99.9%
Taylor expanded in z around 0 90.9%
+-commutative90.9%
Simplified90.9%
Taylor expanded in y around 0 32.6%
Final simplification47.2%
(FPCore (x y z)
:precision binary64
(if (<= z -1.1e+94)
(* y z)
(if (<= z -1.0)
(* x z)
(if (<= z 14500000.0) (+ x y) (if (<= z 7e+256) (* y z) (* x z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.1e+94) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 14500000.0) {
tmp = x + y;
} else if (z <= 7e+256) {
tmp = y * z;
} else {
tmp = x * z;
}
return tmp;
}
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.1d+94)) then
tmp = y * z
else if (z <= (-1.0d0)) then
tmp = x * z
else if (z <= 14500000.0d0) then
tmp = x + y
else if (z <= 7d+256) then
tmp = y * z
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.1e+94) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 14500000.0) {
tmp = x + y;
} else if (z <= 7e+256) {
tmp = y * z;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.1e+94: tmp = y * z elif z <= -1.0: tmp = x * z elif z <= 14500000.0: tmp = x + y elif z <= 7e+256: tmp = y * z else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.1e+94) tmp = Float64(y * z); elseif (z <= -1.0) tmp = Float64(x * z); elseif (z <= 14500000.0) tmp = Float64(x + y); elseif (z <= 7e+256) tmp = Float64(y * z); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.1e+94) tmp = y * z; elseif (z <= -1.0) tmp = x * z; elseif (z <= 14500000.0) tmp = x + y; elseif (z <= 7e+256) tmp = y * z; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.1e+94], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 14500000.0], N[(x + y), $MachinePrecision], If[LessEqual[z, 7e+256], N[(y * z), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+94}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 14500000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+256}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1.10000000000000006e94 or 1.45e7 < z < 6.9999999999999995e256Initial program 100.0%
Taylor expanded in z around inf 99.6%
Taylor expanded in x around 0 52.4%
if -1.10000000000000006e94 < z < -1 or 6.9999999999999995e256 < z Initial program 100.0%
Taylor expanded in z around inf 96.1%
Taylor expanded in x around inf 45.0%
*-commutative45.0%
Simplified45.0%
if -1 < z < 1.45e7Initial program 100.0%
Taylor expanded in z around 0 96.3%
+-commutative96.3%
Simplified96.3%
Final simplification72.2%
(FPCore (x y z) :precision binary64 (if (<= z -1.6e-16) (* y z) (if (<= z 2e-112) y (if (<= z 14500000.0) x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.6e-16) {
tmp = y * z;
} else if (z <= 2e-112) {
tmp = y;
} else if (z <= 14500000.0) {
tmp = x;
} else {
tmp = y * z;
}
return tmp;
}
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.6d-16)) then
tmp = y * z
else if (z <= 2d-112) then
tmp = y
else if (z <= 14500000.0d0) then
tmp = x
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.6e-16) {
tmp = y * z;
} else if (z <= 2e-112) {
tmp = y;
} else if (z <= 14500000.0) {
tmp = x;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.6e-16: tmp = y * z elif z <= 2e-112: tmp = y elif z <= 14500000.0: tmp = x else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.6e-16) tmp = Float64(y * z); elseif (z <= 2e-112) tmp = y; elseif (z <= 14500000.0) tmp = x; else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.6e-16) tmp = y * z; elseif (z <= 2e-112) tmp = y; elseif (z <= 14500000.0) tmp = x; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.6e-16], N[(y * z), $MachinePrecision], If[LessEqual[z, 2e-112], y, If[LessEqual[z, 14500000.0], x, N[(y * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-16}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-112}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 14500000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1.60000000000000011e-16 or 1.45e7 < z Initial program 100.0%
Taylor expanded in z around inf 95.3%
Taylor expanded in x around 0 51.8%
if -1.60000000000000011e-16 < z < 1.9999999999999999e-112Initial program 100.0%
Taylor expanded in z around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 47.4%
if 1.9999999999999999e-112 < z < 1.45e7Initial program 99.9%
Taylor expanded in z around 0 90.9%
+-commutative90.9%
Simplified90.9%
Taylor expanded in y around 0 32.6%
(FPCore (x y z) :precision binary64 (if (<= (+ x y) -1e-287) (+ x (* x z)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -1e-287) {
tmp = x + (x * z);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
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) <= (-1d-287)) then
tmp = x + (x * z)
else
tmp = y * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -1e-287) {
tmp = x + (x * z);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x + y) <= -1e-287: tmp = x + (x * z) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x + y) <= -1e-287) tmp = Float64(x + Float64(x * z)); else tmp = Float64(y * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x + y) <= -1e-287) tmp = x + (x * z); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e-287], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{-287}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -1.00000000000000002e-287Initial program 100.0%
Taylor expanded in x around inf 52.5%
distribute-lft-in52.5%
*-rgt-identity52.5%
Applied egg-rr52.5%
if -1.00000000000000002e-287 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0 51.7%
Final simplification52.1%
(FPCore (x y z) :precision binary64 (if (<= (+ x y) -1e-287) (* x (+ z 1.0)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -1e-287) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
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) <= (-1d-287)) then
tmp = x * (z + 1.0d0)
else
tmp = y * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -1e-287) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x + y) <= -1e-287: tmp = x * (z + 1.0) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x + y) <= -1e-287) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(y * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x + y) <= -1e-287) tmp = x * (z + 1.0); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e-287], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{-287}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -1.00000000000000002e-287Initial program 100.0%
Taylor expanded in x around inf 52.5%
if -1.00000000000000002e-287 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0 51.7%
(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}
Initial program 100.0%
(FPCore (x y z) :precision binary64 (if (<= y 3.6e-19) x y))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.6e-19) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
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 <= 3.6d-19) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.6e-19) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.6e-19: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.6e-19) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.6e-19) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.6e-19], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.6 \cdot 10^{-19}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 3.6000000000000001e-19Initial program 100.0%
Taylor expanded in z around 0 47.4%
+-commutative47.4%
Simplified47.4%
Taylor expanded in y around 0 28.4%
if 3.6000000000000001e-19 < y Initial program 100.0%
Taylor expanded in z around 0 46.8%
+-commutative46.8%
Simplified46.8%
Taylor expanded in y around inf 35.7%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
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
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in z around 0 47.3%
+-commutative47.3%
Simplified47.3%
Taylor expanded in y around 0 24.1%
herbie shell --seed 2024137
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))