
(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 9 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 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 (<= z -4.1e-7)
(* y z)
(if (<= z -4e-111)
y
(if (<= z -5e-224)
x
(if (<= z 1.7e-297)
y
(if (<= z 4.1e-249)
x
(if (<= z 7.5e-104)
y
(if (<= z 1.25e-40) x (if (<= z 0.00017) y (* y z))))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.1e-7) {
tmp = y * z;
} else if (z <= -4e-111) {
tmp = y;
} else if (z <= -5e-224) {
tmp = x;
} else if (z <= 1.7e-297) {
tmp = y;
} else if (z <= 4.1e-249) {
tmp = x;
} else if (z <= 7.5e-104) {
tmp = y;
} else if (z <= 1.25e-40) {
tmp = x;
} else if (z <= 0.00017) {
tmp = y;
} 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 <= (-4.1d-7)) then
tmp = y * z
else if (z <= (-4d-111)) then
tmp = y
else if (z <= (-5d-224)) then
tmp = x
else if (z <= 1.7d-297) then
tmp = y
else if (z <= 4.1d-249) then
tmp = x
else if (z <= 7.5d-104) then
tmp = y
else if (z <= 1.25d-40) then
tmp = x
else if (z <= 0.00017d0) then
tmp = y
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.1e-7) {
tmp = y * z;
} else if (z <= -4e-111) {
tmp = y;
} else if (z <= -5e-224) {
tmp = x;
} else if (z <= 1.7e-297) {
tmp = y;
} else if (z <= 4.1e-249) {
tmp = x;
} else if (z <= 7.5e-104) {
tmp = y;
} else if (z <= 1.25e-40) {
tmp = x;
} else if (z <= 0.00017) {
tmp = y;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.1e-7: tmp = y * z elif z <= -4e-111: tmp = y elif z <= -5e-224: tmp = x elif z <= 1.7e-297: tmp = y elif z <= 4.1e-249: tmp = x elif z <= 7.5e-104: tmp = y elif z <= 1.25e-40: tmp = x elif z <= 0.00017: tmp = y else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.1e-7) tmp = Float64(y * z); elseif (z <= -4e-111) tmp = y; elseif (z <= -5e-224) tmp = x; elseif (z <= 1.7e-297) tmp = y; elseif (z <= 4.1e-249) tmp = x; elseif (z <= 7.5e-104) tmp = y; elseif (z <= 1.25e-40) tmp = x; elseif (z <= 0.00017) tmp = y; else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.1e-7) tmp = y * z; elseif (z <= -4e-111) tmp = y; elseif (z <= -5e-224) tmp = x; elseif (z <= 1.7e-297) tmp = y; elseif (z <= 4.1e-249) tmp = x; elseif (z <= 7.5e-104) tmp = y; elseif (z <= 1.25e-40) tmp = x; elseif (z <= 0.00017) tmp = y; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.1e-7], N[(y * z), $MachinePrecision], If[LessEqual[z, -4e-111], y, If[LessEqual[z, -5e-224], x, If[LessEqual[z, 1.7e-297], y, If[LessEqual[z, 4.1e-249], x, If[LessEqual[z, 7.5e-104], y, If[LessEqual[z, 1.25e-40], x, If[LessEqual[z, 0.00017], y, N[(y * z), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{-7}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -4 \cdot 10^{-111}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-224}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-297}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{-249}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-104}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-40}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 0.00017:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -4.0999999999999999e-7 or 1.7e-4 < z Initial program 100.0%
Taylor expanded in x around 0 51.8%
+-commutative51.8%
distribute-lft-in51.8%
*-rgt-identity51.8%
Applied egg-rr51.8%
Taylor expanded in z around inf 49.3%
if -4.0999999999999999e-7 < z < -4.00000000000000035e-111 or -4.9999999999999999e-224 < z < 1.69999999999999991e-297 or 4.10000000000000004e-249 < z < 7.5e-104 or 1.24999999999999991e-40 < z < 1.7e-4Initial program 100.0%
Taylor expanded in x around 0 53.8%
Taylor expanded in z around 0 52.9%
if -4.00000000000000035e-111 < z < -4.9999999999999999e-224 or 1.69999999999999991e-297 < z < 4.10000000000000004e-249 or 7.5e-104 < z < 1.24999999999999991e-40Initial program 100.0%
Taylor expanded in x around inf 68.0%
Taylor expanded in z around 0 68.0%
Final simplification53.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ z 1.0))))
(if (<= z -1.7e+231)
(* y z)
(if (<= z -1.7e+148)
(* x z)
(if (<= z -4.1e+73)
(* y z)
(if (<= z -2.7e-9)
t_0
(if (<= z 9.2e-7) (+ x y) (if (<= z 6e+191) t_0 (* y z)))))))))
double code(double x, double y, double z) {
double t_0 = x * (z + 1.0);
double tmp;
if (z <= -1.7e+231) {
tmp = y * z;
} else if (z <= -1.7e+148) {
tmp = x * z;
} else if (z <= -4.1e+73) {
tmp = y * z;
} else if (z <= -2.7e-9) {
tmp = t_0;
} else if (z <= 9.2e-7) {
tmp = x + y;
} else if (z <= 6e+191) {
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 <= (-1.7d+231)) then
tmp = y * z
else if (z <= (-1.7d+148)) then
tmp = x * z
else if (z <= (-4.1d+73)) then
tmp = y * z
else if (z <= (-2.7d-9)) then
tmp = t_0
else if (z <= 9.2d-7) then
tmp = x + y
else if (z <= 6d+191) 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 <= -1.7e+231) {
tmp = y * z;
} else if (z <= -1.7e+148) {
tmp = x * z;
} else if (z <= -4.1e+73) {
tmp = y * z;
} else if (z <= -2.7e-9) {
tmp = t_0;
} else if (z <= 9.2e-7) {
tmp = x + y;
} else if (z <= 6e+191) {
tmp = t_0;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z + 1.0) tmp = 0 if z <= -1.7e+231: tmp = y * z elif z <= -1.7e+148: tmp = x * z elif z <= -4.1e+73: tmp = y * z elif z <= -2.7e-9: tmp = t_0 elif z <= 9.2e-7: tmp = x + y elif z <= 6e+191: 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 <= -1.7e+231) tmp = Float64(y * z); elseif (z <= -1.7e+148) tmp = Float64(x * z); elseif (z <= -4.1e+73) tmp = Float64(y * z); elseif (z <= -2.7e-9) tmp = t_0; elseif (z <= 9.2e-7) tmp = Float64(x + y); elseif (z <= 6e+191) 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 <= -1.7e+231) tmp = y * z; elseif (z <= -1.7e+148) tmp = x * z; elseif (z <= -4.1e+73) tmp = y * z; elseif (z <= -2.7e-9) tmp = t_0; elseif (z <= 9.2e-7) tmp = x + y; elseif (z <= 6e+191) 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, -1.7e+231], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.7e+148], N[(x * z), $MachinePrecision], If[LessEqual[z, -4.1e+73], N[(y * z), $MachinePrecision], If[LessEqual[z, -2.7e-9], t$95$0, If[LessEqual[z, 9.2e-7], N[(x + y), $MachinePrecision], If[LessEqual[z, 6e+191], 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 -1.7 \cdot 10^{+231}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{+148}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -4.1 \cdot 10^{+73}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-9}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-7}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+191}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1.7e231 or -1.7000000000000001e148 < z < -4.0999999999999998e73 or 5.9999999999999995e191 < z Initial program 100.0%
Taylor expanded in x around 0 55.8%
+-commutative55.8%
distribute-lft-in55.8%
*-rgt-identity55.8%
Applied egg-rr55.8%
Taylor expanded in z around inf 55.8%
if -1.7e231 < z < -1.7000000000000001e148Initial program 100.0%
*-commutative100.0%
+-commutative100.0%
distribute-lft-in100.0%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in y around 0 63.2%
*-commutative63.2%
Simplified63.2%
if -4.0999999999999998e73 < z < -2.7000000000000002e-9 or 9.1999999999999998e-7 < z < 5.9999999999999995e191Initial program 100.0%
Taylor expanded in x around inf 49.2%
if -2.7000000000000002e-9 < z < 9.1999999999999998e-7Initial program 100.0%
Taylor expanded in z around 0 99.5%
+-commutative99.5%
Simplified99.5%
Final simplification75.4%
(FPCore (x y z)
:precision binary64
(if (<= z -1.35e+231)
(* y z)
(if (<= z -1.7e+148)
(* x z)
(if (<= z -4.8e+72)
(* y z)
(if (<= z -1.0)
(* x z)
(if (<= z 660.0) (+ x y) (if (<= z 6.6e+190) (* x z) (* y z))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.35e+231) {
tmp = y * z;
} else if (z <= -1.7e+148) {
tmp = x * z;
} else if (z <= -4.8e+72) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 660.0) {
tmp = x + y;
} else if (z <= 6.6e+190) {
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.35d+231)) then
tmp = y * z
else if (z <= (-1.7d+148)) then
tmp = x * z
else if (z <= (-4.8d+72)) then
tmp = y * z
else if (z <= (-1.0d0)) then
tmp = x * z
else if (z <= 660.0d0) then
tmp = x + y
else if (z <= 6.6d+190) 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.35e+231) {
tmp = y * z;
} else if (z <= -1.7e+148) {
tmp = x * z;
} else if (z <= -4.8e+72) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 660.0) {
tmp = x + y;
} else if (z <= 6.6e+190) {
tmp = x * z;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.35e+231: tmp = y * z elif z <= -1.7e+148: tmp = x * z elif z <= -4.8e+72: tmp = y * z elif z <= -1.0: tmp = x * z elif z <= 660.0: tmp = x + y elif z <= 6.6e+190: tmp = x * z else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.35e+231) tmp = Float64(y * z); elseif (z <= -1.7e+148) tmp = Float64(x * z); elseif (z <= -4.8e+72) tmp = Float64(y * z); elseif (z <= -1.0) tmp = Float64(x * z); elseif (z <= 660.0) tmp = Float64(x + y); elseif (z <= 6.6e+190) 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.35e+231) tmp = y * z; elseif (z <= -1.7e+148) tmp = x * z; elseif (z <= -4.8e+72) tmp = y * z; elseif (z <= -1.0) tmp = x * z; elseif (z <= 660.0) tmp = x + y; elseif (z <= 6.6e+190) tmp = x * z; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.35e+231], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.7e+148], N[(x * z), $MachinePrecision], If[LessEqual[z, -4.8e+72], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 660.0], N[(x + y), $MachinePrecision], If[LessEqual[z, 6.6e+190], N[(x * z), $MachinePrecision], N[(y * z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+231}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{+148}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{+72}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 660:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+190}:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1.35e231 or -1.7000000000000001e148 < z < -4.8000000000000002e72 or 6.6e190 < z Initial program 100.0%
Taylor expanded in x around 0 55.8%
+-commutative55.8%
distribute-lft-in55.8%
*-rgt-identity55.8%
Applied egg-rr55.8%
Taylor expanded in z around inf 55.8%
if -1.35e231 < z < -1.7000000000000001e148 or -4.8000000000000002e72 < z < -1 or 660 < z < 6.6e190Initial program 100.0%
*-commutative100.0%
+-commutative100.0%
distribute-lft-in100.0%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 99.2%
Taylor expanded in y around 0 51.6%
*-commutative51.6%
Simplified51.6%
if -1 < z < 660Initial program 100.0%
Taylor expanded in z around 0 97.1%
+-commutative97.1%
Simplified97.1%
Final simplification74.8%
(FPCore (x y z)
:precision binary64
(if (<= y -4e-32)
x
(if (<= y -1.12e-125)
(* x z)
(if (<= y -2.05e-184)
x
(if (<= y 1.8e-53) (* x z) (if (<= y 1.78e+59) y (* y z)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4e-32) {
tmp = x;
} else if (y <= -1.12e-125) {
tmp = x * z;
} else if (y <= -2.05e-184) {
tmp = x;
} else if (y <= 1.8e-53) {
tmp = x * z;
} else if (y <= 1.78e+59) {
tmp = y;
} 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 (y <= (-4d-32)) then
tmp = x
else if (y <= (-1.12d-125)) then
tmp = x * z
else if (y <= (-2.05d-184)) then
tmp = x
else if (y <= 1.8d-53) then
tmp = x * z
else if (y <= 1.78d+59) then
tmp = y
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4e-32) {
tmp = x;
} else if (y <= -1.12e-125) {
tmp = x * z;
} else if (y <= -2.05e-184) {
tmp = x;
} else if (y <= 1.8e-53) {
tmp = x * z;
} else if (y <= 1.78e+59) {
tmp = y;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4e-32: tmp = x elif y <= -1.12e-125: tmp = x * z elif y <= -2.05e-184: tmp = x elif y <= 1.8e-53: tmp = x * z elif y <= 1.78e+59: tmp = y else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4e-32) tmp = x; elseif (y <= -1.12e-125) tmp = Float64(x * z); elseif (y <= -2.05e-184) tmp = x; elseif (y <= 1.8e-53) tmp = Float64(x * z); elseif (y <= 1.78e+59) tmp = y; else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4e-32) tmp = x; elseif (y <= -1.12e-125) tmp = x * z; elseif (y <= -2.05e-184) tmp = x; elseif (y <= 1.8e-53) tmp = x * z; elseif (y <= 1.78e+59) tmp = y; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4e-32], x, If[LessEqual[y, -1.12e-125], N[(x * z), $MachinePrecision], If[LessEqual[y, -2.05e-184], x, If[LessEqual[y, 1.8e-53], N[(x * z), $MachinePrecision], If[LessEqual[y, 1.78e+59], y, N[(y * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-32}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.12 \cdot 10^{-125}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;y \leq -2.05 \cdot 10^{-184}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-53}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;y \leq 1.78 \cdot 10^{+59}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if y < -4.00000000000000022e-32 or -1.11999999999999997e-125 < y < -2.05e-184Initial program 100.0%
Taylor expanded in x around inf 42.1%
Taylor expanded in z around 0 21.9%
if -4.00000000000000022e-32 < y < -1.11999999999999997e-125 or -2.05e-184 < y < 1.7999999999999999e-53Initial program 100.0%
*-commutative100.0%
+-commutative100.0%
distribute-lft-in100.0%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 60.5%
Taylor expanded in y around 0 40.6%
*-commutative40.6%
Simplified40.6%
if 1.7999999999999999e-53 < y < 1.78e59Initial program 99.9%
Taylor expanded in x around 0 43.2%
Taylor expanded in z around 0 29.6%
if 1.78e59 < y Initial program 99.9%
Taylor expanded in x around 0 84.1%
+-commutative84.1%
distribute-lft-in84.1%
*-rgt-identity84.1%
Applied egg-rr84.1%
Taylor expanded in z around inf 47.3%
Final simplification35.4%
(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 97.2%
+-commutative97.2%
Simplified97.2%
if -1 < z < 1Initial program 100.0%
Taylor expanded in z around 0 97.8%
+-commutative97.8%
Simplified97.8%
Final simplification97.5%
(FPCore (x y z) :precision binary64 (if (<= y 2.5e-84) (* x (+ z 1.0)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.5e-84) {
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 <= 2.5d-84) 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 <= 2.5e-84) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.5e-84: tmp = x * (z + 1.0) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.5e-84) 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 <= 2.5e-84) tmp = x * (z + 1.0); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.5e-84], 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 2.5 \cdot 10^{-84}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if y < 2.5000000000000001e-84Initial program 100.0%
Taylor expanded in x around inf 64.2%
if 2.5000000000000001e-84 < y Initial program 99.9%
Taylor expanded in x around 0 66.8%
Final simplification65.1%
(FPCore (x y z) :precision binary64 (if (<= y 4.1e-81) x y))
double code(double x, double y, double z) {
double tmp;
if (y <= 4.1e-81) {
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 <= 4.1d-81) 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 <= 4.1e-81) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4.1e-81: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4.1e-81) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 4.1e-81) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4.1e-81], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.1 \cdot 10^{-81}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 4.09999999999999984e-81Initial program 100.0%
Taylor expanded in x around inf 63.5%
Taylor expanded in z around 0 32.4%
if 4.09999999999999984e-81 < y Initial program 99.9%
Taylor expanded in x around 0 66.1%
Taylor expanded in z around 0 33.6%
Final simplification32.8%
(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 53.8%
Taylor expanded in z around 0 28.3%
Final simplification28.3%
herbie shell --seed 2024031
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))