
(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 100.0%
+-commutative100.0%
fma-def100.0%
flip-+59.2%
associate-*r/55.2%
fma-neg56.2%
associate-+l+56.2%
+-commutative56.2%
count-256.2%
associate-+l+56.2%
+-commutative56.2%
count-256.2%
fma-neg55.2%
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 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* z 2.0))))
(t_2 (* y (+ 5.0 (* x 2.0))))
(t_3 (+ (* y 5.0) (* x t))))
(if (<= y -1.16e+129)
t_2
(if (<= y -6.6e+72)
t_1
(if (<= y -235.0)
t_3
(if (<= y -1.02e-50)
t_1
(if (<= y -2.1e-88)
t_3
(if (<= y 0.0011) t_1 (if (<= y 2.55e+91) t_3 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 t_3 = (y * 5.0) + (x * t);
double tmp;
if (y <= -1.16e+129) {
tmp = t_2;
} else if (y <= -6.6e+72) {
tmp = t_1;
} else if (y <= -235.0) {
tmp = t_3;
} else if (y <= -1.02e-50) {
tmp = t_1;
} else if (y <= -2.1e-88) {
tmp = t_3;
} else if (y <= 0.0011) {
tmp = t_1;
} else if (y <= 2.55e+91) {
tmp = t_3;
} 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) :: t_3
real(8) :: tmp
t_1 = x * (t + (z * 2.0d0))
t_2 = y * (5.0d0 + (x * 2.0d0))
t_3 = (y * 5.0d0) + (x * t)
if (y <= (-1.16d+129)) then
tmp = t_2
else if (y <= (-6.6d+72)) then
tmp = t_1
else if (y <= (-235.0d0)) then
tmp = t_3
else if (y <= (-1.02d-50)) then
tmp = t_1
else if (y <= (-2.1d-88)) then
tmp = t_3
else if (y <= 0.0011d0) then
tmp = t_1
else if (y <= 2.55d+91) then
tmp = t_3
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 t_3 = (y * 5.0) + (x * t);
double tmp;
if (y <= -1.16e+129) {
tmp = t_2;
} else if (y <= -6.6e+72) {
tmp = t_1;
} else if (y <= -235.0) {
tmp = t_3;
} else if (y <= -1.02e-50) {
tmp = t_1;
} else if (y <= -2.1e-88) {
tmp = t_3;
} else if (y <= 0.0011) {
tmp = t_1;
} else if (y <= 2.55e+91) {
tmp = t_3;
} 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)) t_3 = (y * 5.0) + (x * t) tmp = 0 if y <= -1.16e+129: tmp = t_2 elif y <= -6.6e+72: tmp = t_1 elif y <= -235.0: tmp = t_3 elif y <= -1.02e-50: tmp = t_1 elif y <= -2.1e-88: tmp = t_3 elif y <= 0.0011: tmp = t_1 elif y <= 2.55e+91: tmp = t_3 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))) t_3 = Float64(Float64(y * 5.0) + Float64(x * t)) tmp = 0.0 if (y <= -1.16e+129) tmp = t_2; elseif (y <= -6.6e+72) tmp = t_1; elseif (y <= -235.0) tmp = t_3; elseif (y <= -1.02e-50) tmp = t_1; elseif (y <= -2.1e-88) tmp = t_3; elseif (y <= 0.0011) tmp = t_1; elseif (y <= 2.55e+91) tmp = t_3; 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)); t_3 = (y * 5.0) + (x * t); tmp = 0.0; if (y <= -1.16e+129) tmp = t_2; elseif (y <= -6.6e+72) tmp = t_1; elseif (y <= -235.0) tmp = t_3; elseif (y <= -1.02e-50) tmp = t_1; elseif (y <= -2.1e-88) tmp = t_3; elseif (y <= 0.0011) tmp = t_1; elseif (y <= 2.55e+91) tmp = t_3; 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]}, Block[{t$95$3 = N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.16e+129], t$95$2, If[LessEqual[y, -6.6e+72], t$95$1, If[LessEqual[y, -235.0], t$95$3, If[LessEqual[y, -1.02e-50], t$95$1, If[LessEqual[y, -2.1e-88], t$95$3, If[LessEqual[y, 0.0011], t$95$1, If[LessEqual[y, 2.55e+91], t$95$3, 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)\\
t_3 := y \cdot 5 + x \cdot t\\
\mathbf{if}\;y \leq -1.16 \cdot 10^{+129}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -6.6 \cdot 10^{+72}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -235:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq -1.02 \cdot 10^{-50}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-88}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq 0.0011:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{+91}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if y < -1.16e129 or 2.55000000000000007e91 < y Initial program 99.9%
Taylor expanded in y around inf 93.0%
Simplified93.0%
if -1.16e129 < y < -6.6e72 or -235 < y < -1.0199999999999999e-50 or -2.1e-88 < y < 0.00110000000000000007Initial program 100.0%
Taylor expanded in y around 0 88.6%
if -6.6e72 < y < -235 or -1.0199999999999999e-50 < y < -2.1e-88 or 0.00110000000000000007 < y < 2.55000000000000007e91Initial program 99.9%
+-commutative99.9%
fma-def100.0%
flip-+72.1%
associate-*r/70.3%
fma-neg70.4%
associate-+l+70.4%
+-commutative70.4%
count-270.4%
associate-+l+70.4%
+-commutative70.4%
count-270.4%
fma-neg70.3%
Applied egg-rr100.0%
Taylor expanded in t around inf 84.2%
*-commutative84.2%
Simplified84.2%
fma-udef84.2%
Applied egg-rr84.2%
Final simplification89.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (* y 5.0) (* x t))))
(if (<= t -3e+124)
t_1
(if (<= t -1.3e+62)
(* x (+ t (* (+ y z) 2.0)))
(if (<= t 5e+129) (+ (* 2.0 (* x (+ y z))) (* y 5.0)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y * 5.0) + (x * t);
double tmp;
if (t <= -3e+124) {
tmp = t_1;
} else if (t <= -1.3e+62) {
tmp = x * (t + ((y + z) * 2.0));
} else if (t <= 5e+129) {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
} 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 * t)
if (t <= (-3d+124)) then
tmp = t_1
else if (t <= (-1.3d+62)) then
tmp = x * (t + ((y + z) * 2.0d0))
else if (t <= 5d+129) then
tmp = (2.0d0 * (x * (y + z))) + (y * 5.0d0)
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 * t);
double tmp;
if (t <= -3e+124) {
tmp = t_1;
} else if (t <= -1.3e+62) {
tmp = x * (t + ((y + z) * 2.0));
} else if (t <= 5e+129) {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * 5.0) + (x * t) tmp = 0 if t <= -3e+124: tmp = t_1 elif t <= -1.3e+62: tmp = x * (t + ((y + z) * 2.0)) elif t <= 5e+129: tmp = (2.0 * (x * (y + z))) + (y * 5.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * 5.0) + Float64(x * t)) tmp = 0.0 if (t <= -3e+124) tmp = t_1; elseif (t <= -1.3e+62) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); elseif (t <= 5e+129) tmp = Float64(Float64(2.0 * Float64(x * Float64(y + z))) + Float64(y * 5.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * 5.0) + (x * t); tmp = 0.0; if (t <= -3e+124) tmp = t_1; elseif (t <= -1.3e+62) tmp = x * (t + ((y + z) * 2.0)); elseif (t <= 5e+129) tmp = (2.0 * (x * (y + z))) + (y * 5.0); 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[(x * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3e+124], t$95$1, If[LessEqual[t, -1.3e+62], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5e+129], N[(N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot 5 + x \cdot t\\
\mathbf{if}\;t \leq -3 \cdot 10^{+124}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -1.3 \cdot 10^{+62}:\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+129}:\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -3e124 or 5.0000000000000003e129 < t Initial program 100.0%
+-commutative100.0%
fma-def100.0%
flip-+40.7%
associate-*r/37.1%
fma-neg40.4%
associate-+l+40.4%
+-commutative40.4%
count-240.4%
associate-+l+40.4%
+-commutative40.4%
count-240.4%
fma-neg37.1%
Applied egg-rr100.0%
Taylor expanded in t around inf 89.8%
*-commutative89.8%
Simplified89.8%
fma-udef89.8%
Applied egg-rr89.8%
if -3e124 < t < -1.29999999999999992e62Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 85.6%
if -1.29999999999999992e62 < t < 5.0000000000000003e129Initial program 99.9%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in t around 0 91.8%
Final simplification90.7%
(FPCore (x y z t)
:precision binary64
(if (or (<= y -1.3e+129)
(and (not (<= y -1.4e+78)) (or (<= y -2.4e+58) (not (<= y 2.2e+55)))))
(* y (+ 5.0 (* x 2.0)))
(* x (+ t (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.3e+129) || (!(y <= -1.4e+78) && ((y <= -2.4e+58) || !(y <= 2.2e+55)))) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 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 ((y <= (-1.3d+129)) .or. (.not. (y <= (-1.4d+78))) .and. (y <= (-2.4d+58)) .or. (.not. (y <= 2.2d+55))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (z * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.3e+129) || (!(y <= -1.4e+78) && ((y <= -2.4e+58) || !(y <= 2.2e+55)))) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.3e+129) or (not (y <= -1.4e+78) and ((y <= -2.4e+58) or not (y <= 2.2e+55))): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.3e+129) || (!(y <= -1.4e+78) && ((y <= -2.4e+58) || !(y <= 2.2e+55)))) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.3e+129) || (~((y <= -1.4e+78)) && ((y <= -2.4e+58) || ~((y <= 2.2e+55))))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.3e+129], And[N[Not[LessEqual[y, -1.4e+78]], $MachinePrecision], Or[LessEqual[y, -2.4e+58], N[Not[LessEqual[y, 2.2e+55]], $MachinePrecision]]]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+129} \lor \neg \left(y \leq -1.4 \cdot 10^{+78}\right) \land \left(y \leq -2.4 \cdot 10^{+58} \lor \neg \left(y \leq 2.2 \cdot 10^{+55}\right)\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if y < -1.30000000000000006e129 or -1.4000000000000001e78 < y < -2.4e58 or 2.2000000000000001e55 < y Initial program 99.9%
Taylor expanded in y around inf 90.2%
Simplified90.2%
if -1.30000000000000006e129 < y < -1.4000000000000001e78 or -2.4e58 < y < 2.2000000000000001e55Initial program 100.0%
Taylor expanded in y around 0 80.6%
Final simplification84.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.2e+47) (not (<= z 1.3e+76))) (+ (* 2.0 (* x (+ y z))) (* y 5.0)) (+ (* y 5.0) (* x (+ t (+ y y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.2e+47) || !(z <= 1.3e+76)) {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
} else {
tmp = (y * 5.0) + (x * (t + (y + y)));
}
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.2d+47)) .or. (.not. (z <= 1.3d+76))) then
tmp = (2.0d0 * (x * (y + z))) + (y * 5.0d0)
else
tmp = (y * 5.0d0) + (x * (t + (y + y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.2e+47) || !(z <= 1.3e+76)) {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
} else {
tmp = (y * 5.0) + (x * (t + (y + y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.2e+47) or not (z <= 1.3e+76): tmp = (2.0 * (x * (y + z))) + (y * 5.0) else: tmp = (y * 5.0) + (x * (t + (y + y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.2e+47) || !(z <= 1.3e+76)) 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 + y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.2e+47) || ~((z <= 1.3e+76))) tmp = (2.0 * (x * (y + z))) + (y * 5.0); else tmp = (y * 5.0) + (x * (t + (y + y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.2e+47], N[Not[LessEqual[z, 1.3e+76]], $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 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+47} \lor \neg \left(z \leq 1.3 \cdot 10^{+76}\right):\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + \left(y + y\right)\right)\\
\end{array}
\end{array}
if z < -6.2000000000000001e47 or 1.3e76 < z Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in t around 0 91.8%
if -6.2000000000000001e47 < z < 1.3e76Initial program 100.0%
Taylor expanded in y around inf 95.7%
Final simplification94.1%
(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 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -1.45e+175)
t_1
(if (<= x -7.7e+146)
(* x t)
(if (<= x -5e+25)
t_1
(if (or (<= x -1.22e-60) (not (<= x 2.9e-31))) (* x t) (* 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.45e+175) {
tmp = t_1;
} else if (x <= -7.7e+146) {
tmp = x * t;
} else if (x <= -5e+25) {
tmp = t_1;
} else if ((x <= -1.22e-60) || !(x <= 2.9e-31)) {
tmp = x * t;
} 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.45d+175)) then
tmp = t_1
else if (x <= (-7.7d+146)) then
tmp = x * t
else if (x <= (-5d+25)) then
tmp = t_1
else if ((x <= (-1.22d-60)) .or. (.not. (x <= 2.9d-31))) then
tmp = x * t
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.45e+175) {
tmp = t_1;
} else if (x <= -7.7e+146) {
tmp = x * t;
} else if (x <= -5e+25) {
tmp = t_1;
} else if ((x <= -1.22e-60) || !(x <= 2.9e-31)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if x <= -1.45e+175: tmp = t_1 elif x <= -7.7e+146: tmp = x * t elif x <= -5e+25: tmp = t_1 elif (x <= -1.22e-60) or not (x <= 2.9e-31): tmp = x * t 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.45e+175) tmp = t_1; elseif (x <= -7.7e+146) tmp = Float64(x * t); elseif (x <= -5e+25) tmp = t_1; elseif ((x <= -1.22e-60) || !(x <= 2.9e-31)) tmp = Float64(x * t); 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.45e+175) tmp = t_1; elseif (x <= -7.7e+146) tmp = x * t; elseif (x <= -5e+25) tmp = t_1; elseif ((x <= -1.22e-60) || ~((x <= 2.9e-31))) tmp = x * t; 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.45e+175], t$95$1, If[LessEqual[x, -7.7e+146], N[(x * t), $MachinePrecision], If[LessEqual[x, -5e+25], t$95$1, If[Or[LessEqual[x, -1.22e-60], N[Not[LessEqual[x, 2.9e-31]], $MachinePrecision]], N[(x * t), $MachinePrecision], 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.45 \cdot 10^{+175}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -7.7 \cdot 10^{+146}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -5 \cdot 10^{+25}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.22 \cdot 10^{-60} \lor \neg \left(x \leq 2.9 \cdot 10^{-31}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.45e175 or -7.7000000000000002e146 < x < -5.00000000000000024e25Initial program 100.0%
Taylor expanded in z around inf 51.3%
if -1.45e175 < x < -7.7000000000000002e146 or -5.00000000000000024e25 < x < -1.22e-60 or 2.9000000000000001e-31 < x Initial program 100.0%
Taylor expanded in t around inf 48.4%
if -1.22e-60 < x < 2.9000000000000001e-31Initial program 99.9%
Taylor expanded in x around 0 66.8%
Final simplification57.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9.8e-50) (not (<= x 2.25e-22))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9.8e-50) || !(x <= 2.25e-22)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (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 <= (-9.8d-50)) .or. (.not. (x <= 2.25d-22))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + (x * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9.8e-50) || !(x <= 2.25e-22)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9.8e-50) or not (x <= 2.25e-22): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9.8e-50) || !(x <= 2.25e-22)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(x * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -9.8e-50) || ~((x <= 2.25e-22))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9.8e-50], N[Not[LessEqual[x, 2.25e-22]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.8 \cdot 10^{-50} \lor \neg \left(x \leq 2.25 \cdot 10^{-22}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -9.7999999999999997e-50 or 2.24999999999999993e-22 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 95.1%
if -9.7999999999999997e-50 < x < 2.24999999999999993e-22Initial program 99.9%
+-commutative99.9%
fma-def100.0%
flip-+38.6%
associate-*r/38.6%
fma-neg38.9%
associate-+l+38.9%
+-commutative38.9%
count-238.9%
associate-+l+38.9%
+-commutative38.9%
count-238.9%
fma-neg38.6%
Applied egg-rr100.0%
Taylor expanded in t around inf 82.9%
*-commutative82.9%
Simplified82.9%
fma-udef82.8%
Applied egg-rr82.8%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.5e+143) (not (<= y 3e+55))) (* y 5.0) (* x (+ t (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.5e+143) || !(y <= 3e+55)) {
tmp = y * 5.0;
} else {
tmp = x * (t + (z * 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 ((y <= (-7.5d+143)) .or. (.not. (y <= 3d+55))) then
tmp = y * 5.0d0
else
tmp = x * (t + (z * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.5e+143) || !(y <= 3e+55)) {
tmp = y * 5.0;
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.5e+143) or not (y <= 3e+55): tmp = y * 5.0 else: tmp = x * (t + (z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.5e+143) || !(y <= 3e+55)) tmp = Float64(y * 5.0); else tmp = Float64(x * Float64(t + Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.5e+143) || ~((y <= 3e+55))) tmp = y * 5.0; else tmp = x * (t + (z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.5e+143], N[Not[LessEqual[y, 3e+55]], $MachinePrecision]], N[(y * 5.0), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+143} \lor \neg \left(y \leq 3 \cdot 10^{+55}\right):\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if y < -7.49999999999999974e143 or 3.00000000000000017e55 < y Initial program 99.9%
Taylor expanded in x around 0 60.2%
if -7.49999999999999974e143 < y < 3.00000000000000017e55Initial program 100.0%
Taylor expanded in y around 0 77.4%
Final simplification71.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.1e-60) (not (<= x 5.5e-29))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.1e-60) || !(x <= 5.5e-29)) {
tmp = x * t;
} 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) :: tmp
if ((x <= (-2.1d-60)) .or. (.not. (x <= 5.5d-29))) then
tmp = x * t
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.1e-60) || !(x <= 5.5e-29)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.1e-60) or not (x <= 5.5e-29): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.1e-60) || !(x <= 5.5e-29)) tmp = Float64(x * t); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.1e-60) || ~((x <= 5.5e-29))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.1e-60], N[Not[LessEqual[x, 5.5e-29]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-60} \lor \neg \left(x \leq 5.5 \cdot 10^{-29}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -2.09999999999999991e-60 or 5.4999999999999999e-29 < x Initial program 100.0%
Taylor expanded in t around inf 42.8%
if -2.09999999999999991e-60 < x < 5.4999999999999999e-29Initial program 99.9%
Taylor expanded in x around 0 66.8%
Final simplification53.3%
(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 100.0%
Taylor expanded in x around 0 33.0%
Final simplification33.0%
herbie shell --seed 2023310
(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)))