
(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 8 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%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.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 99.9%
+-commutative99.9%
*-commutative99.9%
*-commutative99.9%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (or (<= x -2.05e+185)
(not
(or (<= x -4.7e+157) (and (not (<= x -3.1e+111)) (<= x 2.7e+110)))))
(* x 3.0)
(+ z (* 2.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.05e+185) || !((x <= -4.7e+157) || (!(x <= -3.1e+111) && (x <= 2.7e+110)))) {
tmp = x * 3.0;
} else {
tmp = z + (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 ((x <= (-2.05d+185)) .or. (.not. (x <= (-4.7d+157)) .or. (.not. (x <= (-3.1d+111))) .and. (x <= 2.7d+110))) then
tmp = x * 3.0d0
else
tmp = z + (2.0d0 * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.05e+185) || !((x <= -4.7e+157) || (!(x <= -3.1e+111) && (x <= 2.7e+110)))) {
tmp = x * 3.0;
} else {
tmp = z + (2.0 * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.05e+185) or not ((x <= -4.7e+157) or (not (x <= -3.1e+111) and (x <= 2.7e+110))): tmp = x * 3.0 else: tmp = z + (2.0 * y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.05e+185) || !((x <= -4.7e+157) || (!(x <= -3.1e+111) && (x <= 2.7e+110)))) tmp = Float64(x * 3.0); else tmp = Float64(z + Float64(2.0 * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.05e+185) || ~(((x <= -4.7e+157) || (~((x <= -3.1e+111)) && (x <= 2.7e+110))))) tmp = x * 3.0; else tmp = z + (2.0 * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.05e+185], N[Not[Or[LessEqual[x, -4.7e+157], And[N[Not[LessEqual[x, -3.1e+111]], $MachinePrecision], LessEqual[x, 2.7e+110]]]], $MachinePrecision]], N[(x * 3.0), $MachinePrecision], N[(z + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.05 \cdot 10^{+185} \lor \neg \left(x \leq -4.7 \cdot 10^{+157} \lor \neg \left(x \leq -3.1 \cdot 10^{+111}\right) \land x \leq 2.7 \cdot 10^{+110}\right):\\
\;\;\;\;x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;z + 2 \cdot y\\
\end{array}
\end{array}
if x < -2.05e185 or -4.7000000000000003e157 < x < -3.1e111 or 2.7000000000000001e110 < x Initial program 99.7%
+-commutative99.7%
associate-+l+99.7%
remove-double-neg99.7%
distribute-neg-in99.7%
distribute-neg-in99.7%
remove-double-neg99.7%
sub-neg99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
associate-+r+99.8%
associate--l+99.8%
count-299.8%
*-commutative99.8%
fma-def99.8%
count-299.8%
neg-mul-199.8%
distribute-rgt-out--99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
*-commutative99.8%
*-commutative99.8%
fma-def99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 74.9%
if -2.05e185 < x < -4.7000000000000003e157 or -3.1e111 < x < 2.7000000000000001e110Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
associate-+r+100.0%
associate--l+100.0%
count-2100.0%
*-commutative100.0%
fma-def100.0%
count-2100.0%
neg-mul-1100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 88.0%
Final simplification83.9%
(FPCore (x y z)
:precision binary64
(if (<= x -3.4e-15)
(* x 3.0)
(if (<= x -3.3e-167)
z
(if (<= x 2.9e-289) (* 2.0 y) (if (<= x 1.25e+55) z (* x 3.0))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.4e-15) {
tmp = x * 3.0;
} else if (x <= -3.3e-167) {
tmp = z;
} else if (x <= 2.9e-289) {
tmp = 2.0 * y;
} else if (x <= 1.25e+55) {
tmp = z;
} 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.4d-15)) then
tmp = x * 3.0d0
else if (x <= (-3.3d-167)) then
tmp = z
else if (x <= 2.9d-289) then
tmp = 2.0d0 * y
else if (x <= 1.25d+55) then
tmp = z
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.4e-15) {
tmp = x * 3.0;
} else if (x <= -3.3e-167) {
tmp = z;
} else if (x <= 2.9e-289) {
tmp = 2.0 * y;
} else if (x <= 1.25e+55) {
tmp = z;
} else {
tmp = x * 3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.4e-15: tmp = x * 3.0 elif x <= -3.3e-167: tmp = z elif x <= 2.9e-289: tmp = 2.0 * y elif x <= 1.25e+55: tmp = z else: tmp = x * 3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.4e-15) tmp = Float64(x * 3.0); elseif (x <= -3.3e-167) tmp = z; elseif (x <= 2.9e-289) tmp = Float64(2.0 * y); elseif (x <= 1.25e+55) tmp = z; else tmp = Float64(x * 3.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.4e-15) tmp = x * 3.0; elseif (x <= -3.3e-167) tmp = z; elseif (x <= 2.9e-289) tmp = 2.0 * y; elseif (x <= 1.25e+55) tmp = z; else tmp = x * 3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.4e-15], N[(x * 3.0), $MachinePrecision], If[LessEqual[x, -3.3e-167], z, If[LessEqual[x, 2.9e-289], N[(2.0 * y), $MachinePrecision], If[LessEqual[x, 1.25e+55], z, N[(x * 3.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{-15}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{-167}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-289}:\\
\;\;\;\;2 \cdot y\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+55}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x \cdot 3\\
\end{array}
\end{array}
if x < -3.4e-15 or 1.25000000000000011e55 < x Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
remove-double-neg99.8%
distribute-neg-in99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
sub-neg99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
associate-+r+99.8%
associate--l+99.8%
count-299.8%
*-commutative99.8%
fma-def99.8%
count-299.8%
neg-mul-199.8%
distribute-rgt-out--99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
*-commutative99.8%
*-commutative99.8%
fma-def99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 61.7%
if -3.4e-15 < x < -3.29999999999999995e-167 or 2.90000000000000006e-289 < x < 1.25000000000000011e55Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
associate-+r+100.0%
associate--l+100.0%
count-2100.0%
*-commutative100.0%
fma-def100.0%
count-2100.0%
neg-mul-1100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 58.3%
if -3.29999999999999995e-167 < x < 2.90000000000000006e-289Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
associate-+r+100.0%
associate--l+100.0%
count-2100.0%
*-commutative100.0%
fma-def100.0%
count-2100.0%
neg-mul-1100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
*-commutative100.0%
*-commutative100.0%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 62.6%
Final simplification60.4%
(FPCore (x y z)
:precision binary64
(if (<= y -4e+190)
(+ x (* 2.0 (+ x y)))
(if (or (<= y -2e+28) (not (<= y 4.8e-6)))
(+ z (* 2.0 y))
(+ z (* x 3.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4e+190) {
tmp = x + (2.0 * (x + y));
} else if ((y <= -2e+28) || !(y <= 4.8e-6)) {
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 <= (-4d+190)) then
tmp = x + (2.0d0 * (x + y))
else if ((y <= (-2d+28)) .or. (.not. (y <= 4.8d-6))) 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 <= -4e+190) {
tmp = x + (2.0 * (x + y));
} else if ((y <= -2e+28) || !(y <= 4.8e-6)) {
tmp = z + (2.0 * y);
} else {
tmp = z + (x * 3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4e+190: tmp = x + (2.0 * (x + y)) elif (y <= -2e+28) or not (y <= 4.8e-6): tmp = z + (2.0 * y) else: tmp = z + (x * 3.0) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4e+190) tmp = Float64(x + Float64(2.0 * Float64(x + y))); elseif ((y <= -2e+28) || !(y <= 4.8e-6)) 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 <= -4e+190) tmp = x + (2.0 * (x + y)); elseif ((y <= -2e+28) || ~((y <= 4.8e-6))) tmp = z + (2.0 * y); else tmp = z + (x * 3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4e+190], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -2e+28], N[Not[LessEqual[y, 4.8e-6]], $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 \cdot 10^{+190}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\mathbf{elif}\;y \leq -2 \cdot 10^{+28} \lor \neg \left(y \leq 4.8 \cdot 10^{-6}\right):\\
\;\;\;\;z + 2 \cdot y\\
\mathbf{else}:\\
\;\;\;\;z + x \cdot 3\\
\end{array}
\end{array}
if y < -4.0000000000000003e190Initial program 99.8%
associate-+l+99.8%
+-commutative99.8%
associate-+r+99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 99.9%
if -4.0000000000000003e190 < y < -1.99999999999999992e28 or 4.7999999999999998e-6 < y Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+99.9%
associate-+r+100.0%
associate--l+100.0%
count-2100.0%
*-commutative100.0%
fma-def100.0%
count-2100.0%
neg-mul-1100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 89.3%
if -1.99999999999999992e28 < y < 4.7999999999999998e-6Initial 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%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.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.1%
Final simplification92.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.6e+28) (not (<= y 3.5e-6))) (+ z (* 2.0 y)) (+ z (* x 3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.6e+28) || !(y <= 3.5e-6)) {
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 <= (-2.6d+28)) .or. (.not. (y <= 3.5d-6))) 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 <= -2.6e+28) || !(y <= 3.5e-6)) {
tmp = z + (2.0 * y);
} else {
tmp = z + (x * 3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.6e+28) or not (y <= 3.5e-6): tmp = z + (2.0 * y) else: tmp = z + (x * 3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.6e+28) || !(y <= 3.5e-6)) 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 <= -2.6e+28) || ~((y <= 3.5e-6))) tmp = z + (2.0 * y); else tmp = z + (x * 3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.6e+28], N[Not[LessEqual[y, 3.5e-6]], $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 -2.6 \cdot 10^{+28} \lor \neg \left(y \leq 3.5 \cdot 10^{-6}\right):\\
\;\;\;\;z + 2 \cdot y\\
\mathbf{else}:\\
\;\;\;\;z + x \cdot 3\\
\end{array}
\end{array}
if y < -2.6000000000000002e28 or 3.49999999999999995e-6 < y 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%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
associate-+r+99.9%
associate--l+100.0%
count-2100.0%
*-commutative100.0%
fma-def100.0%
count-2100.0%
neg-mul-1100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 87.0%
if -2.6000000000000002e28 < y < 3.49999999999999995e-6Initial 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%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.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.1%
Final simplification90.8%
(FPCore (x y z) :precision binary64 (+ z (+ (* 2.0 y) (* x 3.0))))
double code(double x, double y, double z) {
return z + ((2.0 * y) + (x * 3.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 + ((2.0d0 * y) + (x * 3.0d0))
end function
public static double code(double x, double y, double z) {
return z + ((2.0 * y) + (x * 3.0));
}
def code(x, y, z): return z + ((2.0 * y) + (x * 3.0))
function code(x, y, z) return Float64(z + Float64(Float64(2.0 * y) + Float64(x * 3.0))) end
function tmp = code(x, y, z) tmp = z + ((2.0 * y) + (x * 3.0)); end
code[x_, y_, z_] := N[(z + N[(N[(2.0 * y), $MachinePrecision] + N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z + \left(2 \cdot y + 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%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.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%
fma-udef99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.55e+155) (not (<= y 5.4e+74))) (* 2.0 y) z))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.55e+155) || !(y <= 5.4e+74)) {
tmp = 2.0 * y;
} 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 <= (-1.55d+155)) .or. (.not. (y <= 5.4d+74))) then
tmp = 2.0d0 * y
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.55e+155) || !(y <= 5.4e+74)) {
tmp = 2.0 * y;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.55e+155) or not (y <= 5.4e+74): tmp = 2.0 * y else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.55e+155) || !(y <= 5.4e+74)) tmp = Float64(2.0 * y); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.55e+155) || ~((y <= 5.4e+74))) tmp = 2.0 * y; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.55e+155], N[Not[LessEqual[y, 5.4e+74]], $MachinePrecision]], N[(2.0 * y), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{+155} \lor \neg \left(y \leq 5.4 \cdot 10^{+74}\right):\\
\;\;\;\;2 \cdot y\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if y < -1.54999999999999995e155 or 5.3999999999999996e74 < y 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%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.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 99.9%
+-commutative99.9%
*-commutative99.9%
*-commutative99.9%
fma-def100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 72.3%
if -1.54999999999999995e155 < y < 5.3999999999999996e74Initial 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%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.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 z around inf 45.6%
Final simplification54.1%
(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%
remove-double-neg99.9%
distribute-neg-in99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.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 z around inf 36.8%
Final simplification36.8%
herbie shell --seed 2023320
(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))