
(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) (* (+ x y) z)))
double code(double x, double y, double z) {
return (x + y) + ((x + y) * z);
}
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) + ((x + y) * z)
end function
public static double code(double x, double y, double z) {
return (x + y) + ((x + y) * z);
}
def code(x, y, z): return (x + y) + ((x + y) * z)
function code(x, y, z) return Float64(Float64(x + y) + Float64(Float64(x + y) * z)) end
function tmp = code(x, y, z) tmp = (x + y) + ((x + y) * z); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] + N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) + \left(x + y\right) \cdot z
\end{array}
Initial program 100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
(FPCore (x y z)
:precision binary64
(if (<= z -43.0)
(* y z)
(if (<= z -1.3e-146)
y
(if (<= z 2.5e-293)
x
(if (<= z 3.6e-185)
y
(if (<= z 5.4e-11) x (if (<= z 2.8e+260) (* x z) (* y z))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -43.0) {
tmp = y * z;
} else if (z <= -1.3e-146) {
tmp = y;
} else if (z <= 2.5e-293) {
tmp = x;
} else if (z <= 3.6e-185) {
tmp = y;
} else if (z <= 5.4e-11) {
tmp = x;
} else if (z <= 2.8e+260) {
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 <= (-43.0d0)) then
tmp = y * z
else if (z <= (-1.3d-146)) then
tmp = y
else if (z <= 2.5d-293) then
tmp = x
else if (z <= 3.6d-185) then
tmp = y
else if (z <= 5.4d-11) then
tmp = x
else if (z <= 2.8d+260) 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 <= -43.0) {
tmp = y * z;
} else if (z <= -1.3e-146) {
tmp = y;
} else if (z <= 2.5e-293) {
tmp = x;
} else if (z <= 3.6e-185) {
tmp = y;
} else if (z <= 5.4e-11) {
tmp = x;
} else if (z <= 2.8e+260) {
tmp = x * z;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -43.0: tmp = y * z elif z <= -1.3e-146: tmp = y elif z <= 2.5e-293: tmp = x elif z <= 3.6e-185: tmp = y elif z <= 5.4e-11: tmp = x elif z <= 2.8e+260: tmp = x * z else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -43.0) tmp = Float64(y * z); elseif (z <= -1.3e-146) tmp = y; elseif (z <= 2.5e-293) tmp = x; elseif (z <= 3.6e-185) tmp = y; elseif (z <= 5.4e-11) tmp = x; elseif (z <= 2.8e+260) 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 <= -43.0) tmp = y * z; elseif (z <= -1.3e-146) tmp = y; elseif (z <= 2.5e-293) tmp = x; elseif (z <= 3.6e-185) tmp = y; elseif (z <= 5.4e-11) tmp = x; elseif (z <= 2.8e+260) tmp = x * z; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -43.0], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.3e-146], y, If[LessEqual[z, 2.5e-293], x, If[LessEqual[z, 3.6e-185], y, If[LessEqual[z, 5.4e-11], x, If[LessEqual[z, 2.8e+260], N[(x * z), $MachinePrecision], N[(y * z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -43:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-146}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-293}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-185}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{-11}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+260}:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -43 or 2.7999999999999998e260 < z Initial program 100.0%
Taylor expanded in z around inf 96.3%
Taylor expanded in x around 0 49.2%
if -43 < z < -1.29999999999999993e-146 or 2.5000000000000001e-293 < z < 3.5999999999999998e-185Initial program 100.0%
Taylor expanded in z around 0 94.8%
+-commutative94.8%
Simplified94.8%
Taylor expanded in y around inf 53.7%
if -1.29999999999999993e-146 < z < 2.5000000000000001e-293 or 3.5999999999999998e-185 < z < 5.40000000000000009e-11Initial program 100.0%
Taylor expanded in z around 0 99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 56.2%
if 5.40000000000000009e-11 < z < 2.7999999999999998e260Initial program 100.0%
Taylor expanded in z around inf 97.3%
Taylor expanded in x around inf 48.1%
*-commutative48.1%
Simplified48.1%
Final simplification51.9%
(FPCore (x y z)
:precision binary64
(if (<= z -43.0)
(* y z)
(if (<= z -3.95e-146)
y
(if (<= z 2.8e-294)
x
(if (<= z 6.8e-182) y (if (<= z 5.4e-11) x (* y z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -43.0) {
tmp = y * z;
} else if (z <= -3.95e-146) {
tmp = y;
} else if (z <= 2.8e-294) {
tmp = x;
} else if (z <= 6.8e-182) {
tmp = y;
} else if (z <= 5.4e-11) {
tmp = x;
} 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 <= (-43.0d0)) then
tmp = y * z
else if (z <= (-3.95d-146)) then
tmp = y
else if (z <= 2.8d-294) then
tmp = x
else if (z <= 6.8d-182) then
tmp = y
else if (z <= 5.4d-11) then
tmp = x
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -43.0) {
tmp = y * z;
} else if (z <= -3.95e-146) {
tmp = y;
} else if (z <= 2.8e-294) {
tmp = x;
} else if (z <= 6.8e-182) {
tmp = y;
} else if (z <= 5.4e-11) {
tmp = x;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -43.0: tmp = y * z elif z <= -3.95e-146: tmp = y elif z <= 2.8e-294: tmp = x elif z <= 6.8e-182: tmp = y elif z <= 5.4e-11: tmp = x else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -43.0) tmp = Float64(y * z); elseif (z <= -3.95e-146) tmp = y; elseif (z <= 2.8e-294) tmp = x; elseif (z <= 6.8e-182) tmp = y; elseif (z <= 5.4e-11) tmp = x; else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -43.0) tmp = y * z; elseif (z <= -3.95e-146) tmp = y; elseif (z <= 2.8e-294) tmp = x; elseif (z <= 6.8e-182) tmp = y; elseif (z <= 5.4e-11) tmp = x; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -43.0], N[(y * z), $MachinePrecision], If[LessEqual[z, -3.95e-146], y, If[LessEqual[z, 2.8e-294], x, If[LessEqual[z, 6.8e-182], y, If[LessEqual[z, 5.4e-11], x, N[(y * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -43:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -3.95 \cdot 10^{-146}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-294}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-182}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{-11}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -43 or 5.40000000000000009e-11 < z Initial program 100.0%
Taylor expanded in z around inf 96.8%
Taylor expanded in x around 0 51.2%
if -43 < z < -3.95000000000000006e-146 or 2.79999999999999991e-294 < z < 6.79999999999999979e-182Initial program 100.0%
Taylor expanded in z around 0 94.8%
+-commutative94.8%
Simplified94.8%
Taylor expanded in y around inf 53.7%
if -3.95000000000000006e-146 < z < 2.79999999999999991e-294 or 6.79999999999999979e-182 < z < 5.40000000000000009e-11Initial program 100.0%
Taylor expanded in z around 0 99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 56.2%
(FPCore (x y z)
:precision binary64
(if (<= (+ z 1.0) -40.0)
(* y z)
(if (<= (+ z 1.0) 100.0)
(+ x y)
(if (<= (+ z 1.0) 1e+260) (* x (+ z 1.0)) (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z + 1.0) <= -40.0) {
tmp = y * z;
} else if ((z + 1.0) <= 100.0) {
tmp = x + y;
} else if ((z + 1.0) <= 1e+260) {
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) <= (-40.0d0)) then
tmp = y * z
else if ((z + 1.0d0) <= 100.0d0) then
tmp = x + y
else if ((z + 1.0d0) <= 1d+260) 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) <= -40.0) {
tmp = y * z;
} else if ((z + 1.0) <= 100.0) {
tmp = x + y;
} else if ((z + 1.0) <= 1e+260) {
tmp = x * (z + 1.0);
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z + 1.0) <= -40.0: tmp = y * z elif (z + 1.0) <= 100.0: tmp = x + y elif (z + 1.0) <= 1e+260: tmp = x * (z + 1.0) else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z + 1.0) <= -40.0) tmp = Float64(y * z); elseif (Float64(z + 1.0) <= 100.0) tmp = Float64(x + y); elseif (Float64(z + 1.0) <= 1e+260) 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) <= -40.0) tmp = y * z; elseif ((z + 1.0) <= 100.0) tmp = x + y; elseif ((z + 1.0) <= 1e+260) 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], -40.0], N[(y * z), $MachinePrecision], If[LessEqual[N[(z + 1.0), $MachinePrecision], 100.0], N[(x + y), $MachinePrecision], If[LessEqual[N[(z + 1.0), $MachinePrecision], 1e+260], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + 1 \leq -40:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z + 1 \leq 100:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z + 1 \leq 10^{+260}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if (+.f64 z #s(literal 1 binary64)) < -40 or 1.00000000000000007e260 < (+.f64 z #s(literal 1 binary64)) Initial program 100.0%
Taylor expanded in z around inf 95.3%
Taylor expanded in x around 0 48.8%
if -40 < (+.f64 z #s(literal 1 binary64)) < 100Initial program 100.0%
Taylor expanded in z around 0 97.7%
+-commutative97.7%
Simplified97.7%
if 100 < (+.f64 z #s(literal 1 binary64)) < 1.00000000000000007e260Initial program 100.0%
Taylor expanded in x around inf 49.3%
Final simplification73.4%
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (* y z) (if (<= z 480.0) (+ x y) (if (<= z 1.15e+260) (* x z) (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = y * z;
} else if (z <= 480.0) {
tmp = x + y;
} else if (z <= 1.15e+260) {
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 = y * z
else if (z <= 480.0d0) then
tmp = x + y
else if (z <= 1.15d+260) 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 = y * z;
} else if (z <= 480.0) {
tmp = x + y;
} else if (z <= 1.15e+260) {
tmp = x * z;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = y * z elif z <= 480.0: tmp = x + y elif z <= 1.15e+260: tmp = x * z else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(y * z); elseif (z <= 480.0) tmp = Float64(x + y); elseif (z <= 1.15e+260) 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 = y * z; elseif (z <= 480.0) tmp = x + y; elseif (z <= 1.15e+260) tmp = x * z; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(y * z), $MachinePrecision], If[LessEqual[z, 480.0], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.15e+260], N[(x * z), $MachinePrecision], N[(y * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 480:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+260}:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1 or 1.15000000000000005e260 < z Initial program 100.0%
Taylor expanded in z around inf 95.3%
Taylor expanded in x around 0 48.8%
if -1 < z < 480Initial program 100.0%
Taylor expanded in z around 0 97.7%
+-commutative97.7%
Simplified97.7%
if 480 < z < 1.15000000000000005e260Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around inf 49.3%
*-commutative49.3%
Simplified49.3%
Final simplification73.4%
(FPCore (x y z) :precision binary64 (if (<= (+ x y) -5e-297) (+ x (* x z)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -5e-297) {
tmp = x + (x * z);
} 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 + y) <= (-5d-297)) then
tmp = x + (x * z)
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 + y) <= -5e-297) {
tmp = x + (x * z);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x + y) <= -5e-297: tmp = x + (x * z) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x + y) <= -5e-297) tmp = Float64(x + Float64(x * z)); else tmp = Float64(y * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x + y) <= -5e-297) tmp = x + (x * z); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-297], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-297}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -5e-297Initial program 100.0%
Taylor expanded in x around inf 57.9%
distribute-lft-in57.9%
*-rgt-identity57.9%
Applied egg-rr57.9%
if -5e-297 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0 56.8%
Final simplification57.4%
(FPCore (x y z) :precision binary64 (if (<= (+ x y) -5e-297) (* x (+ z 1.0)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -5e-297) {
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 + y) <= (-5d-297)) 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 + y) <= -5e-297) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x + y) <= -5e-297: tmp = x * (z + 1.0) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x + y) <= -5e-297) 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 + y) <= -5e-297) tmp = x * (z + 1.0); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-297], 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 + y \leq -5 \cdot 10^{-297}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -5e-297Initial program 100.0%
Taylor expanded in x around inf 57.9%
if -5e-297 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0 56.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%
(FPCore (x y z) :precision binary64 (if (<= y 3.6e-19) x y))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.6e-19) {
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 <= 3.6d-19) 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 <= 3.6e-19) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.6e-19: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.6e-19) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.6e-19) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.6e-19], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.6 \cdot 10^{-19}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 3.6000000000000001e-19Initial program 100.0%
Taylor expanded in z around 0 48.1%
+-commutative48.1%
Simplified48.1%
Taylor expanded in y around 0 31.7%
if 3.6000000000000001e-19 < y Initial program 100.0%
Taylor expanded in z around 0 57.1%
+-commutative57.1%
Simplified57.1%
Taylor expanded in y around inf 44.2%
(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 z around 0 50.7%
+-commutative50.7%
Simplified50.7%
Taylor expanded in y around 0 27.0%
herbie shell --seed 2024143
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))