
(FPCore (x y z) :precision binary64 (+ (+ (+ (+ (+ x y) y) x) z) x))
double code(double x, double y, double z) {
return ((((x + y) + y) + x) + z) + 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 + y) + y) + x) + z) + x
end function
public static double code(double x, double y, double z) {
return ((((x + y) + y) + x) + z) + x;
}
def code(x, y, z): return ((((x + y) + y) + x) + z) + x
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x + y) + y) + x) + z) + x) end
function tmp = code(x, y, z) tmp = ((((x + y) + y) + x) + z) + x; end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ (+ (+ (+ x y) y) x) z) x))
double code(double x, double y, double z) {
return ((((x + y) + y) + x) + z) + 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 + y) + y) + x) + z) + x
end function
public static double code(double x, double y, double z) {
return ((((x + y) + y) + x) + z) + x;
}
def code(x, y, z): return ((((x + y) + y) + x) + z) + x
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x + y) + y) + x) + z) + x) end
function tmp = code(x, y, z) tmp = ((((x + y) + y) + x) + z) + x; end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x
\end{array}
(FPCore (x y z) :precision binary64 (+ z (fma x 3.0 (* 2.0 y))))
double code(double x, double y, double z) {
return z + fma(x, 3.0, (2.0 * y));
}
function code(x, y, z) return Float64(z + fma(x, 3.0, Float64(2.0 * y))) end
code[x_, y_, z_] := N[(z + N[(x * 3.0 + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z + \mathsf{fma}\left(x, 3, 2 \cdot y\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
distribute-neg-in99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+r+99.9%
associate--l+99.9%
count-299.9%
*-commutative99.9%
fma-def99.9%
count-299.9%
neg-mul-199.9%
distribute-rgt-out--99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
*-commutative99.9%
*-commutative99.9%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= z -2e+42)
z
(if (<= z -9.6e-113)
(* x 3.0)
(if (<= z -7.5e-289)
(* 2.0 y)
(if (<= z 1.95e-252)
(* x 3.0)
(if (<= z 6.5e-210) (* 2.0 y) (if (<= z 2.3e+81) (* x 3.0) z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2e+42) {
tmp = z;
} else if (z <= -9.6e-113) {
tmp = x * 3.0;
} else if (z <= -7.5e-289) {
tmp = 2.0 * y;
} else if (z <= 1.95e-252) {
tmp = x * 3.0;
} else if (z <= 6.5e-210) {
tmp = 2.0 * y;
} else if (z <= 2.3e+81) {
tmp = x * 3.0;
} else {
tmp = 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 <= (-2d+42)) then
tmp = z
else if (z <= (-9.6d-113)) then
tmp = x * 3.0d0
else if (z <= (-7.5d-289)) then
tmp = 2.0d0 * y
else if (z <= 1.95d-252) then
tmp = x * 3.0d0
else if (z <= 6.5d-210) then
tmp = 2.0d0 * y
else if (z <= 2.3d+81) then
tmp = x * 3.0d0
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2e+42) {
tmp = z;
} else if (z <= -9.6e-113) {
tmp = x * 3.0;
} else if (z <= -7.5e-289) {
tmp = 2.0 * y;
} else if (z <= 1.95e-252) {
tmp = x * 3.0;
} else if (z <= 6.5e-210) {
tmp = 2.0 * y;
} else if (z <= 2.3e+81) {
tmp = x * 3.0;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2e+42: tmp = z elif z <= -9.6e-113: tmp = x * 3.0 elif z <= -7.5e-289: tmp = 2.0 * y elif z <= 1.95e-252: tmp = x * 3.0 elif z <= 6.5e-210: tmp = 2.0 * y elif z <= 2.3e+81: tmp = x * 3.0 else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2e+42) tmp = z; elseif (z <= -9.6e-113) tmp = Float64(x * 3.0); elseif (z <= -7.5e-289) tmp = Float64(2.0 * y); elseif (z <= 1.95e-252) tmp = Float64(x * 3.0); elseif (z <= 6.5e-210) tmp = Float64(2.0 * y); elseif (z <= 2.3e+81) tmp = Float64(x * 3.0); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2e+42) tmp = z; elseif (z <= -9.6e-113) tmp = x * 3.0; elseif (z <= -7.5e-289) tmp = 2.0 * y; elseif (z <= 1.95e-252) tmp = x * 3.0; elseif (z <= 6.5e-210) tmp = 2.0 * y; elseif (z <= 2.3e+81) tmp = x * 3.0; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2e+42], z, If[LessEqual[z, -9.6e-113], N[(x * 3.0), $MachinePrecision], If[LessEqual[z, -7.5e-289], N[(2.0 * y), $MachinePrecision], If[LessEqual[z, 1.95e-252], N[(x * 3.0), $MachinePrecision], If[LessEqual[z, 6.5e-210], N[(2.0 * y), $MachinePrecision], If[LessEqual[z, 2.3e+81], N[(x * 3.0), $MachinePrecision], z]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+42}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq -9.6 \cdot 10^{-113}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{-289}:\\
\;\;\;\;2 \cdot y\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{-252}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-210}:\\
\;\;\;\;2 \cdot y\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+81}:\\
\;\;\;\;x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -2.00000000000000009e42 or 2.2999999999999999e81 < z Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
associate-+r+100.0%
associate--l+100.0%
count-2100.0%
*-commutative100.0%
fma-def100.0%
count-2100.0%
neg-mul-1100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 64.2%
if -2.00000000000000009e42 < z < -9.60000000000000049e-113 or -7.49999999999999998e-289 < z < 1.9499999999999999e-252 or 6.49999999999999961e-210 < z < 2.2999999999999999e81Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
remove-double-neg99.8%
distribute-neg-in99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
sub-neg99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
associate-+r+99.8%
associate--l+99.8%
count-299.8%
*-commutative99.8%
fma-def99.8%
count-299.8%
neg-mul-199.8%
distribute-rgt-out--99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
*-commutative99.8%
*-commutative99.8%
fma-def99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 57.9%
if -9.60000000000000049e-113 < z < -7.49999999999999998e-289 or 1.9499999999999999e-252 < z < 6.49999999999999961e-210Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
distribute-neg-in99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+r+100.0%
associate--l+99.9%
count-299.9%
*-commutative99.9%
fma-def99.9%
count-299.9%
neg-mul-199.9%
distribute-rgt-out--99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
*-commutative99.9%
*-commutative99.9%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 71.4%
Final simplification62.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (* 2.0 (+ x y)))))
(if (<= y -5.2e+97)
t_0
(if (<= y -9e-31)
(+ z (* 2.0 y))
(if (<= y 1.1e+56) (+ z (* x 3.0)) t_0)))))
double code(double x, double y, double z) {
double t_0 = x + (2.0 * (x + y));
double tmp;
if (y <= -5.2e+97) {
tmp = t_0;
} else if (y <= -9e-31) {
tmp = z + (2.0 * y);
} else if (y <= 1.1e+56) {
tmp = z + (x * 3.0);
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = x + (2.0d0 * (x + y))
if (y <= (-5.2d+97)) then
tmp = t_0
else if (y <= (-9d-31)) then
tmp = z + (2.0d0 * y)
else if (y <= 1.1d+56) then
tmp = z + (x * 3.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (2.0 * (x + y));
double tmp;
if (y <= -5.2e+97) {
tmp = t_0;
} else if (y <= -9e-31) {
tmp = z + (2.0 * y);
} else if (y <= 1.1e+56) {
tmp = z + (x * 3.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + (2.0 * (x + y)) tmp = 0 if y <= -5.2e+97: tmp = t_0 elif y <= -9e-31: tmp = z + (2.0 * y) elif y <= 1.1e+56: tmp = z + (x * 3.0) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + Float64(2.0 * Float64(x + y))) tmp = 0.0 if (y <= -5.2e+97) tmp = t_0; elseif (y <= -9e-31) tmp = Float64(z + Float64(2.0 * y)); elseif (y <= 1.1e+56) tmp = Float64(z + Float64(x * 3.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (2.0 * (x + y)); tmp = 0.0; if (y <= -5.2e+97) tmp = t_0; elseif (y <= -9e-31) tmp = z + (2.0 * y); elseif (y <= 1.1e+56) tmp = z + (x * 3.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.2e+97], t$95$0, If[LessEqual[y, -9e-31], N[(z + N[(2.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e+56], N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + 2 \cdot \left(x + y\right)\\
\mathbf{if}\;y \leq -5.2 \cdot 10^{+97}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -9 \cdot 10^{-31}:\\
\;\;\;\;z + 2 \cdot y\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+56}:\\
\;\;\;\;z + x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -5.2e97 or 1.10000000000000008e56 < y Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
associate-+r+100.0%
count-2100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 89.5%
if -5.2e97 < y < -9.0000000000000008e-31Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
distribute-neg-in99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+r+99.9%
associate--l+99.9%
count-299.9%
*-commutative99.9%
fma-def99.9%
count-299.9%
neg-mul-199.9%
distribute-rgt-out--99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 89.2%
if -9.0000000000000008e-31 < y < 1.10000000000000008e56Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
distribute-neg-in99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+r+99.9%
associate--l+99.9%
count-299.9%
*-commutative99.9%
fma-def99.9%
count-299.9%
neg-mul-199.9%
distribute-rgt-out--99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 93.1%
Final simplification91.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.05e+184) (not (<= x 1.05e+165))) (* x 3.0) (+ z (* 2.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.05e+184) || !(x <= 1.05e+165)) {
tmp = x * 3.0;
} else {
tmp = z + (2.0 * 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.05d+184)) .or. (.not. (x <= 1.05d+165))) then
tmp = x * 3.0d0
else
tmp = z + (2.0d0 * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.05e+184) || !(x <= 1.05e+165)) {
tmp = x * 3.0;
} else {
tmp = z + (2.0 * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.05e+184) or not (x <= 1.05e+165): tmp = x * 3.0 else: tmp = z + (2.0 * y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.05e+184) || !(x <= 1.05e+165)) tmp = Float64(x * 3.0); else tmp = Float64(z + Float64(2.0 * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.05e+184) || ~((x <= 1.05e+165))) tmp = x * 3.0; else tmp = z + (2.0 * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.05e+184], N[Not[LessEqual[x, 1.05e+165]], $MachinePrecision]], N[(x * 3.0), $MachinePrecision], N[(z + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{+184} \lor \neg \left(x \leq 1.05 \cdot 10^{+165}\right):\\
\;\;\;\;x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;z + 2 \cdot y\\
\end{array}
\end{array}
if x < -1.05e184 or 1.05e165 < x Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
remove-double-neg99.8%
distribute-neg-in99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
sub-neg99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.7%
associate-+r+99.8%
associate--l+99.7%
count-299.7%
*-commutative99.7%
fma-def99.7%
count-299.7%
neg-mul-199.7%
distribute-rgt-out--99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
*-commutative99.7%
*-commutative99.7%
fma-def99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 84.2%
if -1.05e184 < x < 1.05e165Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
distribute-neg-in99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+r+99.9%
associate--l+99.9%
count-299.9%
*-commutative99.9%
fma-def99.9%
count-299.9%
neg-mul-199.9%
distribute-rgt-out--99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 78.8%
Final simplification80.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -9.8e-29) (not (<= y 50.0))) (+ z (* 2.0 y)) (+ z (* x 3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -9.8e-29) || !(y <= 50.0)) {
tmp = z + (2.0 * y);
} else {
tmp = z + (x * 3.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 ((y <= (-9.8d-29)) .or. (.not. (y <= 50.0d0))) then
tmp = z + (2.0d0 * y)
else
tmp = z + (x * 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -9.8e-29) || !(y <= 50.0)) {
tmp = z + (2.0 * y);
} else {
tmp = z + (x * 3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -9.8e-29) or not (y <= 50.0): tmp = z + (2.0 * y) else: tmp = z + (x * 3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -9.8e-29) || !(y <= 50.0)) tmp = Float64(z + Float64(2.0 * y)); else tmp = Float64(z + Float64(x * 3.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -9.8e-29) || ~((y <= 50.0))) tmp = z + (2.0 * y); else tmp = z + (x * 3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -9.8e-29], N[Not[LessEqual[y, 50.0]], $MachinePrecision]], N[(z + N[(2.0 * y), $MachinePrecision]), $MachinePrecision], N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{-29} \lor \neg \left(y \leq 50\right):\\
\;\;\;\;z + 2 \cdot y\\
\mathbf{else}:\\
\;\;\;\;z + x \cdot 3\\
\end{array}
\end{array}
if y < -9.7999999999999997e-29 or 50 < y Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
distribute-neg-in99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+r+100.0%
associate--l+99.9%
count-299.9%
*-commutative99.9%
fma-def99.9%
count-299.9%
neg-mul-199.9%
distribute-rgt-out--99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 80.2%
if -9.7999999999999997e-29 < y < 50Initial program 99.8%
+-commutative99.8%
associate-+l+99.9%
remove-double-neg99.9%
distribute-neg-in99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+r+99.9%
associate--l+99.9%
count-299.9%
*-commutative99.9%
fma-def99.9%
count-299.9%
neg-mul-199.9%
distribute-rgt-out--99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 94.1%
Final simplification86.9%
(FPCore (x y z) :precision binary64 (+ z (+ (* 2.0 y) (* x 3.0))))
double code(double x, double y, double z) {
return z + ((2.0 * y) + (x * 3.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z + ((2.0d0 * y) + (x * 3.0d0))
end function
public static double code(double x, double y, double z) {
return z + ((2.0 * y) + (x * 3.0));
}
def code(x, y, z): return z + ((2.0 * y) + (x * 3.0))
function code(x, y, z) return Float64(z + Float64(Float64(2.0 * y) + Float64(x * 3.0))) end
function tmp = code(x, y, z) tmp = z + ((2.0 * y) + (x * 3.0)); end
code[x_, y_, z_] := N[(z + N[(N[(2.0 * y), $MachinePrecision] + N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z + \left(2 \cdot y + x \cdot 3\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
distribute-neg-in99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+r+99.9%
associate--l+99.9%
count-299.9%
*-commutative99.9%
fma-def99.9%
count-299.9%
neg-mul-199.9%
distribute-rgt-out--99.9%
metadata-eval99.9%
Simplified99.9%
fma-udef99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (+ (* 2.0 (+ x y)) (+ z x)))
double code(double x, double y, double z) {
return (2.0 * (x + y)) + (z + x);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (2.0d0 * (x + y)) + (z + x)
end function
public static double code(double x, double y, double z) {
return (2.0 * (x + y)) + (z + x);
}
def code(x, y, z): return (2.0 * (x + y)) + (z + x)
function code(x, y, z) return Float64(Float64(2.0 * Float64(x + y)) + Float64(z + x)) end
function tmp = code(x, y, z) tmp = (2.0 * (x + y)) + (z + x); end
code[x_, y_, z_] := N[(N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(z + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(x + y\right) + \left(z + x\right)
\end{array}
Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
associate-+r+99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.1e+78) (not (<= y 8.6e+55))) (* 2.0 y) z))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.1e+78) || !(y <= 8.6e+55)) {
tmp = 2.0 * y;
} else {
tmp = 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 <= (-6.1d+78)) .or. (.not. (y <= 8.6d+55))) then
tmp = 2.0d0 * y
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6.1e+78) || !(y <= 8.6e+55)) {
tmp = 2.0 * y;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.1e+78) or not (y <= 8.6e+55): tmp = 2.0 * y else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.1e+78) || !(y <= 8.6e+55)) tmp = Float64(2.0 * y); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6.1e+78) || ~((y <= 8.6e+55))) tmp = 2.0 * y; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.1e+78], N[Not[LessEqual[y, 8.6e+55]], $MachinePrecision]], N[(2.0 * y), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.1 \cdot 10^{+78} \lor \neg \left(y \leq 8.6 \cdot 10^{+55}\right):\\
\;\;\;\;2 \cdot y\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if y < -6.10000000000000011e78 or 8.5999999999999998e55 < y Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
distribute-neg-in99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+r+100.0%
associate--l+99.9%
count-299.9%
*-commutative99.9%
fma-def99.9%
count-299.9%
neg-mul-199.9%
distribute-rgt-out--99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
*-commutative99.9%
*-commutative99.9%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 65.4%
if -6.10000000000000011e78 < y < 8.5999999999999998e55Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
distribute-neg-in99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+r+99.9%
associate--l+99.9%
count-299.9%
*-commutative99.9%
fma-def99.9%
count-299.9%
neg-mul-199.9%
distribute-rgt-out--99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf 48.8%
Final simplification55.3%
(FPCore (x y z) :precision binary64 z)
double code(double x, double y, double z) {
return z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z
end function
public static double code(double x, double y, double z) {
return z;
}
def code(x, y, z): return z
function code(x, y, z) return z end
function tmp = code(x, y, z) tmp = z; end
code[x_, y_, z_] := z
\begin{array}{l}
\\
z
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
distribute-neg-in99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+r+99.9%
associate--l+99.9%
count-299.9%
*-commutative99.9%
fma-def99.9%
count-299.9%
neg-mul-199.9%
distribute-rgt-out--99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf 34.4%
Final simplification34.4%
herbie shell --seed 2023308
(FPCore (x y z)
:name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendInside from plot-0.2.3.4"
:precision binary64
(+ (+ (+ (+ (+ x y) y) x) z) x))