
(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 -1.0)
(* y z)
(if (<= z -9.6e-127)
y
(if (<= z -4.5e-250)
x
(if (<= z -2.7e-298)
y
(if (<= z 8.5e-268)
x
(if (<= z 1.06e-192)
y
(if (<= z 1.15e-133)
x
(if (<= z 2.5e-59) y (if (<= z 3.3e-12) x (* y z)))))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = y * z;
} else if (z <= -9.6e-127) {
tmp = y;
} else if (z <= -4.5e-250) {
tmp = x;
} else if (z <= -2.7e-298) {
tmp = y;
} else if (z <= 8.5e-268) {
tmp = x;
} else if (z <= 1.06e-192) {
tmp = y;
} else if (z <= 1.15e-133) {
tmp = x;
} else if (z <= 2.5e-59) {
tmp = y;
} else if (z <= 3.3e-12) {
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 <= (-1.0d0)) then
tmp = y * z
else if (z <= (-9.6d-127)) then
tmp = y
else if (z <= (-4.5d-250)) then
tmp = x
else if (z <= (-2.7d-298)) then
tmp = y
else if (z <= 8.5d-268) then
tmp = x
else if (z <= 1.06d-192) then
tmp = y
else if (z <= 1.15d-133) then
tmp = x
else if (z <= 2.5d-59) then
tmp = y
else if (z <= 3.3d-12) 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 <= -1.0) {
tmp = y * z;
} else if (z <= -9.6e-127) {
tmp = y;
} else if (z <= -4.5e-250) {
tmp = x;
} else if (z <= -2.7e-298) {
tmp = y;
} else if (z <= 8.5e-268) {
tmp = x;
} else if (z <= 1.06e-192) {
tmp = y;
} else if (z <= 1.15e-133) {
tmp = x;
} else if (z <= 2.5e-59) {
tmp = y;
} else if (z <= 3.3e-12) {
tmp = x;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = y * z elif z <= -9.6e-127: tmp = y elif z <= -4.5e-250: tmp = x elif z <= -2.7e-298: tmp = y elif z <= 8.5e-268: tmp = x elif z <= 1.06e-192: tmp = y elif z <= 1.15e-133: tmp = x elif z <= 2.5e-59: tmp = y elif z <= 3.3e-12: tmp = x else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(y * z); elseif (z <= -9.6e-127) tmp = y; elseif (z <= -4.5e-250) tmp = x; elseif (z <= -2.7e-298) tmp = y; elseif (z <= 8.5e-268) tmp = x; elseif (z <= 1.06e-192) tmp = y; elseif (z <= 1.15e-133) tmp = x; elseif (z <= 2.5e-59) tmp = y; elseif (z <= 3.3e-12) tmp = x; 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 <= -9.6e-127) tmp = y; elseif (z <= -4.5e-250) tmp = x; elseif (z <= -2.7e-298) tmp = y; elseif (z <= 8.5e-268) tmp = x; elseif (z <= 1.06e-192) tmp = y; elseif (z <= 1.15e-133) tmp = x; elseif (z <= 2.5e-59) tmp = y; elseif (z <= 3.3e-12) tmp = x; 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, -9.6e-127], y, If[LessEqual[z, -4.5e-250], x, If[LessEqual[z, -2.7e-298], y, If[LessEqual[z, 8.5e-268], x, If[LessEqual[z, 1.06e-192], y, If[LessEqual[z, 1.15e-133], x, If[LessEqual[z, 2.5e-59], y, If[LessEqual[z, 3.3e-12], x, N[(y * z), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -9.6 \cdot 10^{-127}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{-250}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-298}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-268}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-192}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-133}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-59}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1 or 3.3000000000000001e-12 < z Initial program 99.9%
+-commutative99.9%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 48.8%
Taylor expanded in z around inf 47.2%
if -1 < z < -9.59999999999999929e-127 or -4.49999999999999993e-250 < z < -2.7000000000000001e-298 or 8.50000000000000052e-268 < z < 1.06e-192 or 1.15e-133 < z < 2.5000000000000001e-59Initial program 100.0%
Taylor expanded in x around 0 46.1%
Taylor expanded in z around 0 46.1%
if -9.59999999999999929e-127 < z < -4.49999999999999993e-250 or -2.7000000000000001e-298 < z < 8.50000000000000052e-268 or 1.06e-192 < z < 1.15e-133 or 2.5000000000000001e-59 < z < 3.3000000000000001e-12Initial program 100.0%
Taylor expanded in x around inf 48.2%
Taylor expanded in z around 0 48.1%
Final simplification47.1%
(FPCore (x y z)
:precision binary64
(if (<= z -1.0)
(* y z)
(if (<= z -5e-128)
y
(if (<= z -3.6e-251)
x
(if (<= z -1.25e-297)
y
(if (<= z 5.5e-269)
x
(if (<= z 1.35e-193)
y
(if (<= z 1.42e-133)
x
(if (<= z 7.5e-63)
y
(if (<= z 29000000000.0) x (* x z)))))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = y * z;
} else if (z <= -5e-128) {
tmp = y;
} else if (z <= -3.6e-251) {
tmp = x;
} else if (z <= -1.25e-297) {
tmp = y;
} else if (z <= 5.5e-269) {
tmp = x;
} else if (z <= 1.35e-193) {
tmp = y;
} else if (z <= 1.42e-133) {
tmp = x;
} else if (z <= 7.5e-63) {
tmp = y;
} else if (z <= 29000000000.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 <= (-1.0d0)) then
tmp = y * z
else if (z <= (-5d-128)) then
tmp = y
else if (z <= (-3.6d-251)) then
tmp = x
else if (z <= (-1.25d-297)) then
tmp = y
else if (z <= 5.5d-269) then
tmp = x
else if (z <= 1.35d-193) then
tmp = y
else if (z <= 1.42d-133) then
tmp = x
else if (z <= 7.5d-63) then
tmp = y
else if (z <= 29000000000.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 <= -1.0) {
tmp = y * z;
} else if (z <= -5e-128) {
tmp = y;
} else if (z <= -3.6e-251) {
tmp = x;
} else if (z <= -1.25e-297) {
tmp = y;
} else if (z <= 5.5e-269) {
tmp = x;
} else if (z <= 1.35e-193) {
tmp = y;
} else if (z <= 1.42e-133) {
tmp = x;
} else if (z <= 7.5e-63) {
tmp = y;
} else if (z <= 29000000000.0) {
tmp = x;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = y * z elif z <= -5e-128: tmp = y elif z <= -3.6e-251: tmp = x elif z <= -1.25e-297: tmp = y elif z <= 5.5e-269: tmp = x elif z <= 1.35e-193: tmp = y elif z <= 1.42e-133: tmp = x elif z <= 7.5e-63: tmp = y elif z <= 29000000000.0: tmp = x else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(y * z); elseif (z <= -5e-128) tmp = y; elseif (z <= -3.6e-251) tmp = x; elseif (z <= -1.25e-297) tmp = y; elseif (z <= 5.5e-269) tmp = x; elseif (z <= 1.35e-193) tmp = y; elseif (z <= 1.42e-133) tmp = x; elseif (z <= 7.5e-63) tmp = y; elseif (z <= 29000000000.0) tmp = x; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = y * z; elseif (z <= -5e-128) tmp = y; elseif (z <= -3.6e-251) tmp = x; elseif (z <= -1.25e-297) tmp = y; elseif (z <= 5.5e-269) tmp = x; elseif (z <= 1.35e-193) tmp = y; elseif (z <= 1.42e-133) tmp = x; elseif (z <= 7.5e-63) tmp = y; elseif (z <= 29000000000.0) tmp = x; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(y * z), $MachinePrecision], If[LessEqual[z, -5e-128], y, If[LessEqual[z, -3.6e-251], x, If[LessEqual[z, -1.25e-297], y, If[LessEqual[z, 5.5e-269], x, If[LessEqual[z, 1.35e-193], y, If[LessEqual[z, 1.42e-133], x, If[LessEqual[z, 7.5e-63], y, If[LessEqual[z, 29000000000.0], x, N[(x * z), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-128}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{-251}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -1.25 \cdot 10^{-297}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-269}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-193}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 1.42 \cdot 10^{-133}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-63}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 29000000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1Initial program 100.0%
+-commutative100.0%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 53.5%
Taylor expanded in z around inf 52.2%
if -1 < z < -5.0000000000000001e-128 or -3.6000000000000001e-251 < z < -1.25e-297 or 5.5000000000000001e-269 < z < 1.35e-193 or 1.42000000000000004e-133 < z < 7.5000000000000003e-63Initial program 100.0%
Taylor expanded in x around 0 46.1%
Taylor expanded in z around 0 46.1%
if -5.0000000000000001e-128 < z < -3.6000000000000001e-251 or -1.25e-297 < z < 5.5000000000000001e-269 or 1.35e-193 < z < 1.42000000000000004e-133 or 7.5000000000000003e-63 < z < 2.9e10Initial program 99.9%
Taylor expanded in x around inf 47.4%
Taylor expanded in z around 0 47.0%
if 2.9e10 < z Initial program 99.9%
+-commutative99.9%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 62.1%
Taylor expanded in z around inf 62.1%
Final simplification51.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 98.4%
if -1 < z < 1Initial program 100.0%
Taylor expanded in z around 0 98.8%
Final simplification98.6%
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (* y z) (if (<= z 29000000000.0) (+ x y) (* x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = y * z;
} else if (z <= 29000000000.0) {
tmp = x + 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 <= (-1.0d0)) then
tmp = y * z
else if (z <= 29000000000.0d0) then
tmp = x + 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 <= -1.0) {
tmp = y * z;
} else if (z <= 29000000000.0) {
tmp = x + y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = y * z elif z <= 29000000000.0: tmp = x + y else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(y * z); elseif (z <= 29000000000.0) tmp = Float64(x + y); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = y * z; elseif (z <= 29000000000.0) tmp = x + y; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(y * z), $MachinePrecision], If[LessEqual[z, 29000000000.0], N[(x + y), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 29000000000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1Initial program 100.0%
+-commutative100.0%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 53.5%
Taylor expanded in z around inf 52.2%
if -1 < z < 2.9e10Initial program 100.0%
Taylor expanded in z around 0 98.2%
if 2.9e10 < z Initial program 99.9%
+-commutative99.9%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 62.1%
Taylor expanded in z around inf 62.1%
Final simplification79.2%
(FPCore (x y z) :precision binary64 (if (<= z -1.7e-14) (* y (+ z 1.0)) (if (<= z 29000000000.0) (+ x y) (* x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.7e-14) {
tmp = y * (z + 1.0);
} else if (z <= 29000000000.0) {
tmp = x + 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 <= (-1.7d-14)) then
tmp = y * (z + 1.0d0)
else if (z <= 29000000000.0d0) then
tmp = x + 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 <= -1.7e-14) {
tmp = y * (z + 1.0);
} else if (z <= 29000000000.0) {
tmp = x + y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.7e-14: tmp = y * (z + 1.0) elif z <= 29000000000.0: tmp = x + y else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.7e-14) tmp = Float64(y * Float64(z + 1.0)); elseif (z <= 29000000000.0) tmp = Float64(x + y); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.7e-14) tmp = y * (z + 1.0); elseif (z <= 29000000000.0) tmp = x + y; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.7e-14], N[(y * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 29000000000.0], N[(x + y), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-14}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\mathbf{elif}\;z \leq 29000000000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1.70000000000000001e-14Initial program 100.0%
Taylor expanded in x around 0 51.8%
if -1.70000000000000001e-14 < z < 2.9e10Initial program 100.0%
Taylor expanded in z around 0 98.8%
if 2.9e10 < z Initial program 99.9%
+-commutative99.9%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 62.1%
Taylor expanded in z around inf 62.1%
Final simplification79.1%
(FPCore (x y z) :precision binary64 (if (<= x -1.1e-59) (* x (+ z 1.0)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.1e-59) {
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 <= (-1.1d-59)) 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 <= -1.1e-59) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.1e-59: tmp = x * (z + 1.0) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.1e-59) 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 <= -1.1e-59) tmp = x * (z + 1.0); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.1e-59], 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 -1.1 \cdot 10^{-59}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -1.0999999999999999e-59Initial program 100.0%
Taylor expanded in x around inf 80.2%
if -1.0999999999999999e-59 < x Initial program 100.0%
Taylor expanded in x around 0 57.2%
Final simplification63.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%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (<= x -9.5e-107) x y))
double code(double x, double y, double z) {
double tmp;
if (x <= -9.5e-107) {
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 <= (-9.5d-107)) 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 <= -9.5e-107) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -9.5e-107: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -9.5e-107) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -9.5e-107) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -9.5e-107], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-107}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if x < -9.4999999999999999e-107Initial program 100.0%
Taylor expanded in x around inf 75.1%
Taylor expanded in z around 0 40.2%
if -9.4999999999999999e-107 < x Initial program 100.0%
Taylor expanded in x around 0 57.0%
Taylor expanded in z around 0 32.5%
Final simplification35.1%
(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.6%
Taylor expanded in z around 0 29.0%
Final simplification29.0%
herbie shell --seed 2023279
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))