
(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 -6.0)
(* x z)
(if (<= z 1.8e-124)
x
(if (<= z 2e-75)
y
(if (<= z 10000.0)
x
(if (or (<= z 4e+77) (not (<= z 1.03e+130))) (* x z) (* y z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.0) {
tmp = x * z;
} else if (z <= 1.8e-124) {
tmp = x;
} else if (z <= 2e-75) {
tmp = y;
} else if (z <= 10000.0) {
tmp = x;
} else if ((z <= 4e+77) || !(z <= 1.03e+130)) {
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 <= (-6.0d0)) then
tmp = x * z
else if (z <= 1.8d-124) then
tmp = x
else if (z <= 2d-75) then
tmp = y
else if (z <= 10000.0d0) then
tmp = x
else if ((z <= 4d+77) .or. (.not. (z <= 1.03d+130))) 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 <= -6.0) {
tmp = x * z;
} else if (z <= 1.8e-124) {
tmp = x;
} else if (z <= 2e-75) {
tmp = y;
} else if (z <= 10000.0) {
tmp = x;
} else if ((z <= 4e+77) || !(z <= 1.03e+130)) {
tmp = x * z;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.0: tmp = x * z elif z <= 1.8e-124: tmp = x elif z <= 2e-75: tmp = y elif z <= 10000.0: tmp = x elif (z <= 4e+77) or not (z <= 1.03e+130): tmp = x * z else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.0) tmp = Float64(x * z); elseif (z <= 1.8e-124) tmp = x; elseif (z <= 2e-75) tmp = y; elseif (z <= 10000.0) tmp = x; elseif ((z <= 4e+77) || !(z <= 1.03e+130)) 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 <= -6.0) tmp = x * z; elseif (z <= 1.8e-124) tmp = x; elseif (z <= 2e-75) tmp = y; elseif (z <= 10000.0) tmp = x; elseif ((z <= 4e+77) || ~((z <= 1.03e+130))) tmp = x * z; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 1.8e-124], x, If[LessEqual[z, 2e-75], y, If[LessEqual[z, 10000.0], x, If[Or[LessEqual[z, 4e+77], N[Not[LessEqual[z, 1.03e+130]], $MachinePrecision]], N[(x * z), $MachinePrecision], N[(y * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-124}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-75}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 10000:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+77} \lor \neg \left(z \leq 1.03 \cdot 10^{+130}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -6 or 1e4 < z < 3.99999999999999993e77 or 1.03e130 < z Initial program 100.0%
Taylor expanded in x around inf 57.7%
+-commutative57.7%
distribute-lft-in57.7%
*-rgt-identity57.7%
Applied egg-rr57.7%
Taylor expanded in z around inf 57.2%
if -6 < z < 1.80000000000000005e-124 or 1.9999999999999999e-75 < z < 1e4Initial program 100.0%
Taylor expanded in x around inf 54.1%
Taylor expanded in z around 0 51.7%
if 1.80000000000000005e-124 < z < 1.9999999999999999e-75Initial program 100.0%
Taylor expanded in x around 0 72.0%
Taylor expanded in z around 0 72.0%
if 3.99999999999999993e77 < z < 1.03e130Initial program 100.0%
Taylor expanded in x around 0 69.4%
+-commutative69.4%
distribute-lft-in69.4%
*-rgt-identity69.4%
Applied egg-rr69.4%
Taylor expanded in z around inf 69.4%
*-commutative69.4%
Simplified69.4%
Final simplification55.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ z 1.0))))
(if (<= z -1.45e-9)
t_0
(if (<= z 8.5e-10)
(+ x y)
(if (or (<= z 4.1e+77) (not (<= z 5.8e+126))) t_0 (* y z))))))
double code(double x, double y, double z) {
double t_0 = x * (z + 1.0);
double tmp;
if (z <= -1.45e-9) {
tmp = t_0;
} else if (z <= 8.5e-10) {
tmp = x + y;
} else if ((z <= 4.1e+77) || !(z <= 5.8e+126)) {
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.45d-9)) then
tmp = t_0
else if (z <= 8.5d-10) then
tmp = x + y
else if ((z <= 4.1d+77) .or. (.not. (z <= 5.8d+126))) 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.45e-9) {
tmp = t_0;
} else if (z <= 8.5e-10) {
tmp = x + y;
} else if ((z <= 4.1e+77) || !(z <= 5.8e+126)) {
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.45e-9: tmp = t_0 elif z <= 8.5e-10: tmp = x + y elif (z <= 4.1e+77) or not (z <= 5.8e+126): 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.45e-9) tmp = t_0; elseif (z <= 8.5e-10) tmp = Float64(x + y); elseif ((z <= 4.1e+77) || !(z <= 5.8e+126)) 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.45e-9) tmp = t_0; elseif (z <= 8.5e-10) tmp = x + y; elseif ((z <= 4.1e+77) || ~((z <= 5.8e+126))) 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.45e-9], t$95$0, If[LessEqual[z, 8.5e-10], N[(x + y), $MachinePrecision], If[Or[LessEqual[z, 4.1e+77], N[Not[LessEqual[z, 5.8e+126]], $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 -1.45 \cdot 10^{-9}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-10}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{+77} \lor \neg \left(z \leq 5.8 \cdot 10^{+126}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1.44999999999999996e-9 or 8.4999999999999996e-10 < z < 4.1000000000000001e77 or 5.79999999999999971e126 < z Initial program 100.0%
Taylor expanded in x around inf 57.4%
if -1.44999999999999996e-9 < z < 8.4999999999999996e-10Initial program 100.0%
Taylor expanded in z around 0 99.6%
+-commutative99.6%
Simplified99.6%
if 4.1000000000000001e77 < z < 5.79999999999999971e126Initial program 100.0%
Taylor expanded in x around 0 69.4%
+-commutative69.4%
distribute-lft-in69.4%
*-rgt-identity69.4%
Applied egg-rr69.4%
Taylor expanded in z around inf 69.4%
*-commutative69.4%
Simplified69.4%
Final simplification78.4%
(FPCore (x y z)
:precision binary64
(if (<= z -1.0)
(* x z)
(if (<= z 10000.0)
(+ x y)
(if (or (<= z 4.35e+77) (not (<= z 8.5e+133))) (* x z) (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= 10000.0) {
tmp = x + y;
} else if ((z <= 4.35e+77) || !(z <= 8.5e+133)) {
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 <= 10000.0d0) then
tmp = x + y
else if ((z <= 4.35d+77) .or. (.not. (z <= 8.5d+133))) 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 <= 10000.0) {
tmp = x + y;
} else if ((z <= 4.35e+77) || !(z <= 8.5e+133)) {
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 <= 10000.0: tmp = x + y elif (z <= 4.35e+77) or not (z <= 8.5e+133): 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 <= 10000.0) tmp = Float64(x + y); elseif ((z <= 4.35e+77) || !(z <= 8.5e+133)) 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 <= 10000.0) tmp = x + y; elseif ((z <= 4.35e+77) || ~((z <= 8.5e+133))) 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, 10000.0], N[(x + y), $MachinePrecision], If[Or[LessEqual[z, 4.35e+77], N[Not[LessEqual[z, 8.5e+133]], $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 10000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 4.35 \cdot 10^{+77} \lor \neg \left(z \leq 8.5 \cdot 10^{+133}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1 or 1e4 < z < 4.3500000000000003e77 or 8.50000000000000044e133 < z Initial program 100.0%
Taylor expanded in x around inf 58.5%
+-commutative58.5%
distribute-lft-in58.5%
*-rgt-identity58.5%
Applied egg-rr58.5%
Taylor expanded in z around inf 56.5%
if -1 < z < 1e4Initial program 100.0%
Taylor expanded in z around 0 97.8%
+-commutative97.8%
Simplified97.8%
if 4.3500000000000003e77 < z < 8.50000000000000044e133Initial program 100.0%
Taylor expanded in x around 0 69.4%
+-commutative69.4%
distribute-lft-in69.4%
*-rgt-identity69.4%
Applied egg-rr69.4%
Taylor expanded in z around inf 69.4%
*-commutative69.4%
Simplified69.4%
Final simplification77.8%
(FPCore (x y z)
:precision binary64
(if (<= z -6.0)
(* x z)
(if (<= z 2.25e-124)
x
(if (<= z 3.2e-72) y (if (<= z 10000.0) x (* x z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.0) {
tmp = x * z;
} else if (z <= 2.25e-124) {
tmp = x;
} else if (z <= 3.2e-72) {
tmp = y;
} else if (z <= 10000.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 <= (-6.0d0)) then
tmp = x * z
else if (z <= 2.25d-124) then
tmp = x
else if (z <= 3.2d-72) then
tmp = y
else if (z <= 10000.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 <= -6.0) {
tmp = x * z;
} else if (z <= 2.25e-124) {
tmp = x;
} else if (z <= 3.2e-72) {
tmp = y;
} else if (z <= 10000.0) {
tmp = x;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.0: tmp = x * z elif z <= 2.25e-124: tmp = x elif z <= 3.2e-72: tmp = y elif z <= 10000.0: tmp = x else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.0) tmp = Float64(x * z); elseif (z <= 2.25e-124) tmp = x; elseif (z <= 3.2e-72) tmp = y; elseif (z <= 10000.0) tmp = x; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6.0) tmp = x * z; elseif (z <= 2.25e-124) tmp = x; elseif (z <= 3.2e-72) tmp = y; elseif (z <= 10000.0) tmp = x; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 2.25e-124], x, If[LessEqual[z, 3.2e-72], y, If[LessEqual[z, 10000.0], x, N[(x * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-124}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-72}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 10000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -6 or 1e4 < z Initial program 100.0%
Taylor expanded in x around inf 54.8%
+-commutative54.8%
distribute-lft-in54.8%
*-rgt-identity54.8%
Applied egg-rr54.8%
Taylor expanded in z around inf 54.4%
if -6 < z < 2.2499999999999998e-124 or 3.19999999999999999e-72 < z < 1e4Initial program 100.0%
Taylor expanded in x around inf 54.1%
Taylor expanded in z around 0 51.7%
if 2.2499999999999998e-124 < z < 3.19999999999999999e-72Initial program 100.0%
Taylor expanded in x around 0 72.0%
Taylor expanded in z around 0 72.0%
Final simplification53.6%
(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.0%
+-commutative97.0%
Simplified97.0%
if -1 < z < 1Initial program 100.0%
Taylor expanded in z around 0 98.5%
+-commutative98.5%
Simplified98.5%
Final simplification97.7%
(FPCore (x y z) :precision binary64 (if (<= y 8.2e-63) (* x (+ z 1.0)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= 8.2e-63) {
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 <= 8.2d-63) 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 <= 8.2e-63) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 8.2e-63: tmp = x * (z + 1.0) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 8.2e-63) 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 <= 8.2e-63) tmp = x * (z + 1.0); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 8.2e-63], 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.2 \cdot 10^{-63}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if y < 8.1999999999999995e-63Initial program 100.0%
Taylor expanded in x around inf 63.0%
if 8.1999999999999995e-63 < y Initial program 100.0%
Taylor expanded in x around 0 76.7%
Final simplification66.6%
(FPCore (x y z) :precision binary64 (if (<= y 4500000.0) x y))
double code(double x, double y, double z) {
double tmp;
if (y <= 4500000.0) {
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 <= 4500000.0d0) 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 <= 4500000.0) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4500000.0: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4500000.0) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 4500000.0) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4500000.0], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4500000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 4.5e6Initial program 100.0%
Taylor expanded in x around inf 62.4%
Taylor expanded in z around 0 30.4%
if 4.5e6 < y Initial program 100.0%
Taylor expanded in x around 0 82.1%
Taylor expanded in z around 0 36.7%
Final simplification31.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 26.9%
Final simplification26.9%
herbie shell --seed 2024018
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))