
(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 (<= x -2.5e+53)
(* x 3.0)
(if (<= x -1.6e-33)
(* y 2.0)
(if (<= x -8e-73)
z
(if (<= x 1.9e-227) (* y 2.0) (if (<= x 8.8e+55) z (* x 3.0)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.5e+53) {
tmp = x * 3.0;
} else if (x <= -1.6e-33) {
tmp = y * 2.0;
} else if (x <= -8e-73) {
tmp = z;
} else if (x <= 1.9e-227) {
tmp = y * 2.0;
} else if (x <= 8.8e+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 <= (-2.5d+53)) then
tmp = x * 3.0d0
else if (x <= (-1.6d-33)) then
tmp = y * 2.0d0
else if (x <= (-8d-73)) then
tmp = z
else if (x <= 1.9d-227) then
tmp = y * 2.0d0
else if (x <= 8.8d+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 <= -2.5e+53) {
tmp = x * 3.0;
} else if (x <= -1.6e-33) {
tmp = y * 2.0;
} else if (x <= -8e-73) {
tmp = z;
} else if (x <= 1.9e-227) {
tmp = y * 2.0;
} else if (x <= 8.8e+55) {
tmp = z;
} else {
tmp = x * 3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.5e+53: tmp = x * 3.0 elif x <= -1.6e-33: tmp = y * 2.0 elif x <= -8e-73: tmp = z elif x <= 1.9e-227: tmp = y * 2.0 elif x <= 8.8e+55: tmp = z else: tmp = x * 3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.5e+53) tmp = Float64(x * 3.0); elseif (x <= -1.6e-33) tmp = Float64(y * 2.0); elseif (x <= -8e-73) tmp = z; elseif (x <= 1.9e-227) tmp = Float64(y * 2.0); elseif (x <= 8.8e+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 <= -2.5e+53) tmp = x * 3.0; elseif (x <= -1.6e-33) tmp = y * 2.0; elseif (x <= -8e-73) tmp = z; elseif (x <= 1.9e-227) tmp = y * 2.0; elseif (x <= 8.8e+55) tmp = z; else tmp = x * 3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.5e+53], N[(x * 3.0), $MachinePrecision], If[LessEqual[x, -1.6e-33], N[(y * 2.0), $MachinePrecision], If[LessEqual[x, -8e-73], z, If[LessEqual[x, 1.9e-227], N[(y * 2.0), $MachinePrecision], If[LessEqual[x, 8.8e+55], z, N[(x * 3.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{+53}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-33}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;x \leq -8 \cdot 10^{-73}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-227}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{+55}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x \cdot 3\\
\end{array}
\end{array}
if x < -2.5000000000000002e53 or 8.80000000000000042e55 < x Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in x around inf 68.6%
if -2.5000000000000002e53 < x < -1.59999999999999988e-33 or -7.99999999999999998e-73 < x < 1.90000000000000005e-227Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 57.8%
if -1.59999999999999988e-33 < x < -7.99999999999999998e-73 or 1.90000000000000005e-227 < x < 8.80000000000000042e55Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in z around inf 55.4%
Final simplification61.4%
(FPCore (x y z) :precision binary64 (if (<= z -4e-22) (+ z (* x 3.0)) (if (<= z 2.1e-26) (+ x (* 2.0 (+ x y))) (+ z (* y 2.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4e-22) {
tmp = z + (x * 3.0);
} else if (z <= 2.1e-26) {
tmp = x + (2.0 * (x + y));
} 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 (z <= (-4d-22)) then
tmp = z + (x * 3.0d0)
else if (z <= 2.1d-26) then
tmp = x + (2.0d0 * (x + y))
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 (z <= -4e-22) {
tmp = z + (x * 3.0);
} else if (z <= 2.1e-26) {
tmp = x + (2.0 * (x + y));
} else {
tmp = z + (y * 2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4e-22: tmp = z + (x * 3.0) elif z <= 2.1e-26: tmp = x + (2.0 * (x + y)) else: tmp = z + (y * 2.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4e-22) tmp = Float64(z + Float64(x * 3.0)); elseif (z <= 2.1e-26) tmp = Float64(x + Float64(2.0 * Float64(x + y))); else tmp = Float64(z + Float64(y * 2.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4e-22) tmp = z + (x * 3.0); elseif (z <= 2.1e-26) tmp = x + (2.0 * (x + y)); else tmp = z + (y * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4e-22], N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.1e-26], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-22}:\\
\;\;\;\;z + x \cdot 3\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-26}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;z + y \cdot 2\\
\end{array}
\end{array}
if z < -4.0000000000000002e-22Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in y around 0 87.2%
+-commutative87.2%
associate-+l+87.3%
distribute-rgt1-in87.3%
metadata-eval87.3%
Simplified87.3%
if -4.0000000000000002e-22 < z < 2.10000000000000008e-26Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in z around 0 93.7%
if 2.10000000000000008e-26 < z Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around 0 85.4%
Final simplification90.1%
(FPCore (x y z) :precision binary64 (if (<= z -8.5e-18) (+ z (* x 3.0)) (if (<= z 4.2e-27) (+ (* x 3.0) (* y 2.0)) (+ z (* y 2.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.5e-18) {
tmp = z + (x * 3.0);
} else if (z <= 4.2e-27) {
tmp = (x * 3.0) + (y * 2.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 (z <= (-8.5d-18)) then
tmp = z + (x * 3.0d0)
else if (z <= 4.2d-27) then
tmp = (x * 3.0d0) + (y * 2.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 (z <= -8.5e-18) {
tmp = z + (x * 3.0);
} else if (z <= 4.2e-27) {
tmp = (x * 3.0) + (y * 2.0);
} else {
tmp = z + (y * 2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8.5e-18: tmp = z + (x * 3.0) elif z <= 4.2e-27: tmp = (x * 3.0) + (y * 2.0) else: tmp = z + (y * 2.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8.5e-18) tmp = Float64(z + Float64(x * 3.0)); elseif (z <= 4.2e-27) tmp = Float64(Float64(x * 3.0) + Float64(y * 2.0)); else tmp = Float64(z + Float64(y * 2.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -8.5e-18) tmp = z + (x * 3.0); elseif (z <= 4.2e-27) tmp = (x * 3.0) + (y * 2.0); else tmp = z + (y * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8.5e-18], N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e-27], N[(N[(x * 3.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(z + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-18}:\\
\;\;\;\;z + x \cdot 3\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-27}:\\
\;\;\;\;x \cdot 3 + y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z + y \cdot 2\\
\end{array}
\end{array}
if z < -8.4999999999999995e-18Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in y around 0 87.2%
+-commutative87.2%
associate-+l+87.3%
distribute-rgt1-in87.3%
metadata-eval87.3%
Simplified87.3%
if -8.4999999999999995e-18 < z < 4.20000000000000031e-27Initial 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 z around 0 93.7%
if 4.20000000000000031e-27 < z Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around 0 85.4%
Final simplification90.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -6e+53) (not (<= x 1.5e+40))) (+ z (* x 3.0)) (+ z (* y 2.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -6e+53) || !(x <= 1.5e+40)) {
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 <= (-6d+53)) .or. (.not. (x <= 1.5d+40))) 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 <= -6e+53) || !(x <= 1.5e+40)) {
tmp = z + (x * 3.0);
} else {
tmp = z + (y * 2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -6e+53) or not (x <= 1.5e+40): tmp = z + (x * 3.0) else: tmp = z + (y * 2.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -6e+53) || !(x <= 1.5e+40)) 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 <= -6e+53) || ~((x <= 1.5e+40))) tmp = z + (x * 3.0); else tmp = z + (y * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -6e+53], N[Not[LessEqual[x, 1.5e+40]], $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 -6 \cdot 10^{+53} \lor \neg \left(x \leq 1.5 \cdot 10^{+40}\right):\\
\;\;\;\;z + x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;z + y \cdot 2\\
\end{array}
\end{array}
if x < -5.99999999999999996e53 or 1.5000000000000001e40 < x Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in y around 0 83.1%
+-commutative83.1%
associate-+l+83.1%
distribute-rgt1-in83.1%
metadata-eval83.1%
Simplified83.1%
if -5.99999999999999996e53 < x < 1.5000000000000001e40Initial program 100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around 0 88.5%
Final simplification86.2%
(FPCore (x y z) :precision binary64 (if (<= y -3.45e+164) (* y 2.0) (if (<= y 6.7e+158) (+ z (* x 3.0)) (* y 2.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.45e+164) {
tmp = y * 2.0;
} else if (y <= 6.7e+158) {
tmp = z + (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 <= (-3.45d+164)) then
tmp = y * 2.0d0
else if (y <= 6.7d+158) then
tmp = z + (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 <= -3.45e+164) {
tmp = y * 2.0;
} else if (y <= 6.7e+158) {
tmp = z + (x * 3.0);
} else {
tmp = y * 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.45e+164: tmp = y * 2.0 elif y <= 6.7e+158: tmp = z + (x * 3.0) else: tmp = y * 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.45e+164) tmp = Float64(y * 2.0); elseif (y <= 6.7e+158) tmp = Float64(z + 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 <= -3.45e+164) tmp = y * 2.0; elseif (y <= 6.7e+158) tmp = z + (x * 3.0); else tmp = y * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.45e+164], N[(y * 2.0), $MachinePrecision], If[LessEqual[y, 6.7e+158], N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision], N[(y * 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.45 \cdot 10^{+164}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;y \leq 6.7 \cdot 10^{+158}:\\
\;\;\;\;z + x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;y \cdot 2\\
\end{array}
\end{array}
if y < -3.44999999999999993e164 or 6.6999999999999996e158 < y Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 82.5%
if -3.44999999999999993e164 < y < 6.6999999999999996e158Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around 0 79.9%
+-commutative79.9%
associate-+l+79.9%
distribute-rgt1-in79.9%
metadata-eval79.9%
Simplified79.9%
Final simplification80.5%
(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 (if (<= y -3.8e+28) (* y 2.0) (if (<= y 9e+63) z (* y 2.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e+28) {
tmp = y * 2.0;
} else if (y <= 9e+63) {
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 <= (-3.8d+28)) then
tmp = y * 2.0d0
else if (y <= 9d+63) 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 <= -3.8e+28) {
tmp = y * 2.0;
} else if (y <= 9e+63) {
tmp = z;
} else {
tmp = y * 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.8e+28: tmp = y * 2.0 elif y <= 9e+63: tmp = z else: tmp = y * 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.8e+28) tmp = Float64(y * 2.0); elseif (y <= 9e+63) tmp = z; else tmp = Float64(y * 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.8e+28) tmp = y * 2.0; elseif (y <= 9e+63) tmp = z; else tmp = y * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.8e+28], N[(y * 2.0), $MachinePrecision], If[LessEqual[y, 9e+63], z, N[(y * 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+28}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+63}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;y \cdot 2\\
\end{array}
\end{array}
if y < -3.7999999999999999e28 or 9.00000000000000034e63 < y Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 64.1%
if -3.7999999999999999e28 < y < 9.00000000000000034e63Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in z around inf 46.6%
Final simplification53.4%
(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.5%
Final simplification33.5%
herbie shell --seed 2023238
(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))