
(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 (fma x 3.0 (+ z (* y 2.0))))
double code(double x, double y, double z) {
return fma(x, 3.0, (z + (y * 2.0)));
}
function code(x, y, z) return fma(x, 3.0, Float64(z + Float64(y * 2.0))) end
code[x_, y_, z_] := N[(x * 3.0 + N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, 3, z + y \cdot 2\right)
\end{array}
Initial program 99.9%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval99.9%
Simplified99.9%
associate-+r+N/A
+-commutativeN/A
fma-defineN/A
fma-lowering-fma.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64100.0%
Applied egg-rr100.0%
(FPCore (x y z) :precision binary64 (if (<= x -7.6e+19) (* x 3.0) (if (<= x -7e-237) (+ x z) (if (<= x 1.25e-42) (* y 2.0) (* x 3.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.6e+19) {
tmp = x * 3.0;
} else if (x <= -7e-237) {
tmp = x + z;
} else if (x <= 1.25e-42) {
tmp = 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 <= (-7.6d+19)) then
tmp = x * 3.0d0
else if (x <= (-7d-237)) then
tmp = x + z
else if (x <= 1.25d-42) then
tmp = 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 <= -7.6e+19) {
tmp = x * 3.0;
} else if (x <= -7e-237) {
tmp = x + z;
} else if (x <= 1.25e-42) {
tmp = y * 2.0;
} else {
tmp = x * 3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.6e+19: tmp = x * 3.0 elif x <= -7e-237: tmp = x + z elif x <= 1.25e-42: tmp = y * 2.0 else: tmp = x * 3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.6e+19) tmp = Float64(x * 3.0); elseif (x <= -7e-237) tmp = Float64(x + z); elseif (x <= 1.25e-42) tmp = 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 <= -7.6e+19) tmp = x * 3.0; elseif (x <= -7e-237) tmp = x + z; elseif (x <= 1.25e-42) tmp = y * 2.0; else tmp = x * 3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.6e+19], N[(x * 3.0), $MachinePrecision], If[LessEqual[x, -7e-237], N[(x + z), $MachinePrecision], If[LessEqual[x, 1.25e-42], N[(y * 2.0), $MachinePrecision], N[(x * 3.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{+19}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;x \leq -7 \cdot 10^{-237}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-42}:\\
\;\;\;\;y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;x \cdot 3\\
\end{array}
\end{array}
if x < -7.6e19 or 1.25000000000000001e-42 < x Initial program 99.8%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf
*-lowering-*.f6469.3%
Simplified69.3%
if -7.6e19 < x < -6.99999999999999966e-237Initial program 100.0%
Taylor expanded in z around inf
Simplified52.7%
if -6.99999999999999966e-237 < x < 1.25000000000000001e-42Initial program 100.0%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf
*-lowering-*.f6460.0%
Simplified60.0%
Final simplification63.3%
(FPCore (x y z) :precision binary64 (if (<= x -6.2e+17) (* x 3.0) (if (<= x -3e-237) z (if (<= x 1.35e-42) (* y 2.0) (* x 3.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.2e+17) {
tmp = x * 3.0;
} else if (x <= -3e-237) {
tmp = z;
} else if (x <= 1.35e-42) {
tmp = 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.2d+17)) then
tmp = x * 3.0d0
else if (x <= (-3d-237)) then
tmp = z
else if (x <= 1.35d-42) then
tmp = 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.2e+17) {
tmp = x * 3.0;
} else if (x <= -3e-237) {
tmp = z;
} else if (x <= 1.35e-42) {
tmp = y * 2.0;
} else {
tmp = x * 3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.2e+17: tmp = x * 3.0 elif x <= -3e-237: tmp = z elif x <= 1.35e-42: tmp = y * 2.0 else: tmp = x * 3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.2e+17) tmp = Float64(x * 3.0); elseif (x <= -3e-237) tmp = z; elseif (x <= 1.35e-42) tmp = 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.2e+17) tmp = x * 3.0; elseif (x <= -3e-237) tmp = z; elseif (x <= 1.35e-42) tmp = y * 2.0; else tmp = x * 3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.2e+17], N[(x * 3.0), $MachinePrecision], If[LessEqual[x, -3e-237], z, If[LessEqual[x, 1.35e-42], N[(y * 2.0), $MachinePrecision], N[(x * 3.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+17}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;x \leq -3 \cdot 10^{-237}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-42}:\\
\;\;\;\;y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;x \cdot 3\\
\end{array}
\end{array}
if x < -6.2e17 or 1.35e-42 < x Initial program 99.8%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf
*-lowering-*.f6469.3%
Simplified69.3%
if -6.2e17 < x < -3.00000000000000024e-237Initial program 100.0%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf
Simplified51.2%
if -3.00000000000000024e-237 < x < 1.35e-42Initial program 100.0%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf
*-lowering-*.f6460.0%
Simplified60.0%
Final simplification62.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ z (* x 3.0)))) (if (<= x -4.4e+33) t_0 (if (<= x 2.5e-42) (+ z (* y 2.0)) t_0))))
double code(double x, double y, double z) {
double t_0 = z + (x * 3.0);
double tmp;
if (x <= -4.4e+33) {
tmp = t_0;
} else if (x <= 2.5e-42) {
tmp = z + (y * 2.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 = z + (x * 3.0d0)
if (x <= (-4.4d+33)) then
tmp = t_0
else if (x <= 2.5d-42) then
tmp = z + (y * 2.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z + (x * 3.0);
double tmp;
if (x <= -4.4e+33) {
tmp = t_0;
} else if (x <= 2.5e-42) {
tmp = z + (y * 2.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z + (x * 3.0) tmp = 0 if x <= -4.4e+33: tmp = t_0 elif x <= 2.5e-42: tmp = z + (y * 2.0) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z + Float64(x * 3.0)) tmp = 0.0 if (x <= -4.4e+33) tmp = t_0; elseif (x <= 2.5e-42) tmp = Float64(z + Float64(y * 2.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z + (x * 3.0); tmp = 0.0; if (x <= -4.4e+33) tmp = t_0; elseif (x <= 2.5e-42) tmp = z + (y * 2.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.4e+33], t$95$0, If[LessEqual[x, 2.5e-42], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z + x \cdot 3\\
\mathbf{if}\;x \leq -4.4 \cdot 10^{+33}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-42}:\\
\;\;\;\;z + y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4.39999999999999988e33 or 2.50000000000000001e-42 < x Initial program 99.8%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f6487.4%
Simplified87.4%
if -4.39999999999999988e33 < x < 2.50000000000000001e-42Initial program 100.0%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f6493.5%
Simplified93.5%
Final simplification90.4%
(FPCore (x y z) :precision binary64 (if (<= x -9e+34) (* x 3.0) (if (<= x 4e+57) (+ z (* y 2.0)) (* x 3.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -9e+34) {
tmp = x * 3.0;
} else if (x <= 4e+57) {
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 <= (-9d+34)) then
tmp = x * 3.0d0
else if (x <= 4d+57) 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 <= -9e+34) {
tmp = x * 3.0;
} else if (x <= 4e+57) {
tmp = z + (y * 2.0);
} else {
tmp = x * 3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -9e+34: tmp = x * 3.0 elif x <= 4e+57: tmp = z + (y * 2.0) else: tmp = x * 3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -9e+34) tmp = Float64(x * 3.0); elseif (x <= 4e+57) 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 <= -9e+34) tmp = x * 3.0; elseif (x <= 4e+57) tmp = z + (y * 2.0); else tmp = x * 3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -9e+34], N[(x * 3.0), $MachinePrecision], If[LessEqual[x, 4e+57], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(x * 3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{+34}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+57}:\\
\;\;\;\;z + y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;x \cdot 3\\
\end{array}
\end{array}
if x < -9.0000000000000001e34 or 4.00000000000000019e57 < x Initial program 99.8%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around inf
*-lowering-*.f6474.0%
Simplified74.0%
if -9.0000000000000001e34 < x < 4.00000000000000019e57Initial program 100.0%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f6488.9%
Simplified88.9%
Final simplification82.3%
(FPCore (x y z) :precision binary64 (if (<= y -1.9e-26) (* y 2.0) (if (<= y 5.8e+73) z (* y 2.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.9e-26) {
tmp = y * 2.0;
} else if (y <= 5.8e+73) {
tmp = z;
} 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.9d-26)) then
tmp = y * 2.0d0
else if (y <= 5.8d+73) then
tmp = z
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.9e-26) {
tmp = y * 2.0;
} else if (y <= 5.8e+73) {
tmp = z;
} else {
tmp = y * 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.9e-26: tmp = y * 2.0 elif y <= 5.8e+73: tmp = z else: tmp = y * 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.9e-26) tmp = Float64(y * 2.0); elseif (y <= 5.8e+73) tmp = z; else tmp = Float64(y * 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.9e-26) tmp = y * 2.0; elseif (y <= 5.8e+73) tmp = z; else tmp = y * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.9e-26], N[(y * 2.0), $MachinePrecision], If[LessEqual[y, 5.8e+73], z, N[(y * 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-26}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+73}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;y \cdot 2\\
\end{array}
\end{array}
if y < -1.90000000000000007e-26 or 5.8000000000000005e73 < y Initial program 99.9%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf
*-lowering-*.f6462.9%
Simplified62.9%
if -1.90000000000000007e-26 < y < 5.8000000000000005e73Initial program 99.9%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf
Simplified42.2%
Final simplification50.7%
(FPCore (x y z) :precision binary64 (+ z (+ (* x 3.0) (* y 2.0))))
double code(double x, double y, double z) {
return z + ((x * 3.0) + (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 = z + ((x * 3.0d0) + (y * 2.0d0))
end function
public static double code(double x, double y, double z) {
return z + ((x * 3.0) + (y * 2.0));
}
def code(x, y, z): return z + ((x * 3.0) + (y * 2.0))
function code(x, y, z) return Float64(z + Float64(Float64(x * 3.0) + Float64(y * 2.0))) end
function tmp = code(x, y, z) tmp = z + ((x * 3.0) + (y * 2.0)); end
code[x_, y_, z_] := N[(z + N[(N[(x * 3.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z + \left(x \cdot 3 + y \cdot 2\right)
\end{array}
Initial program 99.9%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval99.9%
Simplified99.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%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
count-2N/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf
Simplified30.9%
(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 99.9%
Taylor expanded in z around inf
Simplified36.8%
Taylor expanded in z around 0
Simplified8.8%
herbie shell --seed 2024138
(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))