
(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 10 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 (fma x 3.0 (fma y 2.0 z)))
double code(double x, double y, double z) {
return fma(x, 3.0, fma(y, 2.0, z));
}
function code(x, y, z) return fma(x, 3.0, fma(y, 2.0, z)) end
code[x_, y_, z_] := N[(x * 3.0 + N[(y * 2.0 + z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, 3, \mathsf{fma}\left(y, 2, z\right)\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
count-299.9%
associate-+l+99.9%
associate-+r+99.9%
distribute-rgt1-in99.9%
*-commutative99.9%
fma-def100.0%
metadata-eval100.0%
count-2100.0%
*-commutative100.0%
fma-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= y -1.35e+158)
(* y 2.0)
(if (<= y -2.1e+110)
z
(if (<= y -1.4e-14)
(* y 2.0)
(if (<= y -1.6e-58) z (if (<= y 2e-67) (* x 3.0) (* y 2.0)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.35e+158) {
tmp = y * 2.0;
} else if (y <= -2.1e+110) {
tmp = z;
} else if (y <= -1.4e-14) {
tmp = y * 2.0;
} else if (y <= -1.6e-58) {
tmp = z;
} else if (y <= 2e-67) {
tmp = x * 3.0;
} else {
tmp = 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 (y <= (-1.35d+158)) then
tmp = y * 2.0d0
else if (y <= (-2.1d+110)) then
tmp = z
else if (y <= (-1.4d-14)) then
tmp = y * 2.0d0
else if (y <= (-1.6d-58)) then
tmp = z
else if (y <= 2d-67) then
tmp = x * 3.0d0
else
tmp = y * 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.35e+158) {
tmp = y * 2.0;
} else if (y <= -2.1e+110) {
tmp = z;
} else if (y <= -1.4e-14) {
tmp = y * 2.0;
} else if (y <= -1.6e-58) {
tmp = z;
} else if (y <= 2e-67) {
tmp = x * 3.0;
} else {
tmp = y * 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.35e+158: tmp = y * 2.0 elif y <= -2.1e+110: tmp = z elif y <= -1.4e-14: tmp = y * 2.0 elif y <= -1.6e-58: tmp = z elif y <= 2e-67: tmp = x * 3.0 else: tmp = y * 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.35e+158) tmp = Float64(y * 2.0); elseif (y <= -2.1e+110) tmp = z; elseif (y <= -1.4e-14) tmp = Float64(y * 2.0); elseif (y <= -1.6e-58) tmp = z; elseif (y <= 2e-67) tmp = Float64(x * 3.0); else tmp = Float64(y * 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.35e+158) tmp = y * 2.0; elseif (y <= -2.1e+110) tmp = z; elseif (y <= -1.4e-14) tmp = y * 2.0; elseif (y <= -1.6e-58) tmp = z; elseif (y <= 2e-67) tmp = x * 3.0; else tmp = y * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.35e+158], N[(y * 2.0), $MachinePrecision], If[LessEqual[y, -2.1e+110], z, If[LessEqual[y, -1.4e-14], N[(y * 2.0), $MachinePrecision], If[LessEqual[y, -1.6e-58], z, If[LessEqual[y, 2e-67], N[(x * 3.0), $MachinePrecision], N[(y * 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+158}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{+110}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-14}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-58}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-67}:\\
\;\;\;\;x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;y \cdot 2\\
\end{array}
\end{array}
if y < -1.34999999999999989e158 or -2.10000000000000015e110 < y < -1.4e-14 or 1.99999999999999989e-67 < y Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 60.2%
if -1.34999999999999989e158 < y < -2.10000000000000015e110 or -1.4e-14 < y < -1.6e-58Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in z around inf 66.4%
if -1.6e-58 < y < 1.99999999999999989e-67Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in x around inf 65.7%
Final simplification63.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ z (* y 2.0))))
(if (<= y -1.1e-25)
t_0
(if (<= y 3.1e-54)
(+ z (* x 3.0))
(if (<= y 8.2e+34) (+ x (* 2.0 (+ x y))) t_0)))))
double code(double x, double y, double z) {
double t_0 = z + (y * 2.0);
double tmp;
if (y <= -1.1e-25) {
tmp = t_0;
} else if (y <= 3.1e-54) {
tmp = z + (x * 3.0);
} else if (y <= 8.2e+34) {
tmp = x + (2.0 * (x + y));
} 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 = z + (y * 2.0d0)
if (y <= (-1.1d-25)) then
tmp = t_0
else if (y <= 3.1d-54) then
tmp = z + (x * 3.0d0)
else if (y <= 8.2d+34) then
tmp = x + (2.0d0 * (x + y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z + (y * 2.0);
double tmp;
if (y <= -1.1e-25) {
tmp = t_0;
} else if (y <= 3.1e-54) {
tmp = z + (x * 3.0);
} else if (y <= 8.2e+34) {
tmp = x + (2.0 * (x + y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z + (y * 2.0) tmp = 0 if y <= -1.1e-25: tmp = t_0 elif y <= 3.1e-54: tmp = z + (x * 3.0) elif y <= 8.2e+34: tmp = x + (2.0 * (x + y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z + Float64(y * 2.0)) tmp = 0.0 if (y <= -1.1e-25) tmp = t_0; elseif (y <= 3.1e-54) tmp = Float64(z + Float64(x * 3.0)); elseif (y <= 8.2e+34) tmp = Float64(x + Float64(2.0 * Float64(x + y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z + (y * 2.0); tmp = 0.0; if (y <= -1.1e-25) tmp = t_0; elseif (y <= 3.1e-54) tmp = z + (x * 3.0); elseif (y <= 8.2e+34) tmp = x + (2.0 * (x + y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.1e-25], t$95$0, If[LessEqual[y, 3.1e-54], N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e+34], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z + y \cdot 2\\
\mathbf{if}\;y \leq -1.1 \cdot 10^{-25}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{-54}:\\
\;\;\;\;z + x \cdot 3\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+34}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.1000000000000001e-25 or 8.1999999999999997e34 < y Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around 0 88.5%
if -1.1000000000000001e-25 < y < 3.10000000000000004e-54Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 96.7%
if 3.10000000000000004e-54 < y < 8.1999999999999997e34Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in z around 0 80.6%
Final simplification91.2%
(FPCore (x y z)
:precision binary64
(if (<= z -3.1e+50)
z
(if (<= z 4.9e-46)
(* y 2.0)
(if (<= z 65000000000.0) z (if (<= z 2.3e+87) (* y 2.0) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.1e+50) {
tmp = z;
} else if (z <= 4.9e-46) {
tmp = y * 2.0;
} else if (z <= 65000000000.0) {
tmp = z;
} else if (z <= 2.3e+87) {
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 (z <= (-3.1d+50)) then
tmp = z
else if (z <= 4.9d-46) then
tmp = y * 2.0d0
else if (z <= 65000000000.0d0) then
tmp = z
else if (z <= 2.3d+87) 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 (z <= -3.1e+50) {
tmp = z;
} else if (z <= 4.9e-46) {
tmp = y * 2.0;
} else if (z <= 65000000000.0) {
tmp = z;
} else if (z <= 2.3e+87) {
tmp = y * 2.0;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.1e+50: tmp = z elif z <= 4.9e-46: tmp = y * 2.0 elif z <= 65000000000.0: tmp = z elif z <= 2.3e+87: tmp = y * 2.0 else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.1e+50) tmp = z; elseif (z <= 4.9e-46) tmp = Float64(y * 2.0); elseif (z <= 65000000000.0) tmp = z; elseif (z <= 2.3e+87) tmp = Float64(y * 2.0); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.1e+50) tmp = z; elseif (z <= 4.9e-46) tmp = y * 2.0; elseif (z <= 65000000000.0) tmp = z; elseif (z <= 2.3e+87) tmp = y * 2.0; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.1e+50], z, If[LessEqual[z, 4.9e-46], N[(y * 2.0), $MachinePrecision], If[LessEqual[z, 65000000000.0], z, If[LessEqual[z, 2.3e+87], N[(y * 2.0), $MachinePrecision], z]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+50}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{-46}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;z \leq 65000000000:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+87}:\\
\;\;\;\;y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -3.10000000000000003e50 or 4.9000000000000001e-46 < z < 6.5e10 or 2.3000000000000002e87 < z Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in z around inf 63.6%
if -3.10000000000000003e50 < z < 4.9000000000000001e-46 or 6.5e10 < z < 2.3000000000000002e87Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 49.2%
Final simplification55.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.2e+57) (not (<= x 4.7e+51))) (+ z (* x 3.0)) (+ z (* y 2.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.2e+57) || !(x <= 4.7e+51)) {
tmp = z + (x * 3.0);
} 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 <= (-1.2d+57)) .or. (.not. (x <= 4.7d+51))) then
tmp = z + (x * 3.0d0)
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 <= -1.2e+57) || !(x <= 4.7e+51)) {
tmp = z + (x * 3.0);
} else {
tmp = z + (y * 2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.2e+57) or not (x <= 4.7e+51): tmp = z + (x * 3.0) else: tmp = z + (y * 2.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.2e+57) || !(x <= 4.7e+51)) tmp = Float64(z + Float64(x * 3.0)); else tmp = Float64(z + Float64(y * 2.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.2e+57) || ~((x <= 4.7e+51))) tmp = z + (x * 3.0); else tmp = z + (y * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.2e+57], N[Not[LessEqual[x, 4.7e+51]], $MachinePrecision]], N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{+57} \lor \neg \left(x \leq 4.7 \cdot 10^{+51}\right):\\
\;\;\;\;z + x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;z + y \cdot 2\\
\end{array}
\end{array}
if x < -1.20000000000000002e57 or 4.7000000000000002e51 < x Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in y around 0 88.3%
if -1.20000000000000002e57 < x < 4.7000000000000002e51Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around 0 88.0%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (<= x -6.6e+123) (* x 3.0) (if (<= x 1.8e+160) (+ z (* y 2.0)) (* x 3.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.6e+123) {
tmp = x * 3.0;
} else if (x <= 1.8e+160) {
tmp = z + (y * 2.0);
} else {
tmp = 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 (x <= (-6.6d+123)) then
tmp = x * 3.0d0
else if (x <= 1.8d+160) then
tmp = z + (y * 2.0d0)
else
tmp = x * 3.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6.6e+123) {
tmp = x * 3.0;
} else if (x <= 1.8e+160) {
tmp = z + (y * 2.0);
} else {
tmp = x * 3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.6e+123: tmp = x * 3.0 elif x <= 1.8e+160: tmp = z + (y * 2.0) else: tmp = x * 3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.6e+123) tmp = Float64(x * 3.0); elseif (x <= 1.8e+160) tmp = Float64(z + Float64(y * 2.0)); else tmp = Float64(x * 3.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6.6e+123) tmp = x * 3.0; elseif (x <= 1.8e+160) tmp = z + (y * 2.0); else tmp = x * 3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.6e+123], N[(x * 3.0), $MachinePrecision], If[LessEqual[x, 1.8e+160], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(x * 3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.6 \cdot 10^{+123}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+160}:\\
\;\;\;\;z + y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;x \cdot 3\\
\end{array}
\end{array}
if x < -6.60000000000000006e123 or 1.80000000000000011e160 < x Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in x around inf 81.3%
if -6.60000000000000006e123 < x < 1.80000000000000011e160Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around 0 82.0%
Final simplification81.8%
(FPCore (x y z) :precision binary64 (if (<= x -7e+56) (+ (* x 2.0) (+ x z)) (if (<= x 7e+47) (+ z (* y 2.0)) (+ z (* x 3.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7e+56) {
tmp = (x * 2.0) + (x + z);
} else if (x <= 7e+47) {
tmp = z + (y * 2.0);
} 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 (x <= (-7d+56)) then
tmp = (x * 2.0d0) + (x + z)
else if (x <= 7d+47) then
tmp = z + (y * 2.0d0)
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 (x <= -7e+56) {
tmp = (x * 2.0) + (x + z);
} else if (x <= 7e+47) {
tmp = z + (y * 2.0);
} else {
tmp = z + (x * 3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7e+56: tmp = (x * 2.0) + (x + z) elif x <= 7e+47: tmp = z + (y * 2.0) else: tmp = z + (x * 3.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7e+56) tmp = Float64(Float64(x * 2.0) + Float64(x + z)); elseif (x <= 7e+47) tmp = Float64(z + Float64(y * 2.0)); else tmp = Float64(z + Float64(x * 3.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7e+56) tmp = (x * 2.0) + (x + z); elseif (x <= 7e+47) tmp = z + (y * 2.0); else tmp = z + (x * 3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7e+56], N[(N[(x * 2.0), $MachinePrecision] + N[(x + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7e+47], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{+56}:\\
\;\;\;\;x \cdot 2 + \left(x + z\right)\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+47}:\\
\;\;\;\;z + y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z + x \cdot 3\\
\end{array}
\end{array}
if x < -6.99999999999999999e56Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around 0 90.9%
if -6.99999999999999999e56 < x < 7.00000000000000031e47Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around 0 88.0%
if 7.00000000000000031e47 < x Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in y around 0 85.7%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (+ x (+ z (* 2.0 (+ x y)))))
double code(double x, double y, double z) {
return x + (z + (2.0 * (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 + (z + (2.0d0 * (x + y)))
end function
public static double code(double x, double y, double z) {
return x + (z + (2.0 * (x + y)));
}
def code(x, y, z): return x + (z + (2.0 * (x + y)))
function code(x, y, z) return Float64(x + Float64(z + Float64(2.0 * Float64(x + y)))) end
function tmp = code(x, y, z) tmp = x + (z + (2.0 * (x + y))); end
code[x_, y_, z_] := N[(x + N[(z + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z + 2 \cdot \left(x + y\right)\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (+ (* x 3.0) (+ z (* y 2.0))))
double code(double x, double y, double z) {
return (x * 3.0) + (z + (y * 2.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 * 3.0d0) + (z + (y * 2.0d0))
end function
public static double code(double x, double y, double z) {
return (x * 3.0) + (z + (y * 2.0));
}
def code(x, y, z): return (x * 3.0) + (z + (y * 2.0))
function code(x, y, z) return Float64(Float64(x * 3.0) + Float64(z + Float64(y * 2.0))) end
function tmp = code(x, y, z) tmp = (x * 3.0) + (z + (y * 2.0)); end
code[x_, y_, z_] := N[(N[(x * 3.0), $MachinePrecision] + N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 3 + \left(z + y \cdot 2\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Final simplification99.9%
(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%
count-299.9%
Simplified99.9%
Taylor expanded in z around inf 33.0%
Final simplification33.0%
herbie shell --seed 2023200
(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))