
(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 (+ 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 (<= y -1.28e+107)
(* y 2.0)
(if (<= y -1.9e-46)
(+ x z)
(if (<= y -2.7e-222)
(* x 3.0)
(if (<= y 3.2e-250)
(+ x z)
(if (<= y 7.2e-104)
(* x 3.0)
(if (<= y 6.4e+90) (+ x z) (* y 2.0))))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.28e+107) {
tmp = y * 2.0;
} else if (y <= -1.9e-46) {
tmp = x + z;
} else if (y <= -2.7e-222) {
tmp = x * 3.0;
} else if (y <= 3.2e-250) {
tmp = x + z;
} else if (y <= 7.2e-104) {
tmp = x * 3.0;
} else if (y <= 6.4e+90) {
tmp = x + 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.28d+107)) then
tmp = y * 2.0d0
else if (y <= (-1.9d-46)) then
tmp = x + z
else if (y <= (-2.7d-222)) then
tmp = x * 3.0d0
else if (y <= 3.2d-250) then
tmp = x + z
else if (y <= 7.2d-104) then
tmp = x * 3.0d0
else if (y <= 6.4d+90) then
tmp = x + 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.28e+107) {
tmp = y * 2.0;
} else if (y <= -1.9e-46) {
tmp = x + z;
} else if (y <= -2.7e-222) {
tmp = x * 3.0;
} else if (y <= 3.2e-250) {
tmp = x + z;
} else if (y <= 7.2e-104) {
tmp = x * 3.0;
} else if (y <= 6.4e+90) {
tmp = x + z;
} else {
tmp = y * 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.28e+107: tmp = y * 2.0 elif y <= -1.9e-46: tmp = x + z elif y <= -2.7e-222: tmp = x * 3.0 elif y <= 3.2e-250: tmp = x + z elif y <= 7.2e-104: tmp = x * 3.0 elif y <= 6.4e+90: tmp = x + z else: tmp = y * 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.28e+107) tmp = Float64(y * 2.0); elseif (y <= -1.9e-46) tmp = Float64(x + z); elseif (y <= -2.7e-222) tmp = Float64(x * 3.0); elseif (y <= 3.2e-250) tmp = Float64(x + z); elseif (y <= 7.2e-104) tmp = Float64(x * 3.0); elseif (y <= 6.4e+90) tmp = Float64(x + z); else tmp = Float64(y * 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.28e+107) tmp = y * 2.0; elseif (y <= -1.9e-46) tmp = x + z; elseif (y <= -2.7e-222) tmp = x * 3.0; elseif (y <= 3.2e-250) tmp = x + z; elseif (y <= 7.2e-104) tmp = x * 3.0; elseif (y <= 6.4e+90) tmp = x + z; else tmp = y * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.28e+107], N[(y * 2.0), $MachinePrecision], If[LessEqual[y, -1.9e-46], N[(x + z), $MachinePrecision], If[LessEqual[y, -2.7e-222], N[(x * 3.0), $MachinePrecision], If[LessEqual[y, 3.2e-250], N[(x + z), $MachinePrecision], If[LessEqual[y, 7.2e-104], N[(x * 3.0), $MachinePrecision], If[LessEqual[y, 6.4e+90], N[(x + z), $MachinePrecision], N[(y * 2.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.28 \cdot 10^{+107}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;y \leq -1.9 \cdot 10^{-46}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{-222}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-250}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-104}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{+90}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y \cdot 2\\
\end{array}
\end{array}
if y < -1.2799999999999999e107 or 6.39999999999999997e90 < 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-*.f6472.9%
Simplified72.9%
if -1.2799999999999999e107 < y < -1.8999999999999998e-46 or -2.7e-222 < y < 3.20000000000000005e-250 or 7.1999999999999996e-104 < y < 6.39999999999999997e90Initial program 100.0%
Taylor expanded in z around inf
Simplified60.6%
if -1.8999999999999998e-46 < y < -2.7e-222 or 3.20000000000000005e-250 < y < 7.1999999999999996e-104Initial 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-*.f6465.6%
Simplified65.6%
Final simplification66.2%
(FPCore (x y z)
:precision binary64
(if (<= y -9.8e+107)
(* y 2.0)
(if (<= y -2.1e-46)
z
(if (<= y -6.8e-230)
(* x 3.0)
(if (<= y 7.8e-245)
z
(if (<= y 3.3e-103) (* x 3.0) (if (<= y 1.6e+90) z (* y 2.0))))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.8e+107) {
tmp = y * 2.0;
} else if (y <= -2.1e-46) {
tmp = z;
} else if (y <= -6.8e-230) {
tmp = x * 3.0;
} else if (y <= 7.8e-245) {
tmp = z;
} else if (y <= 3.3e-103) {
tmp = x * 3.0;
} else if (y <= 1.6e+90) {
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 <= (-9.8d+107)) then
tmp = y * 2.0d0
else if (y <= (-2.1d-46)) then
tmp = z
else if (y <= (-6.8d-230)) then
tmp = x * 3.0d0
else if (y <= 7.8d-245) then
tmp = z
else if (y <= 3.3d-103) then
tmp = x * 3.0d0
else if (y <= 1.6d+90) 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 <= -9.8e+107) {
tmp = y * 2.0;
} else if (y <= -2.1e-46) {
tmp = z;
} else if (y <= -6.8e-230) {
tmp = x * 3.0;
} else if (y <= 7.8e-245) {
tmp = z;
} else if (y <= 3.3e-103) {
tmp = x * 3.0;
} else if (y <= 1.6e+90) {
tmp = z;
} else {
tmp = y * 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.8e+107: tmp = y * 2.0 elif y <= -2.1e-46: tmp = z elif y <= -6.8e-230: tmp = x * 3.0 elif y <= 7.8e-245: tmp = z elif y <= 3.3e-103: tmp = x * 3.0 elif y <= 1.6e+90: tmp = z else: tmp = y * 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.8e+107) tmp = Float64(y * 2.0); elseif (y <= -2.1e-46) tmp = z; elseif (y <= -6.8e-230) tmp = Float64(x * 3.0); elseif (y <= 7.8e-245) tmp = z; elseif (y <= 3.3e-103) tmp = Float64(x * 3.0); elseif (y <= 1.6e+90) tmp = z; else tmp = Float64(y * 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.8e+107) tmp = y * 2.0; elseif (y <= -2.1e-46) tmp = z; elseif (y <= -6.8e-230) tmp = x * 3.0; elseif (y <= 7.8e-245) tmp = z; elseif (y <= 3.3e-103) tmp = x * 3.0; elseif (y <= 1.6e+90) tmp = z; else tmp = y * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.8e+107], N[(y * 2.0), $MachinePrecision], If[LessEqual[y, -2.1e-46], z, If[LessEqual[y, -6.8e-230], N[(x * 3.0), $MachinePrecision], If[LessEqual[y, 7.8e-245], z, If[LessEqual[y, 3.3e-103], N[(x * 3.0), $MachinePrecision], If[LessEqual[y, 1.6e+90], z, N[(y * 2.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{+107}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-46}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq -6.8 \cdot 10^{-230}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{-245}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-103}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+90}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;y \cdot 2\\
\end{array}
\end{array}
if y < -9.8000000000000003e107 or 1.59999999999999999e90 < 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-*.f6472.9%
Simplified72.9%
if -9.8000000000000003e107 < y < -2.09999999999999987e-46 or -6.8e-230 < y < 7.7999999999999998e-245 or 3.2999999999999999e-103 < y < 1.59999999999999999e90Initial 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 z around inf
Simplified56.6%
if -2.09999999999999987e-46 < y < -6.8e-230 or 7.7999999999999998e-245 < y < 3.2999999999999999e-103Initial 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-*.f6465.6%
Simplified65.6%
Final simplification64.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ z (* x 3.0)))) (if (<= x -1.2e+27) t_0 (if (<= x 2.15e-10) (+ 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 <= -1.2e+27) {
tmp = t_0;
} else if (x <= 2.15e-10) {
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 <= (-1.2d+27)) then
tmp = t_0
else if (x <= 2.15d-10) 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 <= -1.2e+27) {
tmp = t_0;
} else if (x <= 2.15e-10) {
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 <= -1.2e+27: tmp = t_0 elif x <= 2.15e-10: 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 <= -1.2e+27) tmp = t_0; elseif (x <= 2.15e-10) 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 <= -1.2e+27) tmp = t_0; elseif (x <= 2.15e-10) 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, -1.2e+27], t$95$0, If[LessEqual[x, 2.15e-10], 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 -1.2 \cdot 10^{+27}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{-10}:\\
\;\;\;\;z + y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.19999999999999999e27 or 2.15000000000000007e-10 < 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-*.f6483.6%
Simplified83.6%
if -1.19999999999999999e27 < x < 2.15000000000000007e-10Initial 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-*.f6494.1%
Simplified94.1%
Final simplification89.2%
(FPCore (x y z) :precision binary64 (if (<= x -2.3e+28) (* x 3.0) (if (<= x 1.45e+156) (+ z (* y 2.0)) (* x 3.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.3e+28) {
tmp = x * 3.0;
} else if (x <= 1.45e+156) {
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 <= (-2.3d+28)) then
tmp = x * 3.0d0
else if (x <= 1.45d+156) 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 <= -2.3e+28) {
tmp = x * 3.0;
} else if (x <= 1.45e+156) {
tmp = z + (y * 2.0);
} else {
tmp = x * 3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.3e+28: tmp = x * 3.0 elif x <= 1.45e+156: tmp = z + (y * 2.0) else: tmp = x * 3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.3e+28) tmp = Float64(x * 3.0); elseif (x <= 1.45e+156) 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 <= -2.3e+28) tmp = x * 3.0; elseif (x <= 1.45e+156) tmp = z + (y * 2.0); else tmp = x * 3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.3e+28], N[(x * 3.0), $MachinePrecision], If[LessEqual[x, 1.45e+156], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(x * 3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+28}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+156}:\\
\;\;\;\;z + y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;x \cdot 3\\
\end{array}
\end{array}
if x < -2.29999999999999984e28 or 1.45000000000000005e156 < 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-*.f6471.2%
Simplified71.2%
if -2.29999999999999984e28 < x < 1.45000000000000005e156Initial 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-eval100.0%
Simplified100.0%
Taylor expanded in x around 0
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f6488.7%
Simplified88.7%
Final simplification82.6%
(FPCore (x y z) :precision binary64 (if (<= z -1.16e+80) (+ x z) (if (<= z 8.1e+93) (+ x (* y 2.0)) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.16e+80) {
tmp = x + z;
} else if (z <= 8.1e+93) {
tmp = x + (y * 2.0);
} else {
tmp = x + 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.16d+80)) then
tmp = x + z
else if (z <= 8.1d+93) then
tmp = x + (y * 2.0d0)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.16e+80) {
tmp = x + z;
} else if (z <= 8.1e+93) {
tmp = x + (y * 2.0);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.16e+80: tmp = x + z elif z <= 8.1e+93: tmp = x + (y * 2.0) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.16e+80) tmp = Float64(x + z); elseif (z <= 8.1e+93) tmp = Float64(x + Float64(y * 2.0)); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.16e+80) tmp = x + z; elseif (z <= 8.1e+93) tmp = x + (y * 2.0); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.16e+80], N[(x + z), $MachinePrecision], If[LessEqual[z, 8.1e+93], N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.16 \cdot 10^{+80}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 8.1 \cdot 10^{+93}:\\
\;\;\;\;x + y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if z < -1.15999999999999997e80 or 8.09999999999999983e93 < z Initial program 99.9%
Taylor expanded in z around inf
Simplified72.8%
if -1.15999999999999997e80 < z < 8.09999999999999983e93Initial program 99.9%
Taylor expanded in y around inf
*-lowering-*.f6454.6%
Simplified54.6%
Final simplification61.3%
(FPCore (x y z) :precision binary64 (if (<= z -3.3e+70) z (if (<= z 7.6e+93) (* y 2.0) z)))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.3e+70) {
tmp = z;
} else if (z <= 7.6e+93) {
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.3d+70)) then
tmp = z
else if (z <= 7.6d+93) 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.3e+70) {
tmp = z;
} else if (z <= 7.6e+93) {
tmp = y * 2.0;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.3e+70: tmp = z elif z <= 7.6e+93: tmp = y * 2.0 else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.3e+70) tmp = z; elseif (z <= 7.6e+93) 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.3e+70) tmp = z; elseif (z <= 7.6e+93) tmp = y * 2.0; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.3e+70], z, If[LessEqual[z, 7.6e+93], N[(y * 2.0), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+70}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+93}:\\
\;\;\;\;y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -3.30000000000000016e70 or 7.5999999999999996e93 < z 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-eval100.0%
Simplified100.0%
Taylor expanded in z around inf
Simplified69.9%
if -3.30000000000000016e70 < z < 7.5999999999999996e93Initial 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-*.f6448.6%
Simplified48.6%
Final simplification56.6%
(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
Simplified34.1%
(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
Simplified39.1%
Taylor expanded in z around 0
Simplified7.8%
herbie shell --seed 2024158
(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))