
(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.5%
+-commutative99.5%
fma-define100.0%
flip-+59.2%
associate-*r/54.0%
fma-neg57.8%
associate-+l+57.8%
+-commutative57.8%
count-257.8%
associate-+l+57.8%
+-commutative57.8%
count-257.8%
fma-neg54.0%
associate-+l+54.0%
+-commutative54.0%
count-254.0%
Applied egg-rr100.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.5%
fma-define99.5%
associate-+l+99.5%
+-commutative99.5%
count-299.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.2e+161) (not (<= y 1.96e+96))) (* y (+ 5.0 (* 2.0 (+ x (* x (/ z y)))))) (* x (+ t (+ (* (+ y z) 2.0) (* 5.0 (/ y x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.2e+161) || !(y <= 1.96e+96)) {
tmp = y * (5.0 + (2.0 * (x + (x * (z / y)))));
} else {
tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x))));
}
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+161)) .or. (.not. (y <= 1.96d+96))) then
tmp = y * (5.0d0 + (2.0d0 * (x + (x * (z / y)))))
else
tmp = x * (t + (((y + z) * 2.0d0) + (5.0d0 * (y / x))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.2e+161) || !(y <= 1.96e+96)) {
tmp = y * (5.0 + (2.0 * (x + (x * (z / y)))));
} else {
tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.2e+161) or not (y <= 1.96e+96): tmp = y * (5.0 + (2.0 * (x + (x * (z / y))))) else: tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x)))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.2e+161) || !(y <= 1.96e+96)) tmp = Float64(y * Float64(5.0 + Float64(2.0 * Float64(x + Float64(x * Float64(z / y)))))); else tmp = Float64(x * Float64(t + Float64(Float64(Float64(y + z) * 2.0) + Float64(5.0 * Float64(y / x))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.2e+161) || ~((y <= 1.96e+96))) tmp = y * (5.0 + (2.0 * (x + (x * (z / y))))); else tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.2e+161], N[Not[LessEqual[y, 1.96e+96]], $MachinePrecision]], N[(y * N[(5.0 + N[(2.0 * N[(x + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision] + N[(5.0 * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+161} \lor \neg \left(y \leq 1.96 \cdot 10^{+96}\right):\\
\;\;\;\;y \cdot \left(5 + 2 \cdot \left(x + x \cdot \frac{z}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + \left(\left(y + z\right) \cdot 2 + 5 \cdot \frac{y}{x}\right)\right)\\
\end{array}
\end{array}
if y < -2.2e161 or 1.96e96 < y Initial program 98.5%
fma-define98.5%
associate-+l+98.5%
+-commutative98.5%
count-298.5%
Simplified98.5%
Taylor expanded in t around 0 96.0%
Taylor expanded in y around inf 93.3%
distribute-lft-out93.3%
associate-/l*97.3%
Simplified97.3%
if -2.2e161 < y < 1.96e96Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 97.2%
Final simplification97.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.4e-31) (not (<= x 4.8e-46))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* 2.0 (* x (+ y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.4e-31) || !(x <= 4.8e-46)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (2.0 * (x * (y + 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 ((x <= (-4.4d-31)) .or. (.not. (x <= 4.8d-46))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + (2.0d0 * (x * (y + z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.4e-31) || !(x <= 4.8e-46)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (2.0 * (x * (y + z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.4e-31) or not (x <= 4.8e-46): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (2.0 * (x * (y + z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.4e-31) || !(x <= 4.8e-46)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(2.0 * Float64(x * Float64(y + z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.4e-31) || ~((x <= 4.8e-46))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (2.0 * (x * (y + z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.4e-31], N[Not[LessEqual[x, 4.8e-46]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{-31} \lor \neg \left(x \leq 4.8 \cdot 10^{-46}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot \left(y + z\right)\right)\\
\end{array}
\end{array}
if x < -4.40000000000000019e-31 or 4.80000000000000027e-46 < x Initial program 99.3%
fma-define99.3%
associate-+l+99.3%
+-commutative99.3%
count-299.3%
Simplified99.3%
Taylor expanded in x around inf 96.9%
if -4.40000000000000019e-31 < x < 4.80000000000000027e-46Initial program 99.8%
fma-define99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in t around 0 88.8%
Final simplification93.7%
(FPCore (x y z t) :precision binary64 (if (<= t 1.05e+109) (+ (* x (+ t (* z 2.0))) (* y (+ 5.0 (* x 2.0)))) (+ (* y 5.0) (* x (+ t (* y 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.05e+109) {
tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.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 (t <= 1.05d+109) then
tmp = (x * (t + (z * 2.0d0))) + (y * (5.0d0 + (x * 2.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 (t <= 1.05e+109) {
tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.0)));
} else {
tmp = (y * 5.0) + (x * (t + (y * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.05e+109: tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.0))) else: tmp = (y * 5.0) + (x * (t + (y * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.05e+109) tmp = Float64(Float64(x * Float64(t + Float64(z * 2.0))) + Float64(y * Float64(5.0 + Float64(x * 2.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 (t <= 1.05e+109) tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.0))); else tmp = (y * 5.0) + (x * (t + (y * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.05e+109], 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[(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}\;t \leq 1.05 \cdot 10^{+109}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right) + y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + y \cdot 2\right)\\
\end{array}
\end{array}
if t < 1.0500000000000001e109Initial program 99.4%
fma-define99.4%
associate-+l+99.4%
+-commutative99.4%
count-299.4%
Simplified99.4%
Taylor expanded in y around 0 98.0%
if 1.0500000000000001e109 < t Initial program 99.9%
Taylor expanded in y around inf 99.9%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.5e-31) (not (<= x 1.1e-45))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* 2.0 (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.5e-31) || !(x <= 1.1e-45)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (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 ((x <= (-3.5d-31)) .or. (.not. (x <= 1.1d-45))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + (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 ((x <= -3.5e-31) || !(x <= 1.1e-45)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (2.0 * (x * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.5e-31) or not (x <= 1.1e-45): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (2.0 * (x * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.5e-31) || !(x <= 1.1e-45)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(2.0 * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.5e-31) || ~((x <= 1.1e-45))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (2.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.5e-31], N[Not[LessEqual[x, 1.1e-45]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-31} \lor \neg \left(x \leq 1.1 \cdot 10^{-45}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -3.49999999999999985e-31 or 1.09999999999999997e-45 < x Initial program 99.3%
fma-define99.3%
associate-+l+99.3%
+-commutative99.3%
count-299.3%
Simplified99.3%
Taylor expanded in x around inf 96.9%
if -3.49999999999999985e-31 < x < 1.09999999999999997e-45Initial program 99.8%
Taylor expanded in z around inf 88.8%
Final simplification93.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.5e-63) (not (<= x 5.5e-46))) (* 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.5e-63) || !(x <= 5.5e-46)) {
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.5d-63)) .or. (.not. (x <= 5.5d-46))) 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.5e-63) || !(x <= 5.5e-46)) {
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.5e-63) or not (x <= 5.5e-46): 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.5e-63) || !(x <= 5.5e-46)) 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.5e-63) || ~((x <= 5.5e-46))) 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.5e-63], N[Not[LessEqual[x, 5.5e-46]], $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.5 \cdot 10^{-63} \lor \neg \left(x \leq 5.5 \cdot 10^{-46}\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.4999999999999999e-63 or 5.49999999999999983e-46 < x Initial program 99.3%
fma-define99.3%
associate-+l+99.3%
+-commutative99.3%
count-299.3%
Simplified99.3%
Taylor expanded in x around inf 95.8%
if -1.4999999999999999e-63 < x < 5.49999999999999983e-46Initial program 99.8%
Taylor expanded in t around inf 84.5%
Final simplification91.6%
(FPCore (x y z t) :precision binary64 (if (<= x -5.2e+168) (* x (* z 2.0)) (if (or (<= x -4e-37) (not (<= x 6e-46))) (* x t) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.2e+168) {
tmp = x * (z * 2.0);
} else if ((x <= -4e-37) || !(x <= 6e-46)) {
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 <= (-5.2d+168)) then
tmp = x * (z * 2.0d0)
else if ((x <= (-4d-37)) .or. (.not. (x <= 6d-46))) 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 <= -5.2e+168) {
tmp = x * (z * 2.0);
} else if ((x <= -4e-37) || !(x <= 6e-46)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.2e+168: tmp = x * (z * 2.0) elif (x <= -4e-37) or not (x <= 6e-46): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.2e+168) tmp = Float64(x * Float64(z * 2.0)); elseif ((x <= -4e-37) || !(x <= 6e-46)) 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 <= -5.2e+168) tmp = x * (z * 2.0); elseif ((x <= -4e-37) || ~((x <= 6e-46))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.2e+168], N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -4e-37], N[Not[LessEqual[x, 6e-46]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{+168}:\\
\;\;\;\;x \cdot \left(z \cdot 2\right)\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-37} \lor \neg \left(x \leq 6 \cdot 10^{-46}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -5.2e168Initial program 97.3%
+-commutative97.3%
fma-define100.0%
flip-+78.3%
associate-*r/73.4%
fma-neg86.9%
associate-+l+86.9%
+-commutative86.9%
count-286.9%
associate-+l+86.9%
+-commutative86.9%
count-286.9%
fma-neg73.4%
associate-+l+73.4%
+-commutative73.4%
count-273.4%
Applied egg-rr100.0%
Taylor expanded in z around inf 56.4%
associate-*r*56.4%
*-commutative56.4%
associate-*r*56.4%
Simplified56.4%
if -5.2e168 < x < -4.00000000000000027e-37 or 5.99999999999999975e-46 < x Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+68.0%
associate-*r/59.4%
fma-neg63.0%
associate-+l+63.0%
+-commutative63.0%
count-263.0%
associate-+l+63.0%
+-commutative63.0%
count-263.0%
fma-neg59.4%
associate-+l+59.4%
+-commutative59.4%
count-259.4%
Applied egg-rr100.0%
Taylor expanded in t around inf 46.3%
*-commutative46.3%
Simplified46.3%
if -4.00000000000000027e-37 < x < 5.99999999999999975e-46Initial program 99.8%
+-commutative99.8%
fma-define100.0%
flip-+41.6%
associate-*r/40.5%
fma-neg40.9%
associate-+l+40.9%
+-commutative40.9%
count-240.9%
associate-+l+40.9%
+-commutative40.9%
count-240.9%
fma-neg40.5%
associate-+l+40.5%
+-commutative40.5%
count-240.5%
Applied egg-rr100.0%
Taylor expanded in x around 0 71.5%
*-commutative71.5%
Simplified71.5%
Final simplification57.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.1e+39) (not (<= y 5.5e+32))) (* 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 <= -3.1e+39) || !(y <= 5.5e+32)) {
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 <= (-3.1d+39)) .or. (.not. (y <= 5.5d+32))) 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 <= -3.1e+39) || !(y <= 5.5e+32)) {
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 <= -3.1e+39) or not (y <= 5.5e+32): 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 <= -3.1e+39) || !(y <= 5.5e+32)) 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 <= -3.1e+39) || ~((y <= 5.5e+32))) 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, -3.1e+39], N[Not[LessEqual[y, 5.5e+32]], $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 -3.1 \cdot 10^{+39} \lor \neg \left(y \leq 5.5 \cdot 10^{+32}\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 < -3.1000000000000003e39 or 5.49999999999999984e32 < y Initial program 99.1%
fma-define99.1%
associate-+l+99.1%
+-commutative99.1%
count-299.1%
Simplified99.1%
Taylor expanded in y around inf 79.7%
if -3.1000000000000003e39 < y < 5.49999999999999984e32Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+69.2%
associate-*r/64.3%
fma-neg67.4%
associate-+l+67.4%
+-commutative67.4%
count-267.4%
associate-+l+67.4%
+-commutative67.4%
count-267.4%
fma-neg64.3%
associate-+l+64.3%
+-commutative64.3%
count-264.3%
Applied egg-rr100.0%
Taylor expanded in y around 0 81.5%
Final simplification80.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.45e-75) (not (<= x 1.46e-94))) (* x (+ t (* z 2.0))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.45e-75) || !(x <= 1.46e-94)) {
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 <= (-1.45d-75)) .or. (.not. (x <= 1.46d-94))) 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 <= -1.45e-75) || !(x <= 1.46e-94)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.45e-75) or not (x <= 1.46e-94): tmp = x * (t + (z * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.45e-75) || !(x <= 1.46e-94)) 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 <= -1.45e-75) || ~((x <= 1.46e-94))) 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, -1.45e-75], N[Not[LessEqual[x, 1.46e-94]], $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 -1.45 \cdot 10^{-75} \lor \neg \left(x \leq 1.46 \cdot 10^{-94}\right):\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.4500000000000001e-75 or 1.4599999999999999e-94 < x Initial program 99.4%
+-commutative99.4%
fma-define100.0%
flip-+69.1%
associate-*r/61.5%
fma-neg66.8%
associate-+l+66.8%
+-commutative66.8%
count-266.8%
associate-+l+66.8%
+-commutative66.8%
count-266.8%
fma-neg61.5%
associate-+l+61.5%
+-commutative61.5%
count-261.5%
Applied egg-rr100.0%
Taylor expanded in y around 0 74.6%
if -1.4500000000000001e-75 < x < 1.4599999999999999e-94Initial program 99.8%
+-commutative99.8%
fma-define100.0%
flip-+39.2%
associate-*r/39.1%
fma-neg39.6%
associate-+l+39.6%
+-commutative39.6%
count-239.6%
associate-+l+39.6%
+-commutative39.6%
count-239.6%
fma-neg39.1%
associate-+l+39.1%
+-commutative39.1%
count-239.1%
Applied egg-rr100.0%
Taylor expanded in x around 0 75.6%
*-commutative75.6%
Simplified75.6%
Final simplification75.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.3e-61) (not (<= x 1.4e-46))) (* x (* (+ y z) 2.0)) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.3e-61) || !(x <= 1.4e-46)) {
tmp = x * ((y + 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 <= (-2.3d-61)) .or. (.not. (x <= 1.4d-46))) then
tmp = x * ((y + 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 <= -2.3e-61) || !(x <= 1.4e-46)) {
tmp = x * ((y + z) * 2.0);
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.3e-61) or not (x <= 1.4e-46): tmp = x * ((y + z) * 2.0) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.3e-61) || !(x <= 1.4e-46)) tmp = Float64(x * Float64(Float64(y + 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 <= -2.3e-61) || ~((x <= 1.4e-46))) tmp = x * ((y + z) * 2.0); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.3e-61], N[Not[LessEqual[x, 1.4e-46]], $MachinePrecision]], N[(x * N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-61} \lor \neg \left(x \leq 1.4 \cdot 10^{-46}\right):\\
\;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -2.29999999999999992e-61 or 1.3999999999999999e-46 < x Initial program 99.3%
fma-define99.3%
associate-+l+99.3%
+-commutative99.3%
count-299.3%
Simplified99.3%
Taylor expanded in t around 0 64.6%
Taylor expanded in y around 0 62.1%
Taylor expanded in x around inf 61.1%
distribute-lft-out61.1%
Simplified61.1%
if -2.29999999999999992e-61 < x < 1.3999999999999999e-46Initial program 99.8%
+-commutative99.8%
fma-define100.0%
flip-+40.6%
associate-*r/39.4%
fma-neg39.8%
associate-+l+39.8%
+-commutative39.8%
count-239.8%
associate-+l+39.8%
+-commutative39.8%
count-239.8%
fma-neg39.4%
associate-+l+39.4%
+-commutative39.4%
count-239.4%
Applied egg-rr100.0%
Taylor expanded in x around 0 73.0%
*-commutative73.0%
Simplified73.0%
Final simplification65.5%
(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.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.1e-36) (not (<= x 4.2e-46))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.1e-36) || !(x <= 4.2e-46)) {
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 <= (-1.1d-36)) .or. (.not. (x <= 4.2d-46))) 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 <= -1.1e-36) || !(x <= 4.2e-46)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.1e-36) or not (x <= 4.2e-46): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.1e-36) || !(x <= 4.2e-46)) 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 <= -1.1e-36) || ~((x <= 4.2e-46))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.1e-36], N[Not[LessEqual[x, 4.2e-46]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-36} \lor \neg \left(x \leq 4.2 \cdot 10^{-46}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.1e-36 or 4.19999999999999975e-46 < x Initial program 99.3%
+-commutative99.3%
fma-define100.0%
flip-+70.4%
associate-*r/62.7%
fma-neg68.6%
associate-+l+68.6%
+-commutative68.6%
count-268.6%
associate-+l+68.6%
+-commutative68.6%
count-268.6%
fma-neg62.7%
associate-+l+62.7%
+-commutative62.7%
count-262.7%
Applied egg-rr100.0%
Taylor expanded in t around inf 45.9%
*-commutative45.9%
Simplified45.9%
if -1.1e-36 < x < 4.19999999999999975e-46Initial program 99.8%
+-commutative99.8%
fma-define100.0%
flip-+41.6%
associate-*r/40.5%
fma-neg40.9%
associate-+l+40.9%
+-commutative40.9%
count-240.9%
associate-+l+40.9%
+-commutative40.9%
count-240.9%
fma-neg40.5%
associate-+l+40.5%
+-commutative40.5%
count-240.5%
Applied egg-rr100.0%
Taylor expanded in x around 0 71.5%
*-commutative71.5%
Simplified71.5%
Final simplification55.9%
(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.5%
+-commutative99.5%
fma-define100.0%
flip-+59.2%
associate-*r/54.0%
fma-neg57.8%
associate-+l+57.8%
+-commutative57.8%
count-257.8%
associate-+l+57.8%
+-commutative57.8%
count-257.8%
fma-neg54.0%
associate-+l+54.0%
+-commutative54.0%
count-254.0%
Applied egg-rr100.0%
Taylor expanded in t around inf 33.2%
*-commutative33.2%
Simplified33.2%
herbie shell --seed 2024137
(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)))