
(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) (* z (+ x y))))
double code(double x, double y, double z) {
return (x + y) + (z * (x + y));
}
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
public static double code(double x, double y, double z) {
return (x + y) + (z * (x + y));
}
def code(x, y, z): return (x + y) + (z * (x + y))
function code(x, y, z) return Float64(Float64(x + y) + Float64(z * Float64(x + y))) end
function tmp = code(x, y, z) tmp = (x + y) + (z * (x + y)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) + z \cdot \left(x + y\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= z -1.0)
(* x z)
(if (<= z -6e-126)
y
(if (<= z -3.7e-252)
x
(if (<= z -2.6e-298)
y
(if (<= z 2.8e-268)
x
(if (<= z 1.3e-191)
y
(if (<= z 9.8e-133)
x
(if (<= z 4.4e-57)
y
(if (<= z 29000000000.0) x (* x z)))))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= -6e-126) {
tmp = y;
} else if (z <= -3.7e-252) {
tmp = x;
} else if (z <= -2.6e-298) {
tmp = y;
} else if (z <= 2.8e-268) {
tmp = x;
} else if (z <= 1.3e-191) {
tmp = y;
} else if (z <= 9.8e-133) {
tmp = x;
} else if (z <= 4.4e-57) {
tmp = y;
} else if (z <= 29000000000.0) {
tmp = x;
} 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.0d0)) then
tmp = x * z
else if (z <= (-6d-126)) then
tmp = y
else if (z <= (-3.7d-252)) then
tmp = x
else if (z <= (-2.6d-298)) then
tmp = y
else if (z <= 2.8d-268) then
tmp = x
else if (z <= 1.3d-191) then
tmp = y
else if (z <= 9.8d-133) then
tmp = x
else if (z <= 4.4d-57) then
tmp = y
else if (z <= 29000000000.0d0) then
tmp = x
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.0) {
tmp = x * z;
} else if (z <= -6e-126) {
tmp = y;
} else if (z <= -3.7e-252) {
tmp = x;
} else if (z <= -2.6e-298) {
tmp = y;
} else if (z <= 2.8e-268) {
tmp = x;
} else if (z <= 1.3e-191) {
tmp = y;
} else if (z <= 9.8e-133) {
tmp = x;
} else if (z <= 4.4e-57) {
tmp = y;
} else if (z <= 29000000000.0) {
tmp = x;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = x * z elif z <= -6e-126: tmp = y elif z <= -3.7e-252: tmp = x elif z <= -2.6e-298: tmp = y elif z <= 2.8e-268: tmp = x elif z <= 1.3e-191: tmp = y elif z <= 9.8e-133: tmp = x elif z <= 4.4e-57: tmp = y elif z <= 29000000000.0: tmp = x else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * z); elseif (z <= -6e-126) tmp = y; elseif (z <= -3.7e-252) tmp = x; elseif (z <= -2.6e-298) tmp = y; elseif (z <= 2.8e-268) tmp = x; elseif (z <= 1.3e-191) tmp = y; elseif (z <= 9.8e-133) tmp = x; elseif (z <= 4.4e-57) tmp = y; elseif (z <= 29000000000.0) tmp = x; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = x * z; elseif (z <= -6e-126) tmp = y; elseif (z <= -3.7e-252) tmp = x; elseif (z <= -2.6e-298) tmp = y; elseif (z <= 2.8e-268) tmp = x; elseif (z <= 1.3e-191) tmp = y; elseif (z <= 9.8e-133) tmp = x; elseif (z <= 4.4e-57) tmp = y; elseif (z <= 29000000000.0) tmp = x; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, -6e-126], y, If[LessEqual[z, -3.7e-252], x, If[LessEqual[z, -2.6e-298], y, If[LessEqual[z, 2.8e-268], x, If[LessEqual[z, 1.3e-191], y, If[LessEqual[z, 9.8e-133], x, If[LessEqual[z, 4.4e-57], y, If[LessEqual[z, 29000000000.0], x, N[(x * z), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -6 \cdot 10^{-126}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{-252}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{-298}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-268}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-191}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{-133}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{-57}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 29000000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1 or 2.9e10 < z Initial program 100.0%
Taylor expanded in x around inf 57.3%
+-commutative57.3%
distribute-lft-in57.3%
*-rgt-identity57.3%
Applied egg-rr57.3%
Taylor expanded in z around inf 56.6%
if -1 < z < -6.0000000000000003e-126 or -3.7000000000000001e-252 < z < -2.5999999999999999e-298 or 2.80000000000000015e-268 < z < 1.29999999999999993e-191 or 9.79999999999999992e-133 < z < 4.39999999999999997e-57Initial program 100.0%
Taylor expanded in x around 0 46.1%
Taylor expanded in z around 0 46.1%
if -6.0000000000000003e-126 < z < -3.7000000000000001e-252 or -2.5999999999999999e-298 < z < 2.80000000000000015e-268 or 1.29999999999999993e-191 < z < 9.79999999999999992e-133 or 4.39999999999999997e-57 < z < 2.9e10Initial program 99.9%
Taylor expanded in x around inf 47.4%
Taylor expanded in z around 0 47.0%
Final simplification51.2%
(FPCore (x y z)
:precision binary64
(if (<= z -1.0)
(* y z)
(if (<= z -1.8e-124)
y
(if (<= z -1.4e-247)
x
(if (<= z -8.4e-299)
y
(if (<= z 2.2e-269)
x
(if (<= z 6e-192)
y
(if (<= z 1.75e-133)
x
(if (<= z 4.4e-66)
y
(if (<= z 29000000000.0) x (* x z)))))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = y * z;
} else if (z <= -1.8e-124) {
tmp = y;
} else if (z <= -1.4e-247) {
tmp = x;
} else if (z <= -8.4e-299) {
tmp = y;
} else if (z <= 2.2e-269) {
tmp = x;
} else if (z <= 6e-192) {
tmp = y;
} else if (z <= 1.75e-133) {
tmp = x;
} else if (z <= 4.4e-66) {
tmp = y;
} else if (z <= 29000000000.0) {
tmp = x;
} 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.0d0)) then
tmp = y * z
else if (z <= (-1.8d-124)) then
tmp = y
else if (z <= (-1.4d-247)) then
tmp = x
else if (z <= (-8.4d-299)) then
tmp = y
else if (z <= 2.2d-269) then
tmp = x
else if (z <= 6d-192) then
tmp = y
else if (z <= 1.75d-133) then
tmp = x
else if (z <= 4.4d-66) then
tmp = y
else if (z <= 29000000000.0d0) then
tmp = x
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.0) {
tmp = y * z;
} else if (z <= -1.8e-124) {
tmp = y;
} else if (z <= -1.4e-247) {
tmp = x;
} else if (z <= -8.4e-299) {
tmp = y;
} else if (z <= 2.2e-269) {
tmp = x;
} else if (z <= 6e-192) {
tmp = y;
} else if (z <= 1.75e-133) {
tmp = x;
} else if (z <= 4.4e-66) {
tmp = y;
} else if (z <= 29000000000.0) {
tmp = x;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = y * z elif z <= -1.8e-124: tmp = y elif z <= -1.4e-247: tmp = x elif z <= -8.4e-299: tmp = y elif z <= 2.2e-269: tmp = x elif z <= 6e-192: tmp = y elif z <= 1.75e-133: tmp = x elif z <= 4.4e-66: tmp = y elif z <= 29000000000.0: tmp = x else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(y * z); elseif (z <= -1.8e-124) tmp = y; elseif (z <= -1.4e-247) tmp = x; elseif (z <= -8.4e-299) tmp = y; elseif (z <= 2.2e-269) tmp = x; elseif (z <= 6e-192) tmp = y; elseif (z <= 1.75e-133) tmp = x; elseif (z <= 4.4e-66) tmp = y; elseif (z <= 29000000000.0) tmp = x; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = y * z; elseif (z <= -1.8e-124) tmp = y; elseif (z <= -1.4e-247) tmp = x; elseif (z <= -8.4e-299) tmp = y; elseif (z <= 2.2e-269) tmp = x; elseif (z <= 6e-192) tmp = y; elseif (z <= 1.75e-133) tmp = x; elseif (z <= 4.4e-66) tmp = y; elseif (z <= 29000000000.0) tmp = x; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.8e-124], y, If[LessEqual[z, -1.4e-247], x, If[LessEqual[z, -8.4e-299], y, If[LessEqual[z, 2.2e-269], x, If[LessEqual[z, 6e-192], y, If[LessEqual[z, 1.75e-133], x, If[LessEqual[z, 4.4e-66], y, If[LessEqual[z, 29000000000.0], x, N[(x * z), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{-124}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq -1.4 \cdot 10^{-247}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -8.4 \cdot 10^{-299}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-269}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-192}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-133}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{-66}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 29000000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1Initial program 100.0%
Taylor expanded in x around 0 53.5%
+-commutative53.5%
distribute-lft-in53.5%
*-rgt-identity53.5%
Applied egg-rr53.5%
Taylor expanded in z around inf 52.2%
*-commutative52.2%
Simplified52.2%
if -1 < z < -1.80000000000000005e-124 or -1.39999999999999993e-247 < z < -8.40000000000000041e-299 or 2.19999999999999984e-269 < z < 5.9999999999999998e-192 or 1.75000000000000001e-133 < z < 4.4000000000000002e-66Initial program 100.0%
Taylor expanded in x around 0 46.1%
Taylor expanded in z around 0 46.1%
if -1.80000000000000005e-124 < z < -1.39999999999999993e-247 or -8.40000000000000041e-299 < z < 2.19999999999999984e-269 or 5.9999999999999998e-192 < z < 1.75000000000000001e-133 or 4.4000000000000002e-66 < z < 2.9e10Initial program 99.9%
Taylor expanded in x around inf 47.4%
Taylor expanded in z around 0 47.0%
if 2.9e10 < z Initial program 99.9%
Taylor expanded in x around inf 62.1%
+-commutative62.1%
distribute-lft-in62.1%
*-rgt-identity62.1%
Applied egg-rr62.1%
Taylor expanded in z around inf 62.1%
Final simplification51.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.115) (not (<= z 29000000000.0))) (* x (+ z 1.0)) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.115) || !(z <= 29000000000.0)) {
tmp = x * (z + 1.0);
} else {
tmp = x + 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 ((z <= (-0.115d0)) .or. (.not. (z <= 29000000000.0d0))) then
tmp = x * (z + 1.0d0)
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.115) || !(z <= 29000000000.0)) {
tmp = x * (z + 1.0);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.115) or not (z <= 29000000000.0): tmp = x * (z + 1.0) else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.115) || !(z <= 29000000000.0)) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.115) || ~((z <= 29000000000.0))) tmp = x * (z + 1.0); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.115], N[Not[LessEqual[z, 29000000000.0]], $MachinePrecision]], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.115 \lor \neg \left(z \leq 29000000000\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -0.115000000000000005 or 2.9e10 < z Initial program 100.0%
Taylor expanded in x around inf 57.3%
if -0.115000000000000005 < z < 2.9e10Initial program 100.0%
Taylor expanded in z around 0 98.2%
+-commutative98.2%
Simplified98.2%
Final simplification79.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* z (+ x y)) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = z * (x + y);
} else {
tmp = x + 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 ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = z * (x + y)
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = z * (x + y);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = z * (x + y) else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(z * Float64(x + y)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = z * (x + y); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;z \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 100.0%
Taylor expanded in z around inf 98.4%
+-commutative98.4%
Simplified98.4%
if -1 < z < 1Initial program 100.0%
Taylor expanded in z around 0 98.8%
+-commutative98.8%
Simplified98.8%
Final simplification98.6%
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (* y z) (if (<= z 29000000000.0) (+ x y) (* x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = y * z;
} else if (z <= 29000000000.0) {
tmp = x + y;
} 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.0d0)) then
tmp = y * z
else if (z <= 29000000000.0d0) then
tmp = x + y
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.0) {
tmp = y * z;
} else if (z <= 29000000000.0) {
tmp = x + y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = y * z elif z <= 29000000000.0: tmp = x + y else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(y * z); elseif (z <= 29000000000.0) tmp = Float64(x + y); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = y * z; elseif (z <= 29000000000.0) tmp = x + y; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(y * z), $MachinePrecision], If[LessEqual[z, 29000000000.0], N[(x + y), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 29000000000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1Initial program 100.0%
Taylor expanded in x around 0 53.5%
+-commutative53.5%
distribute-lft-in53.5%
*-rgt-identity53.5%
Applied egg-rr53.5%
Taylor expanded in z around inf 52.2%
*-commutative52.2%
Simplified52.2%
if -1 < z < 2.9e10Initial program 100.0%
Taylor expanded in z around 0 98.2%
+-commutative98.2%
Simplified98.2%
if 2.9e10 < z Initial program 99.9%
Taylor expanded in x around inf 62.1%
+-commutative62.1%
distribute-lft-in62.1%
*-rgt-identity62.1%
Applied egg-rr62.1%
Taylor expanded in z around inf 62.1%
Final simplification79.2%
(FPCore (x y z) :precision binary64 (if (<= x -1.1e-59) (* x (+ z 1.0)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.1e-59) {
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 <= (-1.1d-59)) 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 <= -1.1e-59) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.1e-59: tmp = x * (z + 1.0) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.1e-59) 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 <= -1.1e-59) tmp = x * (z + 1.0); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.1e-59], 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 \leq -1.1 \cdot 10^{-59}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -1.0999999999999999e-59Initial program 100.0%
Taylor expanded in x around inf 80.2%
if -1.0999999999999999e-59 < x Initial program 100.0%
Taylor expanded in x around 0 57.2%
Final simplification63.8%
(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%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (<= x -9e-107) x y))
double code(double x, double y, double z) {
double tmp;
if (x <= -9e-107) {
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 (x <= (-9d-107)) 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 (x <= -9e-107) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -9e-107: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -9e-107) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -9e-107) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -9e-107], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-107}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if x < -9.00000000000000032e-107Initial program 100.0%
Taylor expanded in x around inf 75.1%
Taylor expanded in z around 0 40.2%
if -9.00000000000000032e-107 < x Initial program 100.0%
Taylor expanded in x around 0 57.0%
Taylor expanded in z around 0 32.5%
Final simplification35.1%
(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 x around inf 54.6%
Taylor expanded in z around 0 29.0%
Final simplification29.0%
herbie shell --seed 2023279
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))