
(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 -8.5e+99)
(* x z)
(if (<= z -1.0)
(* y z)
(if (<= z -1.1e-77)
y
(if (<= z -9.5e-158)
x
(if (<= z 4e-292)
y
(if (<= z 6.5e-30) x (if (<= z 1.48) y (* y z)))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.5e+99) {
tmp = x * z;
} else if (z <= -1.0) {
tmp = y * z;
} else if (z <= -1.1e-77) {
tmp = y;
} else if (z <= -9.5e-158) {
tmp = x;
} else if (z <= 4e-292) {
tmp = y;
} else if (z <= 6.5e-30) {
tmp = x;
} else if (z <= 1.48) {
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 <= (-8.5d+99)) then
tmp = x * z
else if (z <= (-1.0d0)) then
tmp = y * z
else if (z <= (-1.1d-77)) then
tmp = y
else if (z <= (-9.5d-158)) then
tmp = x
else if (z <= 4d-292) then
tmp = y
else if (z <= 6.5d-30) then
tmp = x
else if (z <= 1.48d0) 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 <= -8.5e+99) {
tmp = x * z;
} else if (z <= -1.0) {
tmp = y * z;
} else if (z <= -1.1e-77) {
tmp = y;
} else if (z <= -9.5e-158) {
tmp = x;
} else if (z <= 4e-292) {
tmp = y;
} else if (z <= 6.5e-30) {
tmp = x;
} else if (z <= 1.48) {
tmp = y;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8.5e+99: tmp = x * z elif z <= -1.0: tmp = y * z elif z <= -1.1e-77: tmp = y elif z <= -9.5e-158: tmp = x elif z <= 4e-292: tmp = y elif z <= 6.5e-30: tmp = x elif z <= 1.48: tmp = y else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8.5e+99) tmp = Float64(x * z); elseif (z <= -1.0) tmp = Float64(y * z); elseif (z <= -1.1e-77) tmp = y; elseif (z <= -9.5e-158) tmp = x; elseif (z <= 4e-292) tmp = y; elseif (z <= 6.5e-30) tmp = x; elseif (z <= 1.48) tmp = y; else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -8.5e+99) tmp = x * z; elseif (z <= -1.0) tmp = y * z; elseif (z <= -1.1e-77) tmp = y; elseif (z <= -9.5e-158) tmp = x; elseif (z <= 4e-292) tmp = y; elseif (z <= 6.5e-30) tmp = x; elseif (z <= 1.48) tmp = y; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8.5e+99], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.0], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.1e-77], y, If[LessEqual[z, -9.5e-158], x, If[LessEqual[z, 4e-292], y, If[LessEqual[z, 6.5e-30], x, If[LessEqual[z, 1.48], y, N[(y * z), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+99}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-77}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{-158}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-292}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-30}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.48:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -8.49999999999999984e99Initial program 99.9%
+-commutative99.9%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 53.7%
Taylor expanded in z around inf 53.7%
if -8.49999999999999984e99 < z < -1 or 1.48 < z Initial program 100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 49.6%
Taylor expanded in z around inf 49.3%
*-commutative49.3%
Simplified49.3%
if -1 < z < -1.10000000000000003e-77 or -9.50000000000000051e-158 < z < 4.0000000000000002e-292 or 6.5000000000000005e-30 < z < 1.48Initial program 99.9%
Taylor expanded in x around 0 40.0%
Taylor expanded in z around 0 38.5%
if -1.10000000000000003e-77 < z < -9.50000000000000051e-158 or 4.0000000000000002e-292 < z < 6.5000000000000005e-30Initial program 100.0%
Taylor expanded in x around inf 48.1%
Taylor expanded in z around 0 48.1%
Final simplification47.2%
(FPCore (x y z)
:precision binary64
(if (<= z -6e+14)
(* x z)
(if (<= z -9e-79)
y
(if (<= z -1.5e-158)
x
(if (<= z 9.2e-291)
y
(if (<= z 1e-29) x (if (<= z 0.58) y (* x z))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6e+14) {
tmp = x * z;
} else if (z <= -9e-79) {
tmp = y;
} else if (z <= -1.5e-158) {
tmp = x;
} else if (z <= 9.2e-291) {
tmp = y;
} else if (z <= 1e-29) {
tmp = x;
} else if (z <= 0.58) {
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 <= (-6d+14)) then
tmp = x * z
else if (z <= (-9d-79)) then
tmp = y
else if (z <= (-1.5d-158)) then
tmp = x
else if (z <= 9.2d-291) then
tmp = y
else if (z <= 1d-29) then
tmp = x
else if (z <= 0.58d0) 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 <= -6e+14) {
tmp = x * z;
} else if (z <= -9e-79) {
tmp = y;
} else if (z <= -1.5e-158) {
tmp = x;
} else if (z <= 9.2e-291) {
tmp = y;
} else if (z <= 1e-29) {
tmp = x;
} else if (z <= 0.58) {
tmp = y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6e+14: tmp = x * z elif z <= -9e-79: tmp = y elif z <= -1.5e-158: tmp = x elif z <= 9.2e-291: tmp = y elif z <= 1e-29: tmp = x elif z <= 0.58: tmp = y else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6e+14) tmp = Float64(x * z); elseif (z <= -9e-79) tmp = y; elseif (z <= -1.5e-158) tmp = x; elseif (z <= 9.2e-291) tmp = y; elseif (z <= 1e-29) tmp = x; elseif (z <= 0.58) tmp = y; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6e+14) tmp = x * z; elseif (z <= -9e-79) tmp = y; elseif (z <= -1.5e-158) tmp = x; elseif (z <= 9.2e-291) tmp = y; elseif (z <= 1e-29) tmp = x; elseif (z <= 0.58) tmp = y; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6e+14], N[(x * z), $MachinePrecision], If[LessEqual[z, -9e-79], y, If[LessEqual[z, -1.5e-158], x, If[LessEqual[z, 9.2e-291], y, If[LessEqual[z, 1e-29], x, If[LessEqual[z, 0.58], y, N[(x * z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+14}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -9 \cdot 10^{-79}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-158}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-291}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 10^{-29}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 0.58:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -6e14 or 0.57999999999999996 < z Initial program 99.9%
+-commutative99.9%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 54.8%
Taylor expanded in z around inf 54.2%
if -6e14 < z < -9.0000000000000006e-79 or -1.5e-158 < z < 9.2000000000000003e-291 or 9.99999999999999943e-30 < z < 0.57999999999999996Initial program 99.9%
Taylor expanded in x around 0 40.0%
Taylor expanded in z around 0 38.6%
if -9.0000000000000006e-79 < z < -1.5e-158 or 9.2000000000000003e-291 < z < 9.99999999999999943e-30Initial program 100.0%
Taylor expanded in x around inf 48.1%
Taylor expanded in z around 0 48.1%
Final simplification48.8%
(FPCore (x y z) :precision binary64 (if (<= z -6.4e+100) (* x z) (if (or (<= z -5.8e-11) (not (<= z 1.05e-29))) (* y (+ z 1.0)) (+ x y))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.4e+100) {
tmp = x * z;
} else if ((z <= -5.8e-11) || !(z <= 1.05e-29)) {
tmp = y * (z + 1.0);
} 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 <= (-6.4d+100)) then
tmp = x * z
else if ((z <= (-5.8d-11)) .or. (.not. (z <= 1.05d-29))) then
tmp = y * (z + 1.0d0)
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6.4e+100) {
tmp = x * z;
} else if ((z <= -5.8e-11) || !(z <= 1.05e-29)) {
tmp = y * (z + 1.0);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.4e+100: tmp = x * z elif (z <= -5.8e-11) or not (z <= 1.05e-29): tmp = y * (z + 1.0) else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.4e+100) tmp = Float64(x * z); elseif ((z <= -5.8e-11) || !(z <= 1.05e-29)) tmp = Float64(y * Float64(z + 1.0)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6.4e+100) tmp = x * z; elseif ((z <= -5.8e-11) || ~((z <= 1.05e-29))) tmp = y * (z + 1.0); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.4e+100], N[(x * z), $MachinePrecision], If[Or[LessEqual[z, -5.8e-11], N[Not[LessEqual[z, 1.05e-29]], $MachinePrecision]], N[(y * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+100}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -5.8 \cdot 10^{-11} \lor \neg \left(z \leq 1.05 \cdot 10^{-29}\right):\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -6.3999999999999998e100Initial program 99.9%
+-commutative99.9%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 53.7%
Taylor expanded in z around inf 53.7%
if -6.3999999999999998e100 < z < -5.8e-11 or 1.04999999999999995e-29 < z Initial program 99.9%
Taylor expanded in x around 0 49.4%
if -5.8e-11 < z < 1.04999999999999995e-29Initial program 100.0%
Taylor expanded in z around 0 99.8%
Final simplification73.0%
(FPCore (x y z) :precision binary64 (if (<= z -1.36e+100) (* x z) (if (<= z -1.0) (* y z) (if (<= z 16000000000.0) (+ x y) (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.36e+100) {
tmp = x * z;
} else if (z <= -1.0) {
tmp = y * z;
} else if (z <= 16000000000.0) {
tmp = x + 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 <= (-1.36d+100)) then
tmp = x * z
else if (z <= (-1.0d0)) then
tmp = y * z
else if (z <= 16000000000.0d0) then
tmp = x + 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 <= -1.36e+100) {
tmp = x * z;
} else if (z <= -1.0) {
tmp = y * z;
} else if (z <= 16000000000.0) {
tmp = x + y;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.36e+100: tmp = x * z elif z <= -1.0: tmp = y * z elif z <= 16000000000.0: tmp = x + y else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.36e+100) tmp = Float64(x * z); elseif (z <= -1.0) tmp = Float64(y * z); elseif (z <= 16000000000.0) tmp = Float64(x + y); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.36e+100) tmp = x * z; elseif (z <= -1.0) tmp = y * z; elseif (z <= 16000000000.0) tmp = x + y; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.36e+100], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.0], N[(y * z), $MachinePrecision], If[LessEqual[z, 16000000000.0], N[(x + y), $MachinePrecision], N[(y * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.36 \cdot 10^{+100}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 16000000000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1.35999999999999994e100Initial program 99.9%
+-commutative99.9%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 53.7%
Taylor expanded in z around inf 53.7%
if -1.35999999999999994e100 < z < -1 or 1.6e10 < z Initial program 100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 49.0%
Taylor expanded in z around inf 49.0%
*-commutative49.0%
Simplified49.0%
if -1 < z < 1.6e10Initial program 100.0%
Taylor expanded in z around 0 96.2%
Final simplification73.8%
(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 99.9%
Taylor expanded in z around inf 99.1%
if -1 < z < 1Initial program 100.0%
Taylor expanded in z around 0 97.5%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (<= x -2.7e-111) (* x (+ z 1.0)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.7e-111) {
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 <= (-2.7d-111)) 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 <= -2.7e-111) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.7e-111: tmp = x * (z + 1.0) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.7e-111) 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 <= -2.7e-111) tmp = x * (z + 1.0); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.7e-111], 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 -2.7 \cdot 10^{-111}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -2.69999999999999989e-111Initial program 99.9%
Taylor expanded in x around inf 72.5%
if -2.69999999999999989e-111 < x Initial program 100.0%
Taylor expanded in x around 0 56.5%
Final simplification61.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 (if (<= x -1.45e-93) x y))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.45e-93) {
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 <= (-1.45d-93)) 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 <= -1.45e-93) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.45e-93: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.45e-93) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.45e-93) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.45e-93], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-93}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if x < -1.4499999999999999e-93Initial program 99.9%
Taylor expanded in x around inf 74.8%
Taylor expanded in z around 0 34.1%
if -1.4499999999999999e-93 < x Initial program 100.0%
Taylor expanded in x around 0 56.3%
Taylor expanded in z around 0 29.5%
Final simplification30.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%
Taylor expanded in x around inf 54.2%
Taylor expanded in z around 0 27.5%
Final simplification27.5%
herbie shell --seed 2023268
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))