
(FPCore (x y z) :precision binary64 (* (+ x y) (- 1.0 z)))
double code(double x, double y, double z) {
return (x + y) * (1.0 - 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) * (1.0d0 - z)
end function
public static double code(double x, double y, double z) {
return (x + y) * (1.0 - z);
}
def code(x, y, z): return (x + y) * (1.0 - z)
function code(x, y, z) return Float64(Float64(x + y) * Float64(1.0 - z)) end
function tmp = code(x, y, z) tmp = (x + y) * (1.0 - z); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) \cdot \left(1 - z\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* (+ x y) (- 1.0 z)))
double code(double x, double y, double z) {
return (x + y) * (1.0 - 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) * (1.0d0 - z)
end function
public static double code(double x, double y, double z) {
return (x + y) * (1.0 - z);
}
def code(x, y, z): return (x + y) * (1.0 - z)
function code(x, y, z) return Float64(Float64(x + y) * Float64(1.0 - z)) end
function tmp = code(x, y, z) tmp = (x + y) * (1.0 - z); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) \cdot \left(1 - z\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%
sub-neg100.0%
distribute-lft-in100.0%
*-commutative100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- z))) (t_1 (* y (- z))))
(if (<= z -7e+162)
t_0
(if (<= z -118.0)
t_1
(if (<= z 1.0)
(+ x y)
(if (or (<= z 1.65e+185) (not (<= z 1.05e+223))) t_0 t_1))))))
double code(double x, double y, double z) {
double t_0 = x * -z;
double t_1 = y * -z;
double tmp;
if (z <= -7e+162) {
tmp = t_0;
} else if (z <= -118.0) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x + y;
} else if ((z <= 1.65e+185) || !(z <= 1.05e+223)) {
tmp = t_0;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = x * -z
t_1 = y * -z
if (z <= (-7d+162)) then
tmp = t_0
else if (z <= (-118.0d0)) then
tmp = t_1
else if (z <= 1.0d0) then
tmp = x + y
else if ((z <= 1.65d+185) .or. (.not. (z <= 1.05d+223))) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * -z;
double t_1 = y * -z;
double tmp;
if (z <= -7e+162) {
tmp = t_0;
} else if (z <= -118.0) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x + y;
} else if ((z <= 1.65e+185) || !(z <= 1.05e+223)) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * -z t_1 = y * -z tmp = 0 if z <= -7e+162: tmp = t_0 elif z <= -118.0: tmp = t_1 elif z <= 1.0: tmp = x + y elif (z <= 1.65e+185) or not (z <= 1.05e+223): tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-z)) t_1 = Float64(y * Float64(-z)) tmp = 0.0 if (z <= -7e+162) tmp = t_0; elseif (z <= -118.0) tmp = t_1; elseif (z <= 1.0) tmp = Float64(x + y); elseif ((z <= 1.65e+185) || !(z <= 1.05e+223)) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * -z; t_1 = y * -z; tmp = 0.0; if (z <= -7e+162) tmp = t_0; elseif (z <= -118.0) tmp = t_1; elseif (z <= 1.0) tmp = x + y; elseif ((z <= 1.65e+185) || ~((z <= 1.05e+223))) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * (-z)), $MachinePrecision]}, Block[{t$95$1 = N[(y * (-z)), $MachinePrecision]}, If[LessEqual[z, -7e+162], t$95$0, If[LessEqual[z, -118.0], t$95$1, If[LessEqual[z, 1.0], N[(x + y), $MachinePrecision], If[Or[LessEqual[z, 1.65e+185], N[Not[LessEqual[z, 1.05e+223]], $MachinePrecision]], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-z\right)\\
t_1 := y \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -7 \cdot 10^{+162}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -118:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+185} \lor \neg \left(z \leq 1.05 \cdot 10^{+223}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.00000000000000036e162 or 1 < z < 1.65000000000000006e185 or 1.04999999999999995e223 < z Initial program 100.0%
sub-neg100.0%
distribute-lft-in100.0%
*-commutative100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 49.6%
Taylor expanded in z around inf 48.1%
associate-*r*48.1%
neg-mul-148.1%
Simplified48.1%
if -7.00000000000000036e162 < z < -118 or 1.65000000000000006e185 < z < 1.04999999999999995e223Initial program 100.0%
sub-neg100.0%
distribute-lft-in100.0%
*-commutative100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 50.0%
mul-1-neg50.0%
Simplified50.0%
Taylor expanded in z around inf 50.0%
associate-*r*50.0%
neg-mul-150.0%
Simplified50.0%
if -118 < z < 1Initial program 100.0%
Taylor expanded in z around 0 97.9%
+-commutative97.9%
Simplified97.9%
Final simplification73.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- z))))
(if (<= z -2.1e+152)
t_0
(if (<= z -5.8e-16)
(* y (- 1.0 z))
(if (<= z 1.0)
(+ x y)
(if (or (<= z 1.65e+185) (not (<= z 3.6e+220))) t_0 (* y (- z))))))))
double code(double x, double y, double z) {
double t_0 = x * -z;
double tmp;
if (z <= -2.1e+152) {
tmp = t_0;
} else if (z <= -5.8e-16) {
tmp = y * (1.0 - z);
} else if (z <= 1.0) {
tmp = x + y;
} else if ((z <= 1.65e+185) || !(z <= 3.6e+220)) {
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
if (z <= (-2.1d+152)) then
tmp = t_0
else if (z <= (-5.8d-16)) then
tmp = y * (1.0d0 - z)
else if (z <= 1.0d0) then
tmp = x + y
else if ((z <= 1.65d+185) .or. (.not. (z <= 3.6d+220))) 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;
double tmp;
if (z <= -2.1e+152) {
tmp = t_0;
} else if (z <= -5.8e-16) {
tmp = y * (1.0 - z);
} else if (z <= 1.0) {
tmp = x + y;
} else if ((z <= 1.65e+185) || !(z <= 3.6e+220)) {
tmp = t_0;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): t_0 = x * -z tmp = 0 if z <= -2.1e+152: tmp = t_0 elif z <= -5.8e-16: tmp = y * (1.0 - z) elif z <= 1.0: tmp = x + y elif (z <= 1.65e+185) or not (z <= 3.6e+220): tmp = t_0 else: tmp = y * -z return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-z)) tmp = 0.0 if (z <= -2.1e+152) tmp = t_0; elseif (z <= -5.8e-16) tmp = Float64(y * Float64(1.0 - z)); elseif (z <= 1.0) tmp = Float64(x + y); elseif ((z <= 1.65e+185) || !(z <= 3.6e+220)) tmp = t_0; else tmp = Float64(y * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * -z; tmp = 0.0; if (z <= -2.1e+152) tmp = t_0; elseif (z <= -5.8e-16) tmp = y * (1.0 - z); elseif (z <= 1.0) tmp = x + y; elseif ((z <= 1.65e+185) || ~((z <= 3.6e+220))) tmp = t_0; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * (-z)), $MachinePrecision]}, If[LessEqual[z, -2.1e+152], t$95$0, If[LessEqual[z, -5.8e-16], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x + y), $MachinePrecision], If[Or[LessEqual[z, 1.65e+185], N[Not[LessEqual[z, 3.6e+220]], $MachinePrecision]], t$95$0, N[(y * (-z)), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{+152}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -5.8 \cdot 10^{-16}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+185} \lor \neg \left(z \leq 3.6 \cdot 10^{+220}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < -2.1000000000000002e152 or 1 < z < 1.65000000000000006e185 or 3.60000000000000019e220 < z Initial program 100.0%
sub-neg100.0%
distribute-lft-in100.0%
*-commutative100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 49.6%
Taylor expanded in z around inf 48.1%
associate-*r*48.1%
neg-mul-148.1%
Simplified48.1%
if -2.1000000000000002e152 < z < -5.7999999999999996e-16Initial program 100.0%
Taylor expanded in x around 0 48.7%
if -5.7999999999999996e-16 < z < 1Initial program 100.0%
Taylor expanded in z around 0 98.6%
+-commutative98.6%
Simplified98.6%
if 1.65000000000000006e185 < z < 3.60000000000000019e220Initial program 100.0%
sub-neg100.0%
distribute-lft-in100.0%
*-commutative100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 58.1%
mul-1-neg58.1%
Simplified58.1%
Taylor expanded in z around inf 58.1%
associate-*r*58.1%
neg-mul-158.1%
Simplified58.1%
Final simplification72.7%
(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(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):\\
\;\;\;\;\left(-z\right) \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.0%
mul-1-neg98.0%
distribute-lft-neg-out98.0%
*-commutative98.0%
+-commutative98.0%
Simplified98.0%
if -1 < z < 1Initial program 100.0%
Taylor expanded in z around 0 97.9%
+-commutative97.9%
Simplified97.9%
Final simplification97.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.7e+17) (not (<= z 1.0))) (* x (- z)) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.7e+17) || !(z <= 1.0)) {
tmp = x * -z;
} 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 <= (-4.7d+17)) .or. (.not. (z <= 1.0d0))) then
tmp = x * -z
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.7e+17) || !(z <= 1.0)) {
tmp = x * -z;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.7e+17) or not (z <= 1.0): tmp = x * -z else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.7e+17) || !(z <= 1.0)) tmp = Float64(x * Float64(-z)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.7e+17) || ~((z <= 1.0))) tmp = x * -z; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.7e+17], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * (-z)), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{+17} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.7e17 or 1 < z Initial program 100.0%
sub-neg100.0%
distribute-lft-in100.0%
*-commutative100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 49.0%
Taylor expanded in z around inf 48.0%
associate-*r*48.0%
neg-mul-148.0%
Simplified48.0%
if -4.7e17 < z < 1Initial program 100.0%
Taylor expanded in z around 0 95.2%
+-commutative95.2%
Simplified95.2%
Final simplification72.1%
(FPCore (x y z) :precision binary64 (if (<= y 2.55e-57) (* x (- 1.0 z)) (* y (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.55e-57) {
tmp = x * (1.0 - z);
} else {
tmp = y * (1.0 - 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 (y <= 2.55d-57) then
tmp = x * (1.0d0 - z)
else
tmp = y * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.55e-57) {
tmp = x * (1.0 - z);
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.55e-57: tmp = x * (1.0 - z) else: tmp = y * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.55e-57) tmp = Float64(x * Float64(1.0 - z)); else tmp = Float64(y * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.55e-57) tmp = x * (1.0 - z); else tmp = y * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.55e-57], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.55 \cdot 10^{-57}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 2.55e-57Initial program 100.0%
Taylor expanded in x around inf 54.4%
*-commutative54.4%
Simplified54.4%
if 2.55e-57 < y Initial program 100.0%
Taylor expanded in x around 0 68.5%
Final simplification58.6%
(FPCore (x y z) :precision binary64 (if (<= y 1.45e-57) (- x (* x z)) (* y (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.45e-57) {
tmp = x - (x * z);
} else {
tmp = y * (1.0 - 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 (y <= 1.45d-57) then
tmp = x - (x * z)
else
tmp = y * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.45e-57) {
tmp = x - (x * z);
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.45e-57: tmp = x - (x * z) else: tmp = y * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.45e-57) tmp = Float64(x - Float64(x * z)); else tmp = Float64(y * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.45e-57) tmp = x - (x * z); else tmp = y * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.45e-57], N[(x - N[(x * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.45 \cdot 10^{-57}:\\
\;\;\;\;x - x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 1.45000000000000013e-57Initial program 100.0%
sub-neg100.0%
distribute-lft-in100.0%
*-commutative100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 54.4%
mul-1-neg54.4%
unsub-neg54.4%
Applied egg-rr54.4%
if 1.45000000000000013e-57 < y Initial program 100.0%
Taylor expanded in x around 0 68.5%
Final simplification58.6%
(FPCore (x y z) :precision binary64 (* (- 1.0 z) (+ x y)))
double code(double x, double y, double z) {
return (1.0 - 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 = (1.0d0 - z) * (x + y)
end function
public static double code(double x, double y, double z) {
return (1.0 - z) * (x + y);
}
def code(x, y, z): return (1.0 - z) * (x + y)
function code(x, y, z) return Float64(Float64(1.0 - z) * Float64(x + y)) end
function tmp = code(x, y, z) tmp = (1.0 - z) * (x + y); end
code[x_, y_, z_] := N[(N[(1.0 - z), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - z\right) \cdot \left(x + y\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (<= x -2.1e-103) x y))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.1e-103) {
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 <= (-2.1d-103)) 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 <= -2.1e-103) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.1e-103: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.1e-103) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.1e-103) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.1e-103], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-103}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if x < -2.10000000000000005e-103Initial program 100.0%
Taylor expanded in x around inf 65.9%
*-commutative65.9%
Simplified65.9%
Taylor expanded in z around 0 32.2%
if -2.10000000000000005e-103 < x Initial program 100.0%
Taylor expanded in x around 0 61.9%
Taylor expanded in z around 0 32.3%
Final simplification32.3%
(FPCore (x y z) :precision binary64 (+ x y))
double code(double x, double y, double z) {
return 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
end function
public static double code(double x, double y, double z) {
return x + y;
}
def code(x, y, z): return x + y
function code(x, y, z) return Float64(x + y) end
function tmp = code(x, y, z) tmp = x + y; end
code[x_, y_, z_] := N[(x + y), $MachinePrecision]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 100.0%
Taylor expanded in z around 0 50.7%
+-commutative50.7%
Simplified50.7%
Final simplification50.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 48.7%
*-commutative48.7%
Simplified48.7%
Taylor expanded in z around 0 24.8%
Final simplification24.8%
herbie shell --seed 2024046
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, H"
:precision binary64
(* (+ x y) (- 1.0 z)))