
(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 (* (+ z 1.0) (+ x y)))
double code(double x, double y, double z) {
return (z + 1.0) * (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 = (z + 1.0d0) * (x + y)
end function
public static double code(double x, double y, double z) {
return (z + 1.0) * (x + y);
}
def code(x, y, z): return (z + 1.0) * (x + y)
function code(x, y, z) return Float64(Float64(z + 1.0) * Float64(x + y)) end
function tmp = code(x, y, z) tmp = (z + 1.0) * (x + y); end
code[x_, y_, z_] := N[(N[(z + 1.0), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(z + 1\right) \cdot \left(x + y\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= z -5.6e+96)
(* y z)
(if (<= z -7.2e+64)
(* x z)
(if (<= z -1.0)
(* y z)
(if (<= z 2.5e-241)
x
(if (<= z 1.1e-53)
y
(if (<= z 0.55)
x
(if (or (<= z 880000.0)
(and (not (<= z 9.8e+70)) (<= z 1.45e+135)))
(* y z)
(* x z)))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.6e+96) {
tmp = y * z;
} else if (z <= -7.2e+64) {
tmp = x * z;
} else if (z <= -1.0) {
tmp = y * z;
} else if (z <= 2.5e-241) {
tmp = x;
} else if (z <= 1.1e-53) {
tmp = y;
} else if (z <= 0.55) {
tmp = x;
} else if ((z <= 880000.0) || (!(z <= 9.8e+70) && (z <= 1.45e+135))) {
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 <= (-5.6d+96)) then
tmp = y * z
else if (z <= (-7.2d+64)) then
tmp = x * z
else if (z <= (-1.0d0)) then
tmp = y * z
else if (z <= 2.5d-241) then
tmp = x
else if (z <= 1.1d-53) then
tmp = y
else if (z <= 0.55d0) then
tmp = x
else if ((z <= 880000.0d0) .or. (.not. (z <= 9.8d+70)) .and. (z <= 1.45d+135)) 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 <= -5.6e+96) {
tmp = y * z;
} else if (z <= -7.2e+64) {
tmp = x * z;
} else if (z <= -1.0) {
tmp = y * z;
} else if (z <= 2.5e-241) {
tmp = x;
} else if (z <= 1.1e-53) {
tmp = y;
} else if (z <= 0.55) {
tmp = x;
} else if ((z <= 880000.0) || (!(z <= 9.8e+70) && (z <= 1.45e+135))) {
tmp = y * z;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.6e+96: tmp = y * z elif z <= -7.2e+64: tmp = x * z elif z <= -1.0: tmp = y * z elif z <= 2.5e-241: tmp = x elif z <= 1.1e-53: tmp = y elif z <= 0.55: tmp = x elif (z <= 880000.0) or (not (z <= 9.8e+70) and (z <= 1.45e+135)): tmp = y * z else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.6e+96) tmp = Float64(y * z); elseif (z <= -7.2e+64) tmp = Float64(x * z); elseif (z <= -1.0) tmp = Float64(y * z); elseif (z <= 2.5e-241) tmp = x; elseif (z <= 1.1e-53) tmp = y; elseif (z <= 0.55) tmp = x; elseif ((z <= 880000.0) || (!(z <= 9.8e+70) && (z <= 1.45e+135))) 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 <= -5.6e+96) tmp = y * z; elseif (z <= -7.2e+64) tmp = x * z; elseif (z <= -1.0) tmp = y * z; elseif (z <= 2.5e-241) tmp = x; elseif (z <= 1.1e-53) tmp = y; elseif (z <= 0.55) tmp = x; elseif ((z <= 880000.0) || (~((z <= 9.8e+70)) && (z <= 1.45e+135))) tmp = y * z; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.6e+96], N[(y * z), $MachinePrecision], If[LessEqual[z, -7.2e+64], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.0], N[(y * z), $MachinePrecision], If[LessEqual[z, 2.5e-241], x, If[LessEqual[z, 1.1e-53], y, If[LessEqual[z, 0.55], x, If[Or[LessEqual[z, 880000.0], And[N[Not[LessEqual[z, 9.8e+70]], $MachinePrecision], LessEqual[z, 1.45e+135]]], N[(y * z), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{+96}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -7.2 \cdot 10^{+64}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-241}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-53}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 0.55:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 880000 \lor \neg \left(z \leq 9.8 \cdot 10^{+70}\right) \land z \leq 1.45 \cdot 10^{+135}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -5.59999999999999999e96 or -7.20000000000000027e64 < z < -1 or 0.55000000000000004 < z < 8.8e5 or 9.80000000000000056e70 < z < 1.4499999999999999e135Initial program 100.0%
Taylor expanded in y around inf 86.0%
Taylor expanded in z around inf 85.2%
Taylor expanded in y around inf 46.6%
*-commutative46.6%
Simplified46.6%
if -5.59999999999999999e96 < z < -7.20000000000000027e64 or 8.8e5 < z < 9.80000000000000056e70 or 1.4499999999999999e135 < z Initial program 100.0%
Taylor expanded in z around inf 97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in x around inf 83.9%
Taylor expanded in x around inf 60.4%
*-commutative60.4%
Simplified60.4%
if -1 < z < 2.4999999999999999e-241 or 1.10000000000000009e-53 < z < 0.55000000000000004Initial program 100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 50.1%
+-commutative50.1%
Simplified50.1%
Taylor expanded in z around 0 46.7%
if 2.4999999999999999e-241 < z < 1.10000000000000009e-53Initial program 100.0%
Taylor expanded in x around 0 54.4%
Taylor expanded in z around 0 54.4%
Final simplification51.1%
(FPCore (x y z)
:precision binary64
(if (<= (+ z 1.0) -5e+97)
(* y z)
(if (<= (+ z 1.0) -5e+69)
(* x z)
(if (<= (+ z 1.0) -4.0)
(* y z)
(if (<= (+ z 1.0) 1.0)
(+ x y)
(if (or (<= (+ z 1.0) 1e+70) (not (<= (+ z 1.0) 2e+131)))
(* x (+ z 1.0))
(* y z)))))))
double code(double x, double y, double z) {
double tmp;
if ((z + 1.0) <= -5e+97) {
tmp = y * z;
} else if ((z + 1.0) <= -5e+69) {
tmp = x * z;
} else if ((z + 1.0) <= -4.0) {
tmp = y * z;
} else if ((z + 1.0) <= 1.0) {
tmp = x + y;
} else if (((z + 1.0) <= 1e+70) || !((z + 1.0) <= 2e+131)) {
tmp = x * (z + 1.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) :: tmp
if ((z + 1.0d0) <= (-5d+97)) then
tmp = y * z
else if ((z + 1.0d0) <= (-5d+69)) then
tmp = x * z
else if ((z + 1.0d0) <= (-4.0d0)) then
tmp = y * z
else if ((z + 1.0d0) <= 1.0d0) then
tmp = x + y
else if (((z + 1.0d0) <= 1d+70) .or. (.not. ((z + 1.0d0) <= 2d+131))) then
tmp = x * (z + 1.0d0)
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) <= -5e+97) {
tmp = y * z;
} else if ((z + 1.0) <= -5e+69) {
tmp = x * z;
} else if ((z + 1.0) <= -4.0) {
tmp = y * z;
} else if ((z + 1.0) <= 1.0) {
tmp = x + y;
} else if (((z + 1.0) <= 1e+70) || !((z + 1.0) <= 2e+131)) {
tmp = x * (z + 1.0);
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z + 1.0) <= -5e+97: tmp = y * z elif (z + 1.0) <= -5e+69: tmp = x * z elif (z + 1.0) <= -4.0: tmp = y * z elif (z + 1.0) <= 1.0: tmp = x + y elif ((z + 1.0) <= 1e+70) or not ((z + 1.0) <= 2e+131): tmp = x * (z + 1.0) else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z + 1.0) <= -5e+97) tmp = Float64(y * z); elseif (Float64(z + 1.0) <= -5e+69) tmp = Float64(x * z); elseif (Float64(z + 1.0) <= -4.0) tmp = Float64(y * z); elseif (Float64(z + 1.0) <= 1.0) tmp = Float64(x + y); elseif ((Float64(z + 1.0) <= 1e+70) || !(Float64(z + 1.0) <= 2e+131)) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z + 1.0) <= -5e+97) tmp = y * z; elseif ((z + 1.0) <= -5e+69) tmp = x * z; elseif ((z + 1.0) <= -4.0) tmp = y * z; elseif ((z + 1.0) <= 1.0) tmp = x + y; elseif (((z + 1.0) <= 1e+70) || ~(((z + 1.0) <= 2e+131))) tmp = x * (z + 1.0); else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z + 1.0), $MachinePrecision], -5e+97], N[(y * z), $MachinePrecision], If[LessEqual[N[(z + 1.0), $MachinePrecision], -5e+69], N[(x * z), $MachinePrecision], If[LessEqual[N[(z + 1.0), $MachinePrecision], -4.0], N[(y * z), $MachinePrecision], If[LessEqual[N[(z + 1.0), $MachinePrecision], 1.0], N[(x + y), $MachinePrecision], If[Or[LessEqual[N[(z + 1.0), $MachinePrecision], 1e+70], N[Not[LessEqual[N[(z + 1.0), $MachinePrecision], 2e+131]], $MachinePrecision]], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + 1 \leq -5 \cdot 10^{+97}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z + 1 \leq -5 \cdot 10^{+69}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z + 1 \leq -4:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z + 1 \leq 1:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z + 1 \leq 10^{+70} \lor \neg \left(z + 1 \leq 2 \cdot 10^{+131}\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if (+.f64 z #s(literal 1 binary64)) < -4.99999999999999999e97 or -5.00000000000000036e69 < (+.f64 z #s(literal 1 binary64)) < -4 or 1.00000000000000007e70 < (+.f64 z #s(literal 1 binary64)) < 1.9999999999999998e131Initial program 100.0%
Taylor expanded in y around inf 85.8%
Taylor expanded in z around inf 85.8%
Taylor expanded in y around inf 47.3%
*-commutative47.3%
Simplified47.3%
if -4.99999999999999999e97 < (+.f64 z #s(literal 1 binary64)) < -5.00000000000000036e69Initial program 100.0%
Taylor expanded in z around inf 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 84.9%
Taylor expanded in x around inf 66.8%
*-commutative66.8%
Simplified66.8%
if -4 < (+.f64 z #s(literal 1 binary64)) < 1Initial program 100.0%
Taylor expanded in z around 0 99.0%
+-commutative99.0%
Simplified99.0%
if 1 < (+.f64 z #s(literal 1 binary64)) < 1.00000000000000007e70 or 1.9999999999999998e131 < (+.f64 z #s(literal 1 binary64)) Initial program 99.9%
Taylor expanded in x around inf 65.2%
Final simplification77.1%
(FPCore (x y z)
:precision binary64
(if (<= z -5.9e+94)
(* y z)
(if (<= z -3.7e+66)
(* x z)
(if (<= z -1.0)
(* y z)
(if (<= z 440000.0)
(+ x y)
(if (or (<= z 1.55e+70) (not (<= z 6.8e+133))) (* x z) (* y z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.9e+94) {
tmp = y * z;
} else if (z <= -3.7e+66) {
tmp = x * z;
} else if (z <= -1.0) {
tmp = y * z;
} else if (z <= 440000.0) {
tmp = x + y;
} else if ((z <= 1.55e+70) || !(z <= 6.8e+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 <= (-5.9d+94)) then
tmp = y * z
else if (z <= (-3.7d+66)) then
tmp = x * z
else if (z <= (-1.0d0)) then
tmp = y * z
else if (z <= 440000.0d0) then
tmp = x + y
else if ((z <= 1.55d+70) .or. (.not. (z <= 6.8d+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 <= -5.9e+94) {
tmp = y * z;
} else if (z <= -3.7e+66) {
tmp = x * z;
} else if (z <= -1.0) {
tmp = y * z;
} else if (z <= 440000.0) {
tmp = x + y;
} else if ((z <= 1.55e+70) || !(z <= 6.8e+133)) {
tmp = x * z;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.9e+94: tmp = y * z elif z <= -3.7e+66: tmp = x * z elif z <= -1.0: tmp = y * z elif z <= 440000.0: tmp = x + y elif (z <= 1.55e+70) or not (z <= 6.8e+133): tmp = x * z else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.9e+94) tmp = Float64(y * z); elseif (z <= -3.7e+66) tmp = Float64(x * z); elseif (z <= -1.0) tmp = Float64(y * z); elseif (z <= 440000.0) tmp = Float64(x + y); elseif ((z <= 1.55e+70) || !(z <= 6.8e+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 <= -5.9e+94) tmp = y * z; elseif (z <= -3.7e+66) tmp = x * z; elseif (z <= -1.0) tmp = y * z; elseif (z <= 440000.0) tmp = x + y; elseif ((z <= 1.55e+70) || ~((z <= 6.8e+133))) tmp = x * z; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.9e+94], N[(y * z), $MachinePrecision], If[LessEqual[z, -3.7e+66], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.0], N[(y * z), $MachinePrecision], If[LessEqual[z, 440000.0], N[(x + y), $MachinePrecision], If[Or[LessEqual[z, 1.55e+70], N[Not[LessEqual[z, 6.8e+133]], $MachinePrecision]], N[(x * z), $MachinePrecision], N[(y * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.9 \cdot 10^{+94}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{+66}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 440000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+70} \lor \neg \left(z \leq 6.8 \cdot 10^{+133}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -5.8999999999999999e94 or -3.7e66 < z < -1 or 1.55000000000000015e70 < z < 6.79999999999999975e133Initial program 100.0%
Taylor expanded in y around inf 85.8%
Taylor expanded in z around inf 85.8%
Taylor expanded in y around inf 47.3%
*-commutative47.3%
Simplified47.3%
if -5.8999999999999999e94 < z < -3.7e66 or 4.4e5 < z < 1.55000000000000015e70 or 6.79999999999999975e133 < z Initial program 100.0%
Taylor expanded in z around inf 97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in x around inf 83.9%
Taylor expanded in x around inf 60.4%
*-commutative60.4%
Simplified60.4%
if -1 < z < 4.4e5Initial program 100.0%
Taylor expanded in z around 0 95.7%
+-commutative95.7%
Simplified95.7%
Final simplification75.3%
(FPCore (x y z)
:precision binary64
(if (<= z -5.3e-33)
(* x z)
(if (<= z 7.2e-242)
x
(if (<= z 3.1e-53) y (if (<= z 7.5e-5) x (if (<= z 0.28) y (* x z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.3e-33) {
tmp = x * z;
} else if (z <= 7.2e-242) {
tmp = x;
} else if (z <= 3.1e-53) {
tmp = y;
} else if (z <= 7.5e-5) {
tmp = x;
} else if (z <= 0.28) {
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 <= (-5.3d-33)) then
tmp = x * z
else if (z <= 7.2d-242) then
tmp = x
else if (z <= 3.1d-53) then
tmp = y
else if (z <= 7.5d-5) then
tmp = x
else if (z <= 0.28d0) 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 <= -5.3e-33) {
tmp = x * z;
} else if (z <= 7.2e-242) {
tmp = x;
} else if (z <= 3.1e-53) {
tmp = y;
} else if (z <= 7.5e-5) {
tmp = x;
} else if (z <= 0.28) {
tmp = y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.3e-33: tmp = x * z elif z <= 7.2e-242: tmp = x elif z <= 3.1e-53: tmp = y elif z <= 7.5e-5: tmp = x elif z <= 0.28: tmp = y else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.3e-33) tmp = Float64(x * z); elseif (z <= 7.2e-242) tmp = x; elseif (z <= 3.1e-53) tmp = y; elseif (z <= 7.5e-5) tmp = x; elseif (z <= 0.28) tmp = y; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.3e-33) tmp = x * z; elseif (z <= 7.2e-242) tmp = x; elseif (z <= 3.1e-53) tmp = y; elseif (z <= 7.5e-5) tmp = x; elseif (z <= 0.28) tmp = y; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.3e-33], N[(x * z), $MachinePrecision], If[LessEqual[z, 7.2e-242], x, If[LessEqual[z, 3.1e-53], y, If[LessEqual[z, 7.5e-5], x, If[LessEqual[z, 0.28], y, N[(x * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{-33}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-242}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-53}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-5}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 0.28:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -5.29999999999999968e-33 or 0.28000000000000003 < z Initial program 100.0%
Taylor expanded in z around inf 94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in x around inf 84.5%
Taylor expanded in x around inf 54.9%
*-commutative54.9%
Simplified54.9%
if -5.29999999999999968e-33 < z < 7.20000000000000028e-242 or 3.10000000000000015e-53 < z < 7.49999999999999934e-5Initial program 100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 49.4%
+-commutative49.4%
Simplified49.4%
Taylor expanded in z around 0 47.6%
if 7.20000000000000028e-242 < z < 3.10000000000000015e-53 or 7.49999999999999934e-5 < z < 0.28000000000000003Initial program 100.0%
Taylor expanded in x around 0 53.3%
Taylor expanded in z around 0 53.3%
Final simplification52.3%
(FPCore (x y z) :precision binary64 (if (or (<= (+ z 1.0) -4.0) (not (<= (+ z 1.0) 2.0))) (* z (+ x y)) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if (((z + 1.0) <= -4.0) || !((z + 1.0) <= 2.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) <= (-4.0d0)) .or. (.not. ((z + 1.0d0) <= 2.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) <= -4.0) || !((z + 1.0) <= 2.0)) {
tmp = z * (x + y);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((z + 1.0) <= -4.0) or not ((z + 1.0) <= 2.0): tmp = z * (x + y) else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(z + 1.0) <= -4.0) || !(Float64(z + 1.0) <= 2.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) <= -4.0) || ~(((z + 1.0) <= 2.0))) tmp = z * (x + y); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(z + 1.0), $MachinePrecision], -4.0], N[Not[LessEqual[N[(z + 1.0), $MachinePrecision], 2.0]], $MachinePrecision]], N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + 1 \leq -4 \lor \neg \left(z + 1 \leq 2\right):\\
\;\;\;\;z \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if (+.f64 z #s(literal 1 binary64)) < -4 or 2 < (+.f64 z #s(literal 1 binary64)) Initial program 100.0%
Taylor expanded in z around inf 96.9%
+-commutative96.9%
Simplified96.9%
if -4 < (+.f64 z #s(literal 1 binary64)) < 2Initial program 100.0%
Taylor expanded in z around 0 96.4%
+-commutative96.4%
Simplified96.4%
Final simplification96.6%
(FPCore (x y z) :precision binary64 (if (<= x -7.4e-47) (* x (+ z 1.0)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.4e-47) {
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 <= (-7.4d-47)) 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 <= -7.4e-47) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.4e-47: tmp = x * (z + 1.0) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.4e-47) 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 <= -7.4e-47) tmp = x * (z + 1.0); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.4e-47], 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 -7.4 \cdot 10^{-47}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -7.4000000000000001e-47Initial program 100.0%
Taylor expanded in x around inf 79.6%
if -7.4000000000000001e-47 < x Initial program 100.0%
Taylor expanded in x around 0 59.3%
Final simplification65.3%
(FPCore (x y z) :precision binary64 (if (<= x -5.5e-48) x y))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.5e-48) {
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 <= (-5.5d-48)) 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 <= -5.5e-48) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.5e-48: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.5e-48) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.5e-48) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.5e-48], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-48}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if x < -5.50000000000000047e-48Initial program 100.0%
+-commutative100.0%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 78.6%
+-commutative78.6%
Simplified78.6%
Taylor expanded in z around 0 33.7%
if -5.50000000000000047e-48 < x Initial program 100.0%
Taylor expanded in x around 0 59.0%
Taylor expanded in z around 0 33.6%
Final simplification33.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%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 54.0%
+-commutative54.0%
Simplified54.0%
Taylor expanded in z around 0 25.6%
Final simplification25.6%
herbie shell --seed 2024059
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))