
(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 -9.5e-99)
y
(if (<= z -4.9e-297)
x
(if (<= z 1.8e-239)
y
(if (<= z 5.6e-72)
x
(if (<= z 2.7)
y
(if (or (<= z 7.2e+109) (not (<= z 4.4e+145)))
(* x z)
(* y z)))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= -9.5e-99) {
tmp = y;
} else if (z <= -4.9e-297) {
tmp = x;
} else if (z <= 1.8e-239) {
tmp = y;
} else if (z <= 5.6e-72) {
tmp = x;
} else if (z <= 2.7) {
tmp = y;
} else if ((z <= 7.2e+109) || !(z <= 4.4e+145)) {
tmp = x * z;
} 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.0d0)) then
tmp = x * z
else if (z <= (-9.5d-99)) then
tmp = y
else if (z <= (-4.9d-297)) then
tmp = x
else if (z <= 1.8d-239) then
tmp = y
else if (z <= 5.6d-72) then
tmp = x
else if (z <= 2.7d0) then
tmp = y
else if ((z <= 7.2d+109) .or. (.not. (z <= 4.4d+145))) then
tmp = x * z
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.0) {
tmp = x * z;
} else if (z <= -9.5e-99) {
tmp = y;
} else if (z <= -4.9e-297) {
tmp = x;
} else if (z <= 1.8e-239) {
tmp = y;
} else if (z <= 5.6e-72) {
tmp = x;
} else if (z <= 2.7) {
tmp = y;
} else if ((z <= 7.2e+109) || !(z <= 4.4e+145)) {
tmp = x * z;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = x * z elif z <= -9.5e-99: tmp = y elif z <= -4.9e-297: tmp = x elif z <= 1.8e-239: tmp = y elif z <= 5.6e-72: tmp = x elif z <= 2.7: tmp = y elif (z <= 7.2e+109) or not (z <= 4.4e+145): tmp = x * z else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * z); elseif (z <= -9.5e-99) tmp = y; elseif (z <= -4.9e-297) tmp = x; elseif (z <= 1.8e-239) tmp = y; elseif (z <= 5.6e-72) tmp = x; elseif (z <= 2.7) tmp = y; elseif ((z <= 7.2e+109) || !(z <= 4.4e+145)) tmp = Float64(x * z); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = x * z; elseif (z <= -9.5e-99) tmp = y; elseif (z <= -4.9e-297) tmp = x; elseif (z <= 1.8e-239) tmp = y; elseif (z <= 5.6e-72) tmp = x; elseif (z <= 2.7) tmp = y; elseif ((z <= 7.2e+109) || ~((z <= 4.4e+145))) tmp = x * z; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, -9.5e-99], y, If[LessEqual[z, -4.9e-297], x, If[LessEqual[z, 1.8e-239], y, If[LessEqual[z, 5.6e-72], x, If[LessEqual[z, 2.7], y, If[Or[LessEqual[z, 7.2e+109], N[Not[LessEqual[z, 4.4e+145]], $MachinePrecision]], N[(x * z), $MachinePrecision], N[(y * z), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{-99}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq -4.9 \cdot 10^{-297}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-239}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-72}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.7:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+109} \lor \neg \left(z \leq 4.4 \cdot 10^{+145}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1 or 2.7000000000000002 < z < 7.2e109 or 4.40000000000000017e145 < z Initial program 100.0%
Taylor expanded in x around inf 54.6%
Taylor expanded in z around inf 54.0%
if -1 < z < -9.5000000000000008e-99 or -4.89999999999999997e-297 < z < 1.8000000000000001e-239 or 5.5999999999999996e-72 < z < 2.7000000000000002Initial program 99.9%
Taylor expanded in x around 0 48.6%
Taylor expanded in z around 0 45.8%
if -9.5000000000000008e-99 < z < -4.89999999999999997e-297 or 1.8000000000000001e-239 < z < 5.5999999999999996e-72Initial program 100.0%
Taylor expanded in x around inf 47.9%
Taylor expanded in z around 0 47.9%
if 7.2e109 < z < 4.40000000000000017e145Initial program 100.0%
Taylor expanded in z around inf 100.0%
+-commutative100.0%
Simplified100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 46.9%
*-commutative46.9%
Simplified46.9%
Final simplification49.9%
(FPCore (x y z)
:precision binary64
(if (<= z -1.0)
(* x z)
(if (<= z -1.25e-109)
y
(if (<= z -5.4e-297)
x
(if (<= z 1.75e-239)
y
(if (<= z 2.3e-72) x (if (<= z 0.42) y (* x z))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= -1.25e-109) {
tmp = y;
} else if (z <= -5.4e-297) {
tmp = x;
} else if (z <= 1.75e-239) {
tmp = y;
} else if (z <= 2.3e-72) {
tmp = x;
} else if (z <= 0.42) {
tmp = 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 = x * z
else if (z <= (-1.25d-109)) then
tmp = y
else if (z <= (-5.4d-297)) then
tmp = x
else if (z <= 1.75d-239) then
tmp = y
else if (z <= 2.3d-72) then
tmp = x
else if (z <= 0.42d0) then
tmp = 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 = x * z;
} else if (z <= -1.25e-109) {
tmp = y;
} else if (z <= -5.4e-297) {
tmp = x;
} else if (z <= 1.75e-239) {
tmp = y;
} else if (z <= 2.3e-72) {
tmp = x;
} else if (z <= 0.42) {
tmp = y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = x * z elif z <= -1.25e-109: tmp = y elif z <= -5.4e-297: tmp = x elif z <= 1.75e-239: tmp = y elif z <= 2.3e-72: tmp = x elif z <= 0.42: tmp = y else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * z); elseif (z <= -1.25e-109) tmp = y; elseif (z <= -5.4e-297) tmp = x; elseif (z <= 1.75e-239) tmp = y; elseif (z <= 2.3e-72) tmp = x; elseif (z <= 0.42) tmp = 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 = x * z; elseif (z <= -1.25e-109) tmp = y; elseif (z <= -5.4e-297) tmp = x; elseif (z <= 1.75e-239) tmp = y; elseif (z <= 2.3e-72) tmp = x; elseif (z <= 0.42) tmp = y; 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, -1.25e-109], y, If[LessEqual[z, -5.4e-297], x, If[LessEqual[z, 1.75e-239], y, If[LessEqual[z, 2.3e-72], x, If[LessEqual[z, 0.42], y, N[(x * z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1.25 \cdot 10^{-109}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq -5.4 \cdot 10^{-297}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-239}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-72}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 0.42:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1 or 0.419999999999999984 < z Initial program 100.0%
Taylor expanded in x around inf 54.7%
Taylor expanded in z around inf 54.1%
if -1 < z < -1.25000000000000005e-109 or -5.4000000000000002e-297 < z < 1.75000000000000003e-239 or 2.29999999999999995e-72 < z < 0.419999999999999984Initial program 99.9%
Taylor expanded in x around 0 48.6%
Taylor expanded in z around 0 45.8%
if -1.25000000000000005e-109 < z < -5.4000000000000002e-297 or 1.75000000000000003e-239 < z < 2.29999999999999995e-72Initial program 100.0%
Taylor expanded in x around inf 47.9%
Taylor expanded in z around 0 47.9%
Final simplification50.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ z 1.0))))
(if (<= z -0.00055)
t_0
(if (<= z 6.4e-6)
(+ x y)
(if (or (<= z 6.9e+109) (not (<= z 5.2e+144))) t_0 (* y z))))))
double code(double x, double y, double z) {
double t_0 = x * (z + 1.0);
double tmp;
if (z <= -0.00055) {
tmp = t_0;
} else if (z <= 6.4e-6) {
tmp = x + y;
} else if ((z <= 6.9e+109) || !(z <= 5.2e+144)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = x * (z + 1.0d0)
if (z <= (-0.00055d0)) then
tmp = t_0
else if (z <= 6.4d-6) then
tmp = x + y
else if ((z <= 6.9d+109) .or. (.not. (z <= 5.2d+144))) then
tmp = t_0
else
tmp = y * 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 <= -0.00055) {
tmp = t_0;
} else if (z <= 6.4e-6) {
tmp = x + y;
} else if ((z <= 6.9e+109) || !(z <= 5.2e+144)) {
tmp = t_0;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z + 1.0) tmp = 0 if z <= -0.00055: tmp = t_0 elif z <= 6.4e-6: tmp = x + y elif (z <= 6.9e+109) or not (z <= 5.2e+144): tmp = t_0 else: tmp = y * z return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z + 1.0)) tmp = 0.0 if (z <= -0.00055) tmp = t_0; elseif (z <= 6.4e-6) tmp = Float64(x + y); elseif ((z <= 6.9e+109) || !(z <= 5.2e+144)) tmp = t_0; else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z + 1.0); tmp = 0.0; if (z <= -0.00055) tmp = t_0; elseif (z <= 6.4e-6) tmp = x + y; elseif ((z <= 6.9e+109) || ~((z <= 5.2e+144))) tmp = t_0; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.00055], t$95$0, If[LessEqual[z, 6.4e-6], N[(x + y), $MachinePrecision], If[Or[LessEqual[z, 6.9e+109], N[Not[LessEqual[z, 5.2e+144]], $MachinePrecision]], t$95$0, N[(y * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z + 1\right)\\
\mathbf{if}\;z \leq -0.00055:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{-6}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 6.9 \cdot 10^{+109} \lor \neg \left(z \leq 5.2 \cdot 10^{+144}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -5.50000000000000033e-4 or 6.3999999999999997e-6 < z < 6.8999999999999999e109 or 5.1999999999999998e144 < z Initial program 100.0%
Taylor expanded in x around inf 55.0%
if -5.50000000000000033e-4 < z < 6.3999999999999997e-6Initial program 100.0%
Taylor expanded in z around 0 97.9%
+-commutative97.9%
Simplified97.9%
if 6.8999999999999999e109 < z < 5.1999999999999998e144Initial program 100.0%
Taylor expanded in z around inf 100.0%
+-commutative100.0%
Simplified100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 46.9%
*-commutative46.9%
Simplified46.9%
Final simplification77.6%
(FPCore (x y z)
:precision binary64
(if (<= z -1.0)
(* x z)
(if (<= z 21.0)
(+ x y)
(if (or (<= z 1.45e+107) (not (<= z 4.6e+144))) (* x z) (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= 21.0) {
tmp = x + y;
} else if ((z <= 1.45e+107) || !(z <= 4.6e+144)) {
tmp = x * z;
} 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.0d0)) then
tmp = x * z
else if (z <= 21.0d0) then
tmp = x + y
else if ((z <= 1.45d+107) .or. (.not. (z <= 4.6d+144))) then
tmp = x * z
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.0) {
tmp = x * z;
} else if (z <= 21.0) {
tmp = x + y;
} else if ((z <= 1.45e+107) || !(z <= 4.6e+144)) {
tmp = x * z;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = x * z elif z <= 21.0: tmp = x + y elif (z <= 1.45e+107) or not (z <= 4.6e+144): tmp = x * z else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * z); elseif (z <= 21.0) tmp = Float64(x + y); elseif ((z <= 1.45e+107) || !(z <= 4.6e+144)) tmp = Float64(x * z); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = x * z; elseif (z <= 21.0) tmp = x + y; elseif ((z <= 1.45e+107) || ~((z <= 4.6e+144))) tmp = x * z; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 21.0], N[(x + y), $MachinePrecision], If[Or[LessEqual[z, 1.45e+107], N[Not[LessEqual[z, 4.6e+144]], $MachinePrecision]], N[(x * z), $MachinePrecision], N[(y * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 21:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+107} \lor \neg \left(z \leq 4.6 \cdot 10^{+144}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1 or 21 < z < 1.44999999999999994e107 or 4.6000000000000003e144 < z Initial program 100.0%
Taylor expanded in x around inf 54.6%
Taylor expanded in z around inf 54.0%
if -1 < z < 21Initial program 100.0%
Taylor expanded in z around 0 97.4%
+-commutative97.4%
Simplified97.4%
if 1.44999999999999994e107 < z < 4.6000000000000003e144Initial program 100.0%
Taylor expanded in z around inf 100.0%
+-commutative100.0%
Simplified100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 46.9%
*-commutative46.9%
Simplified46.9%
Final simplification77.1%
(FPCore (x y z) :precision binary64 (if (<= y 2.55e-210) x (if (<= y 1.4e-171) y (if (<= y 1.9e-56) x y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.55e-210) {
tmp = x;
} else if (y <= 1.4e-171) {
tmp = y;
} else if (y <= 1.9e-56) {
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 <= 2.55d-210) then
tmp = x
else if (y <= 1.4d-171) then
tmp = y
else if (y <= 1.9d-56) 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 <= 2.55e-210) {
tmp = x;
} else if (y <= 1.4e-171) {
tmp = y;
} else if (y <= 1.9e-56) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.55e-210: tmp = x elif y <= 1.4e-171: tmp = y elif y <= 1.9e-56: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.55e-210) tmp = x; elseif (y <= 1.4e-171) tmp = y; elseif (y <= 1.9e-56) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.55e-210) tmp = x; elseif (y <= 1.4e-171) tmp = y; elseif (y <= 1.9e-56) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.55e-210], x, If[LessEqual[y, 1.4e-171], y, If[LessEqual[y, 1.9e-56], x, y]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.55 \cdot 10^{-210}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-171}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{-56}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 2.54999999999999998e-210 or 1.40000000000000011e-171 < y < 1.9000000000000001e-56Initial program 100.0%
Taylor expanded in x around inf 60.3%
Taylor expanded in z around 0 34.6%
if 2.54999999999999998e-210 < y < 1.40000000000000011e-171 or 1.9000000000000001e-56 < y Initial program 100.0%
Taylor expanded in x around 0 71.8%
Taylor expanded in z around 0 45.0%
Final simplification37.9%
(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 99.4%
+-commutative99.4%
Simplified99.4%
if -1 < z < 1Initial program 100.0%
Taylor expanded in z around 0 97.4%
+-commutative97.4%
Simplified97.4%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (<= y 8e-12) (* x (+ z 1.0)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= 8e-12) {
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 (y <= 8d-12) 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 (y <= 8e-12) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 8e-12: tmp = x * (z + 1.0) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 8e-12) 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 (y <= 8e-12) tmp = x * (z + 1.0); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 8e-12], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if y < 7.99999999999999984e-12Initial program 100.0%
Taylor expanded in x around inf 59.5%
if 7.99999999999999984e-12 < y Initial program 100.0%
Taylor expanded in x around 0 78.3%
Final simplification64.1%
(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 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 52.3%
Taylor expanded in z around 0 27.8%
Final simplification27.8%
herbie shell --seed 2024024
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))