
(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 3.0 x (* y 2.0))))
double code(double x, double y, double z) {
return z + fma(3.0, x, (y * 2.0));
}
function code(x, y, z) return Float64(z + fma(3.0, x, Float64(y * 2.0))) end
code[x_, y_, z_] := N[(z + N[(3.0 * x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z + \mathsf{fma}\left(3, x, y \cdot 2\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
+-commutative99.9%
count-299.9%
distribute-lft1-in99.9%
fma-def100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= z -1.9e+105)
z
(if (<= z -1.2e+72)
(* y 2.0)
(if (<= z -4.7e+33)
z
(if (<= z 6.5e-266)
(* 3.0 x)
(if (<= z 6.5e-234) (* y 2.0) (if (<= z 6.4e+96) (* 3.0 x) z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.9e+105) {
tmp = z;
} else if (z <= -1.2e+72) {
tmp = y * 2.0;
} else if (z <= -4.7e+33) {
tmp = z;
} else if (z <= 6.5e-266) {
tmp = 3.0 * x;
} else if (z <= 6.5e-234) {
tmp = y * 2.0;
} else if (z <= 6.4e+96) {
tmp = 3.0 * x;
} 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 <= (-1.9d+105)) then
tmp = z
else if (z <= (-1.2d+72)) then
tmp = y * 2.0d0
else if (z <= (-4.7d+33)) then
tmp = z
else if (z <= 6.5d-266) then
tmp = 3.0d0 * x
else if (z <= 6.5d-234) then
tmp = y * 2.0d0
else if (z <= 6.4d+96) then
tmp = 3.0d0 * x
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.9e+105) {
tmp = z;
} else if (z <= -1.2e+72) {
tmp = y * 2.0;
} else if (z <= -4.7e+33) {
tmp = z;
} else if (z <= 6.5e-266) {
tmp = 3.0 * x;
} else if (z <= 6.5e-234) {
tmp = y * 2.0;
} else if (z <= 6.4e+96) {
tmp = 3.0 * x;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.9e+105: tmp = z elif z <= -1.2e+72: tmp = y * 2.0 elif z <= -4.7e+33: tmp = z elif z <= 6.5e-266: tmp = 3.0 * x elif z <= 6.5e-234: tmp = y * 2.0 elif z <= 6.4e+96: tmp = 3.0 * x else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.9e+105) tmp = z; elseif (z <= -1.2e+72) tmp = Float64(y * 2.0); elseif (z <= -4.7e+33) tmp = z; elseif (z <= 6.5e-266) tmp = Float64(3.0 * x); elseif (z <= 6.5e-234) tmp = Float64(y * 2.0); elseif (z <= 6.4e+96) tmp = Float64(3.0 * x); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.9e+105) tmp = z; elseif (z <= -1.2e+72) tmp = y * 2.0; elseif (z <= -4.7e+33) tmp = z; elseif (z <= 6.5e-266) tmp = 3.0 * x; elseif (z <= 6.5e-234) tmp = y * 2.0; elseif (z <= 6.4e+96) tmp = 3.0 * x; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.9e+105], z, If[LessEqual[z, -1.2e+72], N[(y * 2.0), $MachinePrecision], If[LessEqual[z, -4.7e+33], z, If[LessEqual[z, 6.5e-266], N[(3.0 * x), $MachinePrecision], If[LessEqual[z, 6.5e-234], N[(y * 2.0), $MachinePrecision], If[LessEqual[z, 6.4e+96], N[(3.0 * x), $MachinePrecision], z]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+105}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{+72}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;z \leq -4.7 \cdot 10^{+33}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-266}:\\
\;\;\;\;3 \cdot x\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-234}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{+96}:\\
\;\;\;\;3 \cdot x\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -1.9e105 or -1.20000000000000005e72 < z < -4.6999999999999998e33 or 6.40000000000000013e96 < z Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
+-commutative99.9%
count-299.9%
distribute-lft1-in99.9%
fma-def100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 82.8%
if -1.9e105 < z < -1.20000000000000005e72 or 6.50000000000000024e-266 < z < 6.4999999999999994e-234Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
+-commutative100.0%
associate-+l+100.0%
associate-+r+100.0%
associate-+r+100.0%
+-commutative100.0%
count-2100.0%
distribute-lft1-in100.0%
fma-def100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 92.5%
if -4.6999999999999998e33 < z < 6.50000000000000024e-266 or 6.4999999999999994e-234 < z < 6.40000000000000013e96Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
associate-+r+99.8%
associate-+r+99.8%
+-commutative99.8%
count-299.8%
distribute-lft1-in99.8%
fma-def99.9%
metadata-eval99.9%
count-299.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 55.4%
Final simplification66.5%
(FPCore (x y z) :precision binary64 (if (<= y -3.2e+72) (+ z (* y 2.0)) (if (<= y 4.8e+27) (+ z (* 3.0 x)) (+ x (* 2.0 (+ x y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.2e+72) {
tmp = z + (y * 2.0);
} else if (y <= 4.8e+27) {
tmp = z + (3.0 * x);
} else {
tmp = x + (2.0 * (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 (y <= (-3.2d+72)) then
tmp = z + (y * 2.0d0)
else if (y <= 4.8d+27) then
tmp = z + (3.0d0 * x)
else
tmp = x + (2.0d0 * (x + y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.2e+72) {
tmp = z + (y * 2.0);
} else if (y <= 4.8e+27) {
tmp = z + (3.0 * x);
} else {
tmp = x + (2.0 * (x + y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.2e+72: tmp = z + (y * 2.0) elif y <= 4.8e+27: tmp = z + (3.0 * x) else: tmp = x + (2.0 * (x + y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.2e+72) tmp = Float64(z + Float64(y * 2.0)); elseif (y <= 4.8e+27) tmp = Float64(z + Float64(3.0 * x)); else tmp = Float64(x + Float64(2.0 * Float64(x + y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.2e+72) tmp = z + (y * 2.0); elseif (y <= 4.8e+27) tmp = z + (3.0 * x); else tmp = x + (2.0 * (x + y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.2e+72], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+27], N[(z + N[(3.0 * x), $MachinePrecision]), $MachinePrecision], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+72}:\\
\;\;\;\;z + y \cdot 2\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+27}:\\
\;\;\;\;z + 3 \cdot x\\
\mathbf{else}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -3.2000000000000001e72Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
associate-+r+99.8%
associate-+r+99.9%
+-commutative99.9%
count-299.9%
distribute-lft1-in99.9%
fma-def100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 81.2%
+-commutative81.2%
Simplified81.2%
if -3.2000000000000001e72 < y < 4.79999999999999995e27Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
associate-+r+99.8%
associate-+r+99.8%
+-commutative99.8%
count-299.8%
distribute-lft1-in99.8%
fma-def99.9%
metadata-eval99.9%
count-299.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 92.4%
+-commutative92.4%
Simplified92.4%
if 4.79999999999999995e27 < y Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
associate-+l+100.0%
count-2100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 86.0%
Final simplification89.2%
(FPCore (x y z) :precision binary64 (if (<= y -7e+71) (+ z (* y 2.0)) (if (<= y 1.02e+26) (+ x (+ z (* x 2.0))) (+ x (* 2.0 (+ x y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7e+71) {
tmp = z + (y * 2.0);
} else if (y <= 1.02e+26) {
tmp = x + (z + (x * 2.0));
} else {
tmp = x + (2.0 * (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 (y <= (-7d+71)) then
tmp = z + (y * 2.0d0)
else if (y <= 1.02d+26) then
tmp = x + (z + (x * 2.0d0))
else
tmp = x + (2.0d0 * (x + y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7e+71) {
tmp = z + (y * 2.0);
} else if (y <= 1.02e+26) {
tmp = x + (z + (x * 2.0));
} else {
tmp = x + (2.0 * (x + y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7e+71: tmp = z + (y * 2.0) elif y <= 1.02e+26: tmp = x + (z + (x * 2.0)) else: tmp = x + (2.0 * (x + y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7e+71) tmp = Float64(z + Float64(y * 2.0)); elseif (y <= 1.02e+26) tmp = Float64(x + Float64(z + Float64(x * 2.0))); else tmp = Float64(x + Float64(2.0 * Float64(x + y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7e+71) tmp = z + (y * 2.0); elseif (y <= 1.02e+26) tmp = x + (z + (x * 2.0)); else tmp = x + (2.0 * (x + y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7e+71], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.02e+26], N[(x + N[(z + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+71}:\\
\;\;\;\;z + y \cdot 2\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{+26}:\\
\;\;\;\;x + \left(z + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -6.9999999999999998e71Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
associate-+r+99.8%
associate-+r+99.9%
+-commutative99.9%
count-299.9%
distribute-lft1-in99.9%
fma-def100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 81.2%
+-commutative81.2%
Simplified81.2%
if -6.9999999999999998e71 < y < 1.0200000000000001e26Initial program 99.8%
associate-+l+99.8%
+-commutative99.8%
associate-+l+99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 92.4%
if 1.0200000000000001e26 < y Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
associate-+l+100.0%
count-2100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 86.0%
Final simplification89.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.15e+89) (not (<= x 3.6e+79))) (* 3.0 x) (+ z (* y 2.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.15e+89) || !(x <= 3.6e+79)) {
tmp = 3.0 * x;
} else {
tmp = z + (y * 2.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.15d+89)) .or. (.not. (x <= 3.6d+79))) then
tmp = 3.0d0 * x
else
tmp = z + (y * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.15e+89) || !(x <= 3.6e+79)) {
tmp = 3.0 * x;
} else {
tmp = z + (y * 2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.15e+89) or not (x <= 3.6e+79): tmp = 3.0 * x else: tmp = z + (y * 2.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.15e+89) || !(x <= 3.6e+79)) tmp = Float64(3.0 * x); else tmp = Float64(z + Float64(y * 2.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.15e+89) || ~((x <= 3.6e+79))) tmp = 3.0 * x; else tmp = z + (y * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.15e+89], N[Not[LessEqual[x, 3.6e+79]], $MachinePrecision]], N[(3.0 * x), $MachinePrecision], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.15 \cdot 10^{+89} \lor \neg \left(x \leq 3.6 \cdot 10^{+79}\right):\\
\;\;\;\;3 \cdot x\\
\mathbf{else}:\\
\;\;\;\;z + y \cdot 2\\
\end{array}
\end{array}
if x < -2.1500000000000001e89 or 3.5999999999999999e79 < x Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
associate-+r+99.8%
associate-+r+99.8%
+-commutative99.8%
count-299.8%
distribute-lft1-in99.8%
fma-def99.9%
metadata-eval99.9%
count-299.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 75.9%
if -2.1500000000000001e89 < x < 3.5999999999999999e79Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
+-commutative99.9%
count-299.9%
distribute-lft1-in99.9%
fma-def100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 85.5%
+-commutative85.5%
Simplified85.5%
Final simplification82.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -6.8e+84) (not (<= x 3.9e-104))) (+ z (* 3.0 x)) (+ z (* y 2.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -6.8e+84) || !(x <= 3.9e-104)) {
tmp = z + (3.0 * x);
} else {
tmp = z + (y * 2.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 <= (-6.8d+84)) .or. (.not. (x <= 3.9d-104))) then
tmp = z + (3.0d0 * x)
else
tmp = z + (y * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -6.8e+84) || !(x <= 3.9e-104)) {
tmp = z + (3.0 * x);
} else {
tmp = z + (y * 2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -6.8e+84) or not (x <= 3.9e-104): tmp = z + (3.0 * x) else: tmp = z + (y * 2.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -6.8e+84) || !(x <= 3.9e-104)) tmp = Float64(z + Float64(3.0 * x)); else tmp = Float64(z + Float64(y * 2.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -6.8e+84) || ~((x <= 3.9e-104))) tmp = z + (3.0 * x); else tmp = z + (y * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -6.8e+84], N[Not[LessEqual[x, 3.9e-104]], $MachinePrecision]], N[(z + N[(3.0 * x), $MachinePrecision]), $MachinePrecision], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+84} \lor \neg \left(x \leq 3.9 \cdot 10^{-104}\right):\\
\;\;\;\;z + 3 \cdot x\\
\mathbf{else}:\\
\;\;\;\;z + y \cdot 2\\
\end{array}
\end{array}
if x < -6.7999999999999996e84 or 3.9000000000000002e-104 < x Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
associate-+r+99.8%
associate-+r+99.8%
+-commutative99.8%
count-299.8%
distribute-lft1-in99.8%
fma-def99.9%
metadata-eval99.9%
count-299.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 85.2%
+-commutative85.2%
Simplified85.2%
if -6.7999999999999996e84 < x < 3.9000000000000002e-104Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
+-commutative99.9%
count-299.9%
distribute-lft1-in99.9%
fma-def100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 91.2%
+-commutative91.2%
Simplified91.2%
Final simplification88.1%
(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-+l+99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.4e+94) (not (<= y 1.26e+25))) (* y 2.0) z))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.4e+94) || !(y <= 1.26e+25)) {
tmp = y * 2.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 ((y <= (-2.4d+94)) .or. (.not. (y <= 1.26d+25))) then
tmp = y * 2.0d0
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.4e+94) || !(y <= 1.26e+25)) {
tmp = y * 2.0;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.4e+94) or not (y <= 1.26e+25): tmp = y * 2.0 else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.4e+94) || !(y <= 1.26e+25)) tmp = Float64(y * 2.0); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.4e+94) || ~((y <= 1.26e+25))) tmp = y * 2.0; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.4e+94], N[Not[LessEqual[y, 1.26e+25]], $MachinePrecision]], N[(y * 2.0), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+94} \lor \neg \left(y \leq 1.26 \cdot 10^{+25}\right):\\
\;\;\;\;y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if y < -2.39999999999999983e94 or 1.26000000000000008e25 < y Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
+-commutative99.9%
count-299.9%
distribute-lft1-in99.9%
fma-def100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 55.9%
if -2.39999999999999983e94 < y < 1.26000000000000008e25Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
associate-+r+99.8%
associate-+r+99.8%
+-commutative99.8%
count-299.8%
distribute-lft1-in99.8%
fma-def99.9%
metadata-eval99.9%
count-299.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 49.0%
Final simplification51.5%
(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%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
+-commutative99.9%
count-299.9%
distribute-lft1-in99.9%
fma-def100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 37.5%
Final simplification37.5%
herbie shell --seed 2023301
(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))