
(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%
associate-+l+99.9%
+-commutative99.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%
add-log-exp24.4%
*-un-lft-identity24.4%
log-prod24.4%
metadata-eval24.4%
add-log-exp99.9%
fma-udef99.9%
+-commutative99.9%
fma-def100.0%
*-commutative100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (+ z (fma y 2.0 (* x 3.0))))
double code(double x, double y, double z) {
return z + fma(y, 2.0, (x * 3.0));
}
function code(x, y, z) return Float64(z + fma(y, 2.0, Float64(x * 3.0))) end
code[x_, y_, z_] := N[(z + N[(y * 2.0 + N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z + \mathsf{fma}\left(y, 2, 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%
associate-+l+99.9%
+-commutative99.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%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= y -3.5e-32)
(* 2.0 y)
(if (<= y -5.5e-300)
z
(if (<= y 4.2e-297)
(* x 3.0)
(if (<= y 1.05e-185)
z
(if (<= y 7e-104)
(* x 3.0)
(if (<= y 1.8e-31) z (if (<= y 2e+80) (* x 3.0) (* 2.0 y)))))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.5e-32) {
tmp = 2.0 * y;
} else if (y <= -5.5e-300) {
tmp = z;
} else if (y <= 4.2e-297) {
tmp = x * 3.0;
} else if (y <= 1.05e-185) {
tmp = z;
} else if (y <= 7e-104) {
tmp = x * 3.0;
} else if (y <= 1.8e-31) {
tmp = z;
} else if (y <= 2e+80) {
tmp = x * 3.0;
} else {
tmp = 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 (y <= (-3.5d-32)) then
tmp = 2.0d0 * y
else if (y <= (-5.5d-300)) then
tmp = z
else if (y <= 4.2d-297) then
tmp = x * 3.0d0
else if (y <= 1.05d-185) then
tmp = z
else if (y <= 7d-104) then
tmp = x * 3.0d0
else if (y <= 1.8d-31) then
tmp = z
else if (y <= 2d+80) then
tmp = x * 3.0d0
else
tmp = 2.0d0 * y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.5e-32) {
tmp = 2.0 * y;
} else if (y <= -5.5e-300) {
tmp = z;
} else if (y <= 4.2e-297) {
tmp = x * 3.0;
} else if (y <= 1.05e-185) {
tmp = z;
} else if (y <= 7e-104) {
tmp = x * 3.0;
} else if (y <= 1.8e-31) {
tmp = z;
} else if (y <= 2e+80) {
tmp = x * 3.0;
} else {
tmp = 2.0 * y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.5e-32: tmp = 2.0 * y elif y <= -5.5e-300: tmp = z elif y <= 4.2e-297: tmp = x * 3.0 elif y <= 1.05e-185: tmp = z elif y <= 7e-104: tmp = x * 3.0 elif y <= 1.8e-31: tmp = z elif y <= 2e+80: tmp = x * 3.0 else: tmp = 2.0 * y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.5e-32) tmp = Float64(2.0 * y); elseif (y <= -5.5e-300) tmp = z; elseif (y <= 4.2e-297) tmp = Float64(x * 3.0); elseif (y <= 1.05e-185) tmp = z; elseif (y <= 7e-104) tmp = Float64(x * 3.0); elseif (y <= 1.8e-31) tmp = z; elseif (y <= 2e+80) tmp = Float64(x * 3.0); else tmp = Float64(2.0 * y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.5e-32) tmp = 2.0 * y; elseif (y <= -5.5e-300) tmp = z; elseif (y <= 4.2e-297) tmp = x * 3.0; elseif (y <= 1.05e-185) tmp = z; elseif (y <= 7e-104) tmp = x * 3.0; elseif (y <= 1.8e-31) tmp = z; elseif (y <= 2e+80) tmp = x * 3.0; else tmp = 2.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.5e-32], N[(2.0 * y), $MachinePrecision], If[LessEqual[y, -5.5e-300], z, If[LessEqual[y, 4.2e-297], N[(x * 3.0), $MachinePrecision], If[LessEqual[y, 1.05e-185], z, If[LessEqual[y, 7e-104], N[(x * 3.0), $MachinePrecision], If[LessEqual[y, 1.8e-31], z, If[LessEqual[y, 2e+80], N[(x * 3.0), $MachinePrecision], N[(2.0 * y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-32}:\\
\;\;\;\;2 \cdot y\\
\mathbf{elif}\;y \leq -5.5 \cdot 10^{-300}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-297}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-185}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-104}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-31}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+80}:\\
\;\;\;\;x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;2 \cdot y\\
\end{array}
\end{array}
if y < -3.4999999999999999e-32 or 2e80 < y Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 67.0%
if -3.4999999999999999e-32 < y < -5.4999999999999999e-300 or 4.20000000000000027e-297 < y < 1.05e-185 or 7.00000000000000057e-104 < y < 1.80000000000000002e-31Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in z around inf 62.8%
if -5.4999999999999999e-300 < y < 4.20000000000000027e-297 or 1.05e-185 < y < 7.00000000000000057e-104 or 1.80000000000000002e-31 < y < 2e80Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 69.2%
Final simplification65.8%
(FPCore (x y z)
:precision binary64
(if (<= x -3.8e+205)
(* x 3.0)
(if (or (<= x -5.7e+137) (and (not (<= x -8.8e+46)) (<= x 4e+80)))
(+ z (* 2.0 y))
(* x 3.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.8e+205) {
tmp = x * 3.0;
} else if ((x <= -5.7e+137) || (!(x <= -8.8e+46) && (x <= 4e+80))) {
tmp = z + (2.0 * y);
} 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 <= (-3.8d+205)) then
tmp = x * 3.0d0
else if ((x <= (-5.7d+137)) .or. (.not. (x <= (-8.8d+46))) .and. (x <= 4d+80)) then
tmp = z + (2.0d0 * y)
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 <= -3.8e+205) {
tmp = x * 3.0;
} else if ((x <= -5.7e+137) || (!(x <= -8.8e+46) && (x <= 4e+80))) {
tmp = z + (2.0 * y);
} else {
tmp = x * 3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.8e+205: tmp = x * 3.0 elif (x <= -5.7e+137) or (not (x <= -8.8e+46) and (x <= 4e+80)): tmp = z + (2.0 * y) else: tmp = x * 3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.8e+205) tmp = Float64(x * 3.0); elseif ((x <= -5.7e+137) || (!(x <= -8.8e+46) && (x <= 4e+80))) tmp = Float64(z + Float64(2.0 * y)); else tmp = Float64(x * 3.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.8e+205) tmp = x * 3.0; elseif ((x <= -5.7e+137) || (~((x <= -8.8e+46)) && (x <= 4e+80))) tmp = z + (2.0 * y); else tmp = x * 3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.8e+205], N[(x * 3.0), $MachinePrecision], If[Or[LessEqual[x, -5.7e+137], And[N[Not[LessEqual[x, -8.8e+46]], $MachinePrecision], LessEqual[x, 4e+80]]], N[(z + N[(2.0 * y), $MachinePrecision]), $MachinePrecision], N[(x * 3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+205}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;x \leq -5.7 \cdot 10^{+137} \lor \neg \left(x \leq -8.8 \cdot 10^{+46}\right) \land x \leq 4 \cdot 10^{+80}:\\
\;\;\;\;z + 2 \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot 3\\
\end{array}
\end{array}
if x < -3.8e205 or -5.6999999999999999e137 < x < -8.8000000000000001e46 or 4e80 < x Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in x around inf 76.2%
if -3.8e205 < x < -5.6999999999999999e137 or -8.8000000000000001e46 < x < 4e80Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around 0 90.8%
Final simplification85.8%
(FPCore (x y z) :precision binary64 (if (<= y -9e-35) (+ z (* 2.0 y)) (if (<= y 7.5e+87) (+ z (* x 3.0)) (+ x (* 2.0 (+ x y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -9e-35) {
tmp = z + (2.0 * y);
} else if (y <= 7.5e+87) {
tmp = z + (x * 3.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 <= (-9d-35)) then
tmp = z + (2.0d0 * y)
else if (y <= 7.5d+87) then
tmp = z + (x * 3.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 <= -9e-35) {
tmp = z + (2.0 * y);
} else if (y <= 7.5e+87) {
tmp = z + (x * 3.0);
} else {
tmp = x + (2.0 * (x + y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9e-35: tmp = z + (2.0 * y) elif y <= 7.5e+87: tmp = z + (x * 3.0) else: tmp = x + (2.0 * (x + y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9e-35) tmp = Float64(z + Float64(2.0 * y)); elseif (y <= 7.5e+87) tmp = Float64(z + Float64(x * 3.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 <= -9e-35) tmp = z + (2.0 * y); elseif (y <= 7.5e+87) tmp = z + (x * 3.0); else tmp = x + (2.0 * (x + y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9e-35], N[(z + N[(2.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+87], N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{-35}:\\
\;\;\;\;z + 2 \cdot y\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+87}:\\
\;\;\;\;z + x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -9.0000000000000002e-35Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around 0 82.0%
if -9.0000000000000002e-35 < y < 7.50000000000000014e87Initial 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%
associate-+l+99.9%
+-commutative99.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.0%
if 7.50000000000000014e87 < y Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in z around 0 86.3%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.4e-37) (not (<= y 3e+87))) (+ z (* 2.0 y)) (+ z (* x 3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.4e-37) || !(y <= 3e+87)) {
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 <= (-4.4d-37)) .or. (.not. (y <= 3d+87))) 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 <= -4.4e-37) || !(y <= 3e+87)) {
tmp = z + (2.0 * y);
} else {
tmp = z + (x * 3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.4e-37) or not (y <= 3e+87): tmp = z + (2.0 * y) else: tmp = z + (x * 3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.4e-37) || !(y <= 3e+87)) 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 <= -4.4e-37) || ~((y <= 3e+87))) tmp = z + (2.0 * y); else tmp = z + (x * 3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.4e-37], N[Not[LessEqual[y, 3e+87]], $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 -4.4 \cdot 10^{-37} \lor \neg \left(y \leq 3 \cdot 10^{+87}\right):\\
\;\;\;\;z + 2 \cdot y\\
\mathbf{else}:\\
\;\;\;\;z + x \cdot 3\\
\end{array}
\end{array}
if y < -4.40000000000000004e-37 or 2.9999999999999999e87 < y Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around 0 84.1%
if -4.40000000000000004e-37 < y < 2.9999999999999999e87Initial 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%
associate-+l+99.9%
+-commutative99.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.9%
Final simplification89.7%
(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 (if (<= y -3.5e-32) (* 2.0 y) (if (<= y 1.25e+89) z (* 2.0 y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.5e-32) {
tmp = 2.0 * y;
} else if (y <= 1.25e+89) {
tmp = z;
} else {
tmp = 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 (y <= (-3.5d-32)) then
tmp = 2.0d0 * y
else if (y <= 1.25d+89) then
tmp = z
else
tmp = 2.0d0 * y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.5e-32) {
tmp = 2.0 * y;
} else if (y <= 1.25e+89) {
tmp = z;
} else {
tmp = 2.0 * y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.5e-32: tmp = 2.0 * y elif y <= 1.25e+89: tmp = z else: tmp = 2.0 * y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.5e-32) tmp = Float64(2.0 * y); elseif (y <= 1.25e+89) tmp = z; else tmp = Float64(2.0 * y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.5e-32) tmp = 2.0 * y; elseif (y <= 1.25e+89) tmp = z; else tmp = 2.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.5e-32], N[(2.0 * y), $MachinePrecision], If[LessEqual[y, 1.25e+89], z, N[(2.0 * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-32}:\\
\;\;\;\;2 \cdot y\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+89}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;2 \cdot y\\
\end{array}
\end{array}
if y < -3.4999999999999999e-32 or 1.24999999999999996e89 < y Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 68.2%
if -3.4999999999999999e-32 < y < 1.24999999999999996e89Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in z around inf 50.1%
Final simplification57.7%
(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 36.2%
Final simplification36.2%
herbie shell --seed 2023274
(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))