
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
(FPCore (x y z t) :precision binary64 (fma y 5.0 (* x (fma (+ y z) 2.0 t))))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (x * fma((y + z), 2.0, t)));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(x * fma(Float64(y + z), 2.0, t))) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(N[(y + z), $MachinePrecision] * 2.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(y + z, 2, t\right)\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-def100.0%
distribute-rgt-in97.2%
associate-+l+97.2%
+-commutative97.2%
count-297.2%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (fma x (+ t (* (+ y z) 2.0)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, (t + ((y + z) * 2.0)), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(t + Float64(Float64(y + z) * 2.0)), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right)
\end{array}
Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* z 2.0)))) (t_2 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -1.85e+33)
t_2
(if (<= y 6.6e+39)
t_1
(if (<= y 8.2e+50) (* y 5.0) (if (<= y 1.05e+104) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (z * 2.0));
double t_2 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -1.85e+33) {
tmp = t_2;
} else if (y <= 6.6e+39) {
tmp = t_1;
} else if (y <= 8.2e+50) {
tmp = y * 5.0;
} else if (y <= 1.05e+104) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * (t + (z * 2.0d0))
t_2 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-1.85d+33)) then
tmp = t_2
else if (y <= 6.6d+39) then
tmp = t_1
else if (y <= 8.2d+50) then
tmp = y * 5.0d0
else if (y <= 1.05d+104) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t + (z * 2.0));
double t_2 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -1.85e+33) {
tmp = t_2;
} else if (y <= 6.6e+39) {
tmp = t_1;
} else if (y <= 8.2e+50) {
tmp = y * 5.0;
} else if (y <= 1.05e+104) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (z * 2.0)) t_2 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -1.85e+33: tmp = t_2 elif y <= 6.6e+39: tmp = t_1 elif y <= 8.2e+50: tmp = y * 5.0 elif y <= 1.05e+104: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(z * 2.0))) t_2 = Float64(y * Float64(5.0 + Float64(x * 2.0))) tmp = 0.0 if (y <= -1.85e+33) tmp = t_2; elseif (y <= 6.6e+39) tmp = t_1; elseif (y <= 8.2e+50) tmp = Float64(y * 5.0); elseif (y <= 1.05e+104) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (z * 2.0)); t_2 = y * (5.0 + (x * 2.0)); tmp = 0.0; if (y <= -1.85e+33) tmp = t_2; elseif (y <= 6.6e+39) tmp = t_1; elseif (y <= 8.2e+50) tmp = y * 5.0; elseif (y <= 1.05e+104) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.85e+33], t$95$2, If[LessEqual[y, 6.6e+39], t$95$1, If[LessEqual[y, 8.2e+50], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, 1.05e+104], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + z \cdot 2\right)\\
t_2 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -1.85 \cdot 10^{+33}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+50}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+104}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if y < -1.8499999999999999e33 or 1.0499999999999999e104 < y Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 86.9%
if -1.8499999999999999e33 < y < 6.60000000000000042e39 or 8.2000000000000002e50 < y < 1.0499999999999999e104Initial program 100.0%
Taylor expanded in y around 0 82.3%
if 6.60000000000000042e39 < y < 8.2000000000000002e50Initial program 100.0%
Taylor expanded in x around 0 100.0%
Final simplification84.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (* y 5.0) (* 2.0 (* y x)))))
(if (<= y -1.85e+33)
t_1
(if (<= y 4e+20)
(* x (+ t (* z 2.0)))
(if (<= y 2.3e+152) (+ (* y 5.0) (* x t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y * 5.0) + (2.0 * (y * x));
double tmp;
if (y <= -1.85e+33) {
tmp = t_1;
} else if (y <= 4e+20) {
tmp = x * (t + (z * 2.0));
} else if (y <= 2.3e+152) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (y * 5.0d0) + (2.0d0 * (y * x))
if (y <= (-1.85d+33)) then
tmp = t_1
else if (y <= 4d+20) then
tmp = x * (t + (z * 2.0d0))
else if (y <= 2.3d+152) then
tmp = (y * 5.0d0) + (x * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y * 5.0) + (2.0 * (y * x));
double tmp;
if (y <= -1.85e+33) {
tmp = t_1;
} else if (y <= 4e+20) {
tmp = x * (t + (z * 2.0));
} else if (y <= 2.3e+152) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * 5.0) + (2.0 * (y * x)) tmp = 0 if y <= -1.85e+33: tmp = t_1 elif y <= 4e+20: tmp = x * (t + (z * 2.0)) elif y <= 2.3e+152: tmp = (y * 5.0) + (x * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * 5.0) + Float64(2.0 * Float64(y * x))) tmp = 0.0 if (y <= -1.85e+33) tmp = t_1; elseif (y <= 4e+20) tmp = Float64(x * Float64(t + Float64(z * 2.0))); elseif (y <= 2.3e+152) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * 5.0) + (2.0 * (y * x)); tmp = 0.0; if (y <= -1.85e+33) tmp = t_1; elseif (y <= 4e+20) tmp = x * (t + (z * 2.0)); elseif (y <= 2.3e+152) tmp = (y * 5.0) + (x * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.85e+33], t$95$1, If[LessEqual[y, 4e+20], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e+152], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot 5 + 2 \cdot \left(y \cdot x\right)\\
\mathbf{if}\;y \leq -1.85 \cdot 10^{+33}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+20}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+152}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.8499999999999999e33 or 2.29999999999999985e152 < y Initial program 99.9%
Taylor expanded in y around inf 90.9%
if -1.8499999999999999e33 < y < 4e20Initial program 100.0%
Taylor expanded in y around 0 83.0%
if 4e20 < y < 2.29999999999999985e152Initial program 99.8%
distribute-rgt-in99.7%
fma-def99.7%
associate-+l+99.7%
+-commutative99.7%
count-299.7%
*-commutative99.7%
*-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in t around inf 75.0%
Final simplification84.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.35e+111) (not (<= t 1.18e+145))) (+ (* y 5.0) (* x t)) (+ (* 2.0 (* x (+ y z))) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.35e+111) || !(t <= 1.18e+145)) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.35d+111)) .or. (.not. (t <= 1.18d+145))) then
tmp = (y * 5.0d0) + (x * t)
else
tmp = (2.0d0 * (x * (y + z))) + (y * 5.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.35e+111) || !(t <= 1.18e+145)) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.35e+111) or not (t <= 1.18e+145): tmp = (y * 5.0) + (x * t) else: tmp = (2.0 * (x * (y + z))) + (y * 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.35e+111) || !(t <= 1.18e+145)) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); else tmp = Float64(Float64(2.0 * Float64(x * Float64(y + z))) + Float64(y * 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.35e+111) || ~((t <= 1.18e+145))) tmp = (y * 5.0) + (x * t); else tmp = (2.0 * (x * (y + z))) + (y * 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.35e+111], N[Not[LessEqual[t, 1.18e+145]], $MachinePrecision]], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{+111} \lor \neg \left(t \leq 1.18 \cdot 10^{+145}\right):\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + y \cdot 5\\
\end{array}
\end{array}
if t < -1.3499999999999999e111 or 1.17999999999999998e145 < t Initial program 100.0%
distribute-rgt-in95.0%
fma-def98.7%
associate-+l+98.7%
+-commutative98.7%
count-298.7%
*-commutative98.7%
*-commutative98.7%
Applied egg-rr98.7%
Taylor expanded in t around inf 86.3%
if -1.3499999999999999e111 < t < 1.17999999999999998e145Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in t around 0 89.5%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.8e+41) (not (<= z 2.2e+30))) (+ (* 2.0 (* x (+ y z))) (* y 5.0)) (+ (* y 5.0) (* x (+ t (* y 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.8e+41) || !(z <= 2.2e+30)) {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
} else {
tmp = (y * 5.0) + (x * (t + (y * 2.0)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-6.8d+41)) .or. (.not. (z <= 2.2d+30))) then
tmp = (2.0d0 * (x * (y + z))) + (y * 5.0d0)
else
tmp = (y * 5.0d0) + (x * (t + (y * 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.8e+41) || !(z <= 2.2e+30)) {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
} else {
tmp = (y * 5.0) + (x * (t + (y * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.8e+41) or not (z <= 2.2e+30): tmp = (2.0 * (x * (y + z))) + (y * 5.0) else: tmp = (y * 5.0) + (x * (t + (y * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.8e+41) || !(z <= 2.2e+30)) tmp = Float64(Float64(2.0 * Float64(x * Float64(y + z))) + Float64(y * 5.0)); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y * 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.8e+41) || ~((z <= 2.2e+30))) tmp = (2.0 * (x * (y + z))) + (y * 5.0); else tmp = (y * 5.0) + (x * (t + (y * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.8e+41], N[Not[LessEqual[z, 2.2e+30]], $MachinePrecision]], N[(N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{+41} \lor \neg \left(z \leq 2.2 \cdot 10^{+30}\right):\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + y \cdot 2\right)\\
\end{array}
\end{array}
if z < -6.79999999999999996e41 or 2.2e30 < z Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in t around 0 88.7%
if -6.79999999999999996e41 < z < 2.2e30Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in z around 0 94.6%
Final simplification91.5%
(FPCore (x y z t) :precision binary64 (+ (* x (+ t (+ y (+ z (+ y z))))) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (t + (y + (z + (y + z))))) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (y * 5.0);
}
def code(x, y, z, t): return (x * (t + (y + (z + (y + z))))) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z))))) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * (t + (y + (z + (y + z))))) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -1.02e+99)
t_1
(if (<= x -2.45e+25)
(* x t)
(if (or (<= x -4e-62) (not (<= x 0.0026))) t_1 (* y 5.0))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (x <= -1.02e+99) {
tmp = t_1;
} else if (x <= -2.45e+25) {
tmp = x * t;
} else if ((x <= -4e-62) || !(x <= 0.0026)) {
tmp = t_1;
} else {
tmp = y * 5.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 2.0d0 * (x * z)
if (x <= (-1.02d+99)) then
tmp = t_1
else if (x <= (-2.45d+25)) then
tmp = x * t
else if ((x <= (-4d-62)) .or. (.not. (x <= 0.0026d0))) then
tmp = t_1
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (x <= -1.02e+99) {
tmp = t_1;
} else if (x <= -2.45e+25) {
tmp = x * t;
} else if ((x <= -4e-62) || !(x <= 0.0026)) {
tmp = t_1;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if x <= -1.02e+99: tmp = t_1 elif x <= -2.45e+25: tmp = x * t elif (x <= -4e-62) or not (x <= 0.0026): tmp = t_1 else: tmp = y * 5.0 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) tmp = 0.0 if (x <= -1.02e+99) tmp = t_1; elseif (x <= -2.45e+25) tmp = Float64(x * t); elseif ((x <= -4e-62) || !(x <= 0.0026)) tmp = t_1; else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); tmp = 0.0; if (x <= -1.02e+99) tmp = t_1; elseif (x <= -2.45e+25) tmp = x * t; elseif ((x <= -4e-62) || ~((x <= 0.0026))) tmp = t_1; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.02e+99], t$95$1, If[LessEqual[x, -2.45e+25], N[(x * t), $MachinePrecision], If[Or[LessEqual[x, -4e-62], N[Not[LessEqual[x, 0.0026]], $MachinePrecision]], t$95$1, N[(y * 5.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;x \leq -1.02 \cdot 10^{+99}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.45 \cdot 10^{+25}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-62} \lor \neg \left(x \leq 0.0026\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.01999999999999998e99 or -2.45e25 < x < -4.0000000000000002e-62 or 0.0025999999999999999 < x Initial program 100.0%
Taylor expanded in z around inf 49.8%
if -1.01999999999999998e99 < x < -2.45e25Initial program 100.0%
Taylor expanded in t around inf 64.6%
if -4.0000000000000002e-62 < x < 0.0025999999999999999Initial program 99.9%
Taylor expanded in x around 0 61.8%
Final simplification56.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -1.12e+33)
t_1
(if (<= y 6.5e+20)
(* x (+ t (* z 2.0)))
(if (<= y 2.4e+152) (+ (* y 5.0) (* x t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -1.12e+33) {
tmp = t_1;
} else if (y <= 6.5e+20) {
tmp = x * (t + (z * 2.0));
} else if (y <= 2.4e+152) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-1.12d+33)) then
tmp = t_1
else if (y <= 6.5d+20) then
tmp = x * (t + (z * 2.0d0))
else if (y <= 2.4d+152) then
tmp = (y * 5.0d0) + (x * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -1.12e+33) {
tmp = t_1;
} else if (y <= 6.5e+20) {
tmp = x * (t + (z * 2.0));
} else if (y <= 2.4e+152) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -1.12e+33: tmp = t_1 elif y <= 6.5e+20: tmp = x * (t + (z * 2.0)) elif y <= 2.4e+152: tmp = (y * 5.0) + (x * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(5.0 + Float64(x * 2.0))) tmp = 0.0 if (y <= -1.12e+33) tmp = t_1; elseif (y <= 6.5e+20) tmp = Float64(x * Float64(t + Float64(z * 2.0))); elseif (y <= 2.4e+152) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (5.0 + (x * 2.0)); tmp = 0.0; if (y <= -1.12e+33) tmp = t_1; elseif (y <= 6.5e+20) tmp = x * (t + (z * 2.0)); elseif (y <= 2.4e+152) tmp = (y * 5.0) + (x * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.12e+33], t$95$1, If[LessEqual[y, 6.5e+20], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.4e+152], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -1.12 \cdot 10^{+33}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+20}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+152}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.12e33 or 2.3999999999999999e152 < y Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 90.9%
if -1.12e33 < y < 6.5e20Initial program 100.0%
Taylor expanded in y around 0 83.0%
if 6.5e20 < y < 2.3999999999999999e152Initial program 99.8%
distribute-rgt-in99.7%
fma-def99.7%
associate-+l+99.7%
+-commutative99.7%
count-299.7%
*-commutative99.7%
*-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in t around inf 75.0%
Final simplification84.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.2e-14) (not (<= y 1.3e+20))) (* y (+ 5.0 (* x 2.0))) (* 2.0 (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.2e-14) || !(y <= 1.3e+20)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = 2.0 * (x * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-7.2d-14)) .or. (.not. (y <= 1.3d+20))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = 2.0d0 * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.2e-14) || !(y <= 1.3e+20)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = 2.0 * (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.2e-14) or not (y <= 1.3e+20): tmp = y * (5.0 + (x * 2.0)) else: tmp = 2.0 * (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.2e-14) || !(y <= 1.3e+20)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(2.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.2e-14) || ~((y <= 1.3e+20))) tmp = y * (5.0 + (x * 2.0)); else tmp = 2.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.2e-14], N[Not[LessEqual[y, 1.3e+20]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-14} \lor \neg \left(y \leq 1.3 \cdot 10^{+20}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if y < -7.1999999999999996e-14 or 1.3e20 < y Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 76.7%
if -7.1999999999999996e-14 < y < 1.3e20Initial program 100.0%
Taylor expanded in z around inf 50.6%
Final simplification63.3%
(FPCore (x y z t) :precision binary64 (if (<= x -1.8e-14) (* x t) (if (<= x 0.0026) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.8e-14) {
tmp = x * t;
} else if (x <= 0.0026) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-1.8d-14)) then
tmp = x * t
else if (x <= 0.0026d0) then
tmp = y * 5.0d0
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.8e-14) {
tmp = x * t;
} else if (x <= 0.0026) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.8e-14: tmp = x * t elif x <= 0.0026: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.8e-14) tmp = Float64(x * t); elseif (x <= 0.0026) tmp = Float64(y * 5.0); else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.8e-14) tmp = x * t; elseif (x <= 0.0026) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.8e-14], N[(x * t), $MachinePrecision], If[LessEqual[x, 0.0026], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{-14}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 0.0026:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -1.7999999999999999e-14 or 0.0025999999999999999 < x Initial program 100.0%
Taylor expanded in t around inf 36.6%
if -1.7999999999999999e-14 < x < 0.0025999999999999999Initial program 99.9%
Taylor expanded in x around 0 58.7%
Final simplification48.4%
(FPCore (x y z t) :precision binary64 (* y 5.0))
double code(double x, double y, double z, double t) {
return y * 5.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y * 5.0d0
end function
public static double code(double x, double y, double z, double t) {
return y * 5.0;
}
def code(x, y, z, t): return y * 5.0
function code(x, y, z, t) return Float64(y * 5.0) end
function tmp = code(x, y, z, t) tmp = y * 5.0; end
code[x_, y_, z_, t_] := N[(y * 5.0), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 32.5%
Final simplification32.5%
herbie shell --seed 2023200
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
:precision binary64
(+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))