
(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 14 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-define99.9%
flip-+62.5%
associate-*r/56.7%
fmm-def58.8%
associate-+l+58.8%
+-commutative58.8%
count-258.8%
associate-+l+58.8%
+-commutative58.8%
count-258.8%
fmm-def56.7%
associate-+l+56.7%
+-commutative56.7%
count-256.7%
Applied egg-rr99.9%
(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-define99.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 (+ (* y 5.0) (* x t))) (t_2 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -2.3e+111)
t_2
(if (<= y -3.8e-47)
t_1
(if (<= y 4.7e-79) (* x (+ t (* z 2.0))) (if (<= y 5e+53) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * 5.0) + (x * t);
double t_2 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -2.3e+111) {
tmp = t_2;
} else if (y <= -3.8e-47) {
tmp = t_1;
} else if (y <= 4.7e-79) {
tmp = x * (t + (z * 2.0));
} else if (y <= 5e+53) {
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 = (y * 5.0d0) + (x * t)
t_2 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-2.3d+111)) then
tmp = t_2
else if (y <= (-3.8d-47)) then
tmp = t_1
else if (y <= 4.7d-79) then
tmp = x * (t + (z * 2.0d0))
else if (y <= 5d+53) 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 = (y * 5.0) + (x * t);
double t_2 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -2.3e+111) {
tmp = t_2;
} else if (y <= -3.8e-47) {
tmp = t_1;
} else if (y <= 4.7e-79) {
tmp = x * (t + (z * 2.0));
} else if (y <= 5e+53) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * 5.0) + (x * t) t_2 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -2.3e+111: tmp = t_2 elif y <= -3.8e-47: tmp = t_1 elif y <= 4.7e-79: tmp = x * (t + (z * 2.0)) elif y <= 5e+53: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * 5.0) + Float64(x * t)) t_2 = Float64(y * Float64(5.0 + Float64(x * 2.0))) tmp = 0.0 if (y <= -2.3e+111) tmp = t_2; elseif (y <= -3.8e-47) tmp = t_1; elseif (y <= 4.7e-79) tmp = Float64(x * Float64(t + Float64(z * 2.0))); elseif (y <= 5e+53) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * 5.0) + (x * t); t_2 = y * (5.0 + (x * 2.0)); tmp = 0.0; if (y <= -2.3e+111) tmp = t_2; elseif (y <= -3.8e-47) tmp = t_1; elseif (y <= 4.7e-79) tmp = x * (t + (z * 2.0)); elseif (y <= 5e+53) tmp = t_1; else tmp = t_2; 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]}, Block[{t$95$2 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.3e+111], t$95$2, If[LessEqual[y, -3.8e-47], t$95$1, If[LessEqual[y, 4.7e-79], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+53], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot 5 + x \cdot t\\
t_2 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -2.3 \cdot 10^{+111}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -3.8 \cdot 10^{-47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-79}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -2.30000000000000002e111 or 5.0000000000000004e53 < y Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 83.6%
if -2.30000000000000002e111 < y < -3.80000000000000015e-47 or 4.7000000000000002e-79 < y < 5.0000000000000004e53Initial program 99.9%
Taylor expanded in t around inf 80.0%
if -3.80000000000000015e-47 < y < 4.7000000000000002e-79Initial program 99.9%
+-commutative99.9%
fma-define99.9%
flip-+64.5%
associate-*r/59.7%
fmm-def59.8%
associate-+l+59.8%
+-commutative59.8%
count-259.8%
associate-+l+59.8%
+-commutative59.8%
count-259.8%
fmm-def59.7%
associate-+l+59.7%
+-commutative59.7%
count-259.7%
Applied egg-rr99.9%
Taylor expanded in y around 0 87.2%
Final simplification84.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -3.7e+28)
(+ t_1 (* x t))
(if (<= y 8.2e+145)
(* x (+ t (+ (* (+ y z) 2.0) (* 5.0 (/ y x)))))
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 <= -3.7e+28) {
tmp = t_1 + (x * t);
} else if (y <= 8.2e+145) {
tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x))));
} 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 <= (-3.7d+28)) then
tmp = t_1 + (x * t)
else if (y <= 8.2d+145) then
tmp = x * (t + (((y + z) * 2.0d0) + (5.0d0 * (y / x))))
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 <= -3.7e+28) {
tmp = t_1 + (x * t);
} else if (y <= 8.2e+145) {
tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x))));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -3.7e+28: tmp = t_1 + (x * t) elif y <= 8.2e+145: tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x)))) 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 <= -3.7e+28) tmp = Float64(t_1 + Float64(x * t)); elseif (y <= 8.2e+145) tmp = Float64(x * Float64(t + Float64(Float64(Float64(y + z) * 2.0) + Float64(5.0 * Float64(y / x))))); 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 <= -3.7e+28) tmp = t_1 + (x * t); elseif (y <= 8.2e+145) tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x)))); 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, -3.7e+28], N[(t$95$1 + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e+145], N[(x * N[(t + N[(N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision] + N[(5.0 * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 -3.7 \cdot 10^{+28}:\\
\;\;\;\;t\_1 + x \cdot t\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+145}:\\
\;\;\;\;x \cdot \left(t + \left(\left(y + z\right) \cdot 2 + 5 \cdot \frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.6999999999999999e28Initial program 99.8%
fma-define99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in y around 0 93.4%
Taylor expanded in z around 0 86.2%
if -3.6999999999999999e28 < y < 8.2000000000000003e145Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 99.3%
if 8.2000000000000003e145 < y Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 93.8%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.68e-77) (not (<= x 3.8e-91))) (* x (+ t (* (+ y z) 2.0))) (+ (* y (+ 5.0 (* x 2.0))) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.68e-77) || !(x <= 3.8e-91)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * (5.0 + (x * 2.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 <= (-1.68d-77)) .or. (.not. (x <= 3.8d-91))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * (5.0d0 + (x * 2.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 <= -1.68e-77) || !(x <= 3.8e-91)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * (5.0 + (x * 2.0))) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.68e-77) or not (x <= 3.8e-91): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * (5.0 + (x * 2.0))) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.68e-77) || !(x <= 3.8e-91)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * Float64(5.0 + Float64(x * 2.0))) + Float64(x * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.68e-77) || ~((x <= 3.8e-91))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * (5.0 + (x * 2.0))) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.68e-77], N[Not[LessEqual[x, 3.8e-91]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.68 \cdot 10^{-77} \lor \neg \left(x \leq 3.8 \cdot 10^{-91}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right) + x \cdot t\\
\end{array}
\end{array}
if x < -1.68e-77 or 3.79999999999999978e-91 < x Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 94.7%
if -1.68e-77 < x < 3.79999999999999978e-91Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in z around 0 86.6%
Final simplification91.7%
(FPCore (x y z t) :precision binary64 (if (<= x 4e+62) (+ (* x (+ t (* z 2.0))) (* y (+ 5.0 (* x 2.0)))) (* x (+ t (* (+ y z) 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 4e+62) {
tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.0)));
} else {
tmp = x * (t + ((y + 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 (x <= 4d+62) then
tmp = (x * (t + (z * 2.0d0))) + (y * (5.0d0 + (x * 2.0d0)))
else
tmp = x * (t + ((y + z) * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 4e+62) {
tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.0)));
} else {
tmp = x * (t + ((y + z) * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 4e+62: tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.0))) else: tmp = x * (t + ((y + z) * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 4e+62) tmp = Float64(Float64(x * Float64(t + Float64(z * 2.0))) + Float64(y * Float64(5.0 + Float64(x * 2.0)))); else tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 4e+62) tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.0))); else tmp = x * (t + ((y + z) * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 4e+62], N[(N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{+62}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right) + y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\end{array}
\end{array}
if x < 4.00000000000000014e62Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around 0 98.4%
if 4.00000000000000014e62 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.65e-77) (not (<= x 4.2e-91))) (* 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 <= -1.65e-77) || !(x <= 4.2e-91)) {
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 <= (-1.65d-77)) .or. (.not. (x <= 4.2d-91))) 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 <= -1.65e-77) || !(x <= 4.2e-91)) {
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 <= -1.65e-77) or not (x <= 4.2e-91): 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 <= -1.65e-77) || !(x <= 4.2e-91)) 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 <= -1.65e-77) || ~((x <= 4.2e-91))) 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, -1.65e-77], N[Not[LessEqual[x, 4.2e-91]], $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 -1.65 \cdot 10^{-77} \lor \neg \left(x \leq 4.2 \cdot 10^{-91}\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 < -1.64999999999999996e-77 or 4.1999999999999998e-91 < x Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 94.7%
if -1.64999999999999996e-77 < x < 4.1999999999999998e-91Initial program 99.9%
Taylor expanded in t around inf 86.6%
Final simplification91.7%
(FPCore (x y z t) :precision binary64 (if (<= x -3.4e+161) (* y (* x 2.0)) (if (or (<= x -9.5e-174) (not (<= x 3.3e-143))) (* x t) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.4e+161) {
tmp = y * (x * 2.0);
} else if ((x <= -9.5e-174) || !(x <= 3.3e-143)) {
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 <= (-3.4d+161)) then
tmp = y * (x * 2.0d0)
else if ((x <= (-9.5d-174)) .or. (.not. (x <= 3.3d-143))) 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 <= -3.4e+161) {
tmp = y * (x * 2.0);
} else if ((x <= -9.5e-174) || !(x <= 3.3e-143)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.4e+161: tmp = y * (x * 2.0) elif (x <= -9.5e-174) or not (x <= 3.3e-143): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.4e+161) tmp = Float64(y * Float64(x * 2.0)); elseif ((x <= -9.5e-174) || !(x <= 3.3e-143)) 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 <= -3.4e+161) tmp = y * (x * 2.0); elseif ((x <= -9.5e-174) || ~((x <= 3.3e-143))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.4e+161], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -9.5e-174], N[Not[LessEqual[x, 3.3e-143]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+161}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\
\mathbf{elif}\;x \leq -9.5 \cdot 10^{-174} \lor \neg \left(x \leq 3.3 \cdot 10^{-143}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -3.39999999999999993e161Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in y around inf 55.2%
Taylor expanded in x around inf 55.2%
*-commutative55.2%
Simplified55.2%
if -3.39999999999999993e161 < x < -9.50000000000000075e-174 or 3.3000000000000001e-143 < x Initial program 99.9%
+-commutative99.9%
fma-define99.9%
flip-+60.4%
associate-*r/52.9%
fmm-def56.1%
associate-+l+56.1%
+-commutative56.1%
count-256.1%
associate-+l+56.1%
+-commutative56.1%
count-256.1%
fmm-def52.9%
associate-+l+52.9%
+-commutative52.9%
count-252.9%
Applied egg-rr99.9%
Taylor expanded in t around inf 44.4%
*-commutative44.4%
Simplified44.4%
if -9.50000000000000075e-174 < x < 3.3000000000000001e-143Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+53.2%
associate-*r/53.2%
fmm-def53.5%
associate-+l+53.5%
+-commutative53.5%
count-253.5%
associate-+l+53.5%
+-commutative53.5%
count-253.5%
fmm-def53.2%
associate-+l+53.2%
+-commutative53.2%
count-253.2%
Applied egg-rr100.0%
Taylor expanded in x around 0 72.2%
*-commutative72.2%
Simplified72.2%
Final simplification52.6%
(FPCore (x y z t) :precision binary64 (if (<= t -1.8e+29) (* x t) (if (<= t 6.2e-206) (* x (* z 2.0)) (if (<= t 7.6e+52) (* y 5.0) (* x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.8e+29) {
tmp = x * t;
} else if (t <= 6.2e-206) {
tmp = x * (z * 2.0);
} else if (t <= 7.6e+52) {
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 (t <= (-1.8d+29)) then
tmp = x * t
else if (t <= 6.2d-206) then
tmp = x * (z * 2.0d0)
else if (t <= 7.6d+52) 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 (t <= -1.8e+29) {
tmp = x * t;
} else if (t <= 6.2e-206) {
tmp = x * (z * 2.0);
} else if (t <= 7.6e+52) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.8e+29: tmp = x * t elif t <= 6.2e-206: tmp = x * (z * 2.0) elif t <= 7.6e+52: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.8e+29) tmp = Float64(x * t); elseif (t <= 6.2e-206) tmp = Float64(x * Float64(z * 2.0)); elseif (t <= 7.6e+52) 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 (t <= -1.8e+29) tmp = x * t; elseif (t <= 6.2e-206) tmp = x * (z * 2.0); elseif (t <= 7.6e+52) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.8e+29], N[(x * t), $MachinePrecision], If[LessEqual[t, 6.2e-206], N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.6e+52], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+29}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{-206}:\\
\;\;\;\;x \cdot \left(z \cdot 2\right)\\
\mathbf{elif}\;t \leq 7.6 \cdot 10^{+52}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -1.79999999999999988e29 or 7.5999999999999999e52 < t Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+45.4%
associate-*r/40.0%
fmm-def44.5%
associate-+l+44.5%
+-commutative44.5%
count-244.5%
associate-+l+44.5%
+-commutative44.5%
count-244.5%
fmm-def40.0%
associate-+l+40.0%
+-commutative40.0%
count-240.0%
Applied egg-rr100.0%
Taylor expanded in t around inf 61.6%
*-commutative61.6%
Simplified61.6%
if -1.79999999999999988e29 < t < 6.2000000000000005e-206Initial program 99.9%
+-commutative99.9%
fma-define99.9%
flip-+76.8%
associate-*r/69.3%
fmm-def69.3%
associate-+l+69.3%
+-commutative69.3%
count-269.3%
associate-+l+69.3%
+-commutative69.3%
count-269.3%
fmm-def69.3%
associate-+l+69.3%
+-commutative69.3%
count-269.3%
Applied egg-rr99.9%
Taylor expanded in z around inf 43.3%
*-commutative43.3%
associate-*r*43.3%
*-commutative43.3%
Simplified43.3%
if 6.2000000000000005e-206 < t < 7.5999999999999999e52Initial program 99.8%
+-commutative99.8%
fma-define99.9%
flip-+79.7%
associate-*r/75.7%
fmm-def75.7%
associate-+l+75.7%
+-commutative75.7%
count-275.7%
associate-+l+75.7%
+-commutative75.7%
count-275.7%
fmm-def75.7%
associate-+l+75.7%
+-commutative75.7%
count-275.7%
Applied egg-rr99.9%
Taylor expanded in x around 0 44.6%
*-commutative44.6%
Simplified44.6%
Final simplification52.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.2e+26) (not (<= y 2.55e+38))) (* 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 <= -2.2e+26) || !(y <= 2.55e+38)) {
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 <= (-2.2d+26)) .or. (.not. (y <= 2.55d+38))) 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 <= -2.2e+26) || !(y <= 2.55e+38)) {
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 <= -2.2e+26) or not (y <= 2.55e+38): 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 <= -2.2e+26) || !(y <= 2.55e+38)) 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 <= -2.2e+26) || ~((y <= 2.55e+38))) 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, -2.2e+26], N[Not[LessEqual[y, 2.55e+38]], $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 -2.2 \cdot 10^{+26} \lor \neg \left(y \leq 2.55 \cdot 10^{+38}\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 < -2.20000000000000007e26 or 2.5500000000000001e38 < y Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 80.8%
if -2.20000000000000007e26 < y < 2.5500000000000001e38Initial program 99.9%
+-commutative99.9%
fma-define99.9%
flip-+69.0%
associate-*r/63.6%
fmm-def63.7%
associate-+l+63.7%
+-commutative63.7%
count-263.7%
associate-+l+63.7%
+-commutative63.7%
count-263.7%
fmm-def63.6%
associate-+l+63.6%
+-commutative63.6%
count-263.6%
Applied egg-rr99.9%
Taylor expanded in y around 0 79.9%
Final simplification80.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4e-174) (not (<= x 1.16e-145))) (* x (+ t (* z 2.0))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4e-174) || !(x <= 1.16e-145)) {
tmp = x * (t + (z * 2.0));
} 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 <= (-4d-174)) .or. (.not. (x <= 1.16d-145))) then
tmp = x * (t + (z * 2.0d0))
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 <= -4e-174) || !(x <= 1.16e-145)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4e-174) or not (x <= 1.16e-145): tmp = x * (t + (z * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4e-174) || !(x <= 1.16e-145)) tmp = Float64(x * Float64(t + Float64(z * 2.0))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4e-174) || ~((x <= 1.16e-145))) tmp = x * (t + (z * 2.0)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4e-174], N[Not[LessEqual[x, 1.16e-145]], $MachinePrecision]], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-174} \lor \neg \left(x \leq 1.16 \cdot 10^{-145}\right):\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -4e-174 or 1.16000000000000004e-145 < x Initial program 99.9%
+-commutative99.9%
fma-define99.9%
flip-+65.7%
associate-*r/57.9%
fmm-def60.6%
associate-+l+60.6%
+-commutative60.6%
count-260.6%
associate-+l+60.6%
+-commutative60.6%
count-260.6%
fmm-def57.9%
associate-+l+57.9%
+-commutative57.9%
count-257.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 70.8%
if -4e-174 < x < 1.16000000000000004e-145Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+53.2%
associate-*r/53.2%
fmm-def53.5%
associate-+l+53.5%
+-commutative53.5%
count-253.5%
associate-+l+53.5%
+-commutative53.5%
count-253.5%
fmm-def53.2%
associate-+l+53.2%
+-commutative53.2%
count-253.2%
Applied egg-rr100.0%
Taylor expanded in x around 0 72.2%
*-commutative72.2%
Simplified72.2%
Final simplification71.2%
(FPCore (x y z t) :precision binary64 (+ (* y 5.0) (* x (+ t (+ y (+ z (+ y z)))))))
double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
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) + (x * (t + (y + (z + (y + z)))))
end function
public static double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
def code(x, y, z, t): return (y * 5.0) + (x * (t + (y + (z + (y + z)))))
function code(x, y, z, t) return Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z)))))) end
function tmp = code(x, y, z, t) tmp = (y * 5.0) + (x * (t + (y + (z + (y + z))))); end
code[x_, y_, z_, t_] := N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5 + x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9.5e-174) (not (<= x 6.4e-142))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9.5e-174) || !(x <= 6.4e-142)) {
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 <= (-9.5d-174)) .or. (.not. (x <= 6.4d-142))) 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 <= -9.5e-174) || !(x <= 6.4e-142)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9.5e-174) or not (x <= 6.4e-142): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9.5e-174) || !(x <= 6.4e-142)) 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 <= -9.5e-174) || ~((x <= 6.4e-142))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9.5e-174], N[Not[LessEqual[x, 6.4e-142]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-174} \lor \neg \left(x \leq 6.4 \cdot 10^{-142}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -9.50000000000000075e-174 or 6.3999999999999997e-142 < x Initial program 99.9%
+-commutative99.9%
fma-define99.9%
flip-+65.7%
associate-*r/57.9%
fmm-def60.6%
associate-+l+60.6%
+-commutative60.6%
count-260.6%
associate-+l+60.6%
+-commutative60.6%
count-260.6%
fmm-def57.9%
associate-+l+57.9%
+-commutative57.9%
count-257.9%
Applied egg-rr99.9%
Taylor expanded in t around inf 41.8%
*-commutative41.8%
Simplified41.8%
if -9.50000000000000075e-174 < x < 6.3999999999999997e-142Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+53.2%
associate-*r/53.2%
fmm-def53.5%
associate-+l+53.5%
+-commutative53.5%
count-253.5%
associate-+l+53.5%
+-commutative53.5%
count-253.5%
fmm-def53.2%
associate-+l+53.2%
+-commutative53.2%
count-253.2%
Applied egg-rr100.0%
Taylor expanded in x around 0 72.2%
*-commutative72.2%
Simplified72.2%
Final simplification49.5%
(FPCore (x y z t) :precision binary64 (* x t))
double code(double x, double y, double z, double t) {
return x * t;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x * t;
}
def code(x, y, z, t): return x * t
function code(x, y, z, t) return Float64(x * t) end
function tmp = code(x, y, z, t) tmp = x * t; end
code[x_, y_, z_, t_] := N[(x * t), $MachinePrecision]
\begin{array}{l}
\\
x \cdot t
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
flip-+62.5%
associate-*r/56.7%
fmm-def58.8%
associate-+l+58.8%
+-commutative58.8%
count-258.8%
associate-+l+58.8%
+-commutative58.8%
count-258.8%
fmm-def56.7%
associate-+l+56.7%
+-commutative56.7%
count-256.7%
Applied egg-rr99.9%
Taylor expanded in t around inf 35.9%
*-commutative35.9%
Simplified35.9%
herbie shell --seed 2024186
(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)))