
(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 10 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 x (+ (+ y (+ z z)) (+ y t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, ((y + (z + z)) + (y + t)), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(Float64(y + Float64(z + z)) + Float64(y + t)), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(N[(y + N[(z + z), $MachinePrecision]), $MachinePrecision] + N[(y + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \left(y + \left(z + z\right)\right) + \left(y + t\right), y \cdot 5\right)
\end{array}
Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
associate-+l+100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x y))))
(if (<= x -9.6e+242)
t_1
(if (<= x -2.7e+168)
(* x t)
(if (<= x -1.12e+42)
t_1
(if (<= x -3.4e-113)
(* x t)
(if (<= x 3.5e-108)
(* y 5.0)
(if (or (<= x 1.85e+68)
(and (not (<= x 1.8e+114)) (<= x 1.02e+239)))
(* x t)
t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * y);
double tmp;
if (x <= -9.6e+242) {
tmp = t_1;
} else if (x <= -2.7e+168) {
tmp = x * t;
} else if (x <= -1.12e+42) {
tmp = t_1;
} else if (x <= -3.4e-113) {
tmp = x * t;
} else if (x <= 3.5e-108) {
tmp = y * 5.0;
} else if ((x <= 1.85e+68) || (!(x <= 1.8e+114) && (x <= 1.02e+239))) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 2.0d0 * (x * y)
if (x <= (-9.6d+242)) then
tmp = t_1
else if (x <= (-2.7d+168)) then
tmp = x * t
else if (x <= (-1.12d+42)) then
tmp = t_1
else if (x <= (-3.4d-113)) then
tmp = x * t
else if (x <= 3.5d-108) then
tmp = y * 5.0d0
else if ((x <= 1.85d+68) .or. (.not. (x <= 1.8d+114)) .and. (x <= 1.02d+239)) then
tmp = x * t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * y);
double tmp;
if (x <= -9.6e+242) {
tmp = t_1;
} else if (x <= -2.7e+168) {
tmp = x * t;
} else if (x <= -1.12e+42) {
tmp = t_1;
} else if (x <= -3.4e-113) {
tmp = x * t;
} else if (x <= 3.5e-108) {
tmp = y * 5.0;
} else if ((x <= 1.85e+68) || (!(x <= 1.8e+114) && (x <= 1.02e+239))) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * y) tmp = 0 if x <= -9.6e+242: tmp = t_1 elif x <= -2.7e+168: tmp = x * t elif x <= -1.12e+42: tmp = t_1 elif x <= -3.4e-113: tmp = x * t elif x <= 3.5e-108: tmp = y * 5.0 elif (x <= 1.85e+68) or (not (x <= 1.8e+114) and (x <= 1.02e+239)): tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * y)) tmp = 0.0 if (x <= -9.6e+242) tmp = t_1; elseif (x <= -2.7e+168) tmp = Float64(x * t); elseif (x <= -1.12e+42) tmp = t_1; elseif (x <= -3.4e-113) tmp = Float64(x * t); elseif (x <= 3.5e-108) tmp = Float64(y * 5.0); elseif ((x <= 1.85e+68) || (!(x <= 1.8e+114) && (x <= 1.02e+239))) tmp = Float64(x * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * y); tmp = 0.0; if (x <= -9.6e+242) tmp = t_1; elseif (x <= -2.7e+168) tmp = x * t; elseif (x <= -1.12e+42) tmp = t_1; elseif (x <= -3.4e-113) tmp = x * t; elseif (x <= 3.5e-108) tmp = y * 5.0; elseif ((x <= 1.85e+68) || (~((x <= 1.8e+114)) && (x <= 1.02e+239))) tmp = x * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.6e+242], t$95$1, If[LessEqual[x, -2.7e+168], N[(x * t), $MachinePrecision], If[LessEqual[x, -1.12e+42], t$95$1, If[LessEqual[x, -3.4e-113], N[(x * t), $MachinePrecision], If[LessEqual[x, 3.5e-108], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 1.85e+68], And[N[Not[LessEqual[x, 1.8e+114]], $MachinePrecision], LessEqual[x, 1.02e+239]]], N[(x * t), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot y\right)\\
\mathbf{if}\;x \leq -9.6 \cdot 10^{+242}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{+168}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -1.12 \cdot 10^{+42}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.4 \cdot 10^{-113}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-108}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+68} \lor \neg \left(x \leq 1.8 \cdot 10^{+114}\right) \land x \leq 1.02 \cdot 10^{+239}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -9.60000000000000049e242 or -2.70000000000000016e168 < x < -1.12e42 or 1.84999999999999999e68 < x < 1.8e114 or 1.02e239 < x Initial program 100.0%
Taylor expanded in y around inf 54.7%
Taylor expanded in x around inf 54.7%
if -9.60000000000000049e242 < x < -2.70000000000000016e168 or -1.12e42 < x < -3.4000000000000002e-113 or 3.4999999999999999e-108 < x < 1.84999999999999999e68 or 1.8e114 < x < 1.02e239Initial program 100.0%
Taylor expanded in y around 0 90.4%
Taylor expanded in x around inf 83.7%
distribute-lft-in81.8%
*-commutative81.8%
*-commutative81.8%
associate-*r*81.8%
+-commutative81.8%
Applied egg-rr81.8%
Taylor expanded in z around 0 52.6%
if -3.4000000000000002e-113 < x < 3.4999999999999999e-108Initial program 99.9%
Taylor expanded in x around 0 58.5%
Simplified58.5%
Final simplification54.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -0.95) (not (<= y 3.1e-31))) (+ (* y 5.0) (* x (+ y (+ y t)))) (* x (+ t (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -0.95) || !(y <= 3.1e-31)) {
tmp = (y * 5.0) + (x * (y + (y + t)));
} 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 <= (-0.95d0)) .or. (.not. (y <= 3.1d-31))) then
tmp = (y * 5.0d0) + (x * (y + (y + t)))
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 <= -0.95) || !(y <= 3.1e-31)) {
tmp = (y * 5.0) + (x * (y + (y + t)));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -0.95) or not (y <= 3.1e-31): tmp = (y * 5.0) + (x * (y + (y + t))) else: tmp = x * (t + (z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -0.95) || !(y <= 3.1e-31)) tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(y + Float64(y + t)))); 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 <= -0.95) || ~((y <= 3.1e-31))) tmp = (y * 5.0) + (x * (y + (y + t))); else tmp = x * (t + (z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -0.95], N[Not[LessEqual[y, 3.1e-31]], $MachinePrecision]], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(y + N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.95 \lor \neg \left(y \leq 3.1 \cdot 10^{-31}\right):\\
\;\;\;\;y \cdot 5 + x \cdot \left(y + \left(y + t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if y < -0.94999999999999996 or 3.1e-31 < y Initial program 100.0%
Taylor expanded in y around inf 86.4%
associate-+l+86.4%
distribute-lft-in83.3%
+-commutative83.3%
Applied egg-rr83.3%
Simplified86.4%
if -0.94999999999999996 < y < 3.1e-31Initial program 100.0%
Taylor expanded in y around 0 97.7%
Taylor expanded in x around inf 89.5%
Final simplification87.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.4e+55) (not (<= y 4.8e+107))) (+ (* y 5.0) (* x (+ y (+ y t)))) (+ (* y 5.0) (* x (+ t (* z 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.4e+55) || !(y <= 4.8e+107)) {
tmp = (y * 5.0) + (x * (y + (y + t)));
} else {
tmp = (y * 5.0) + (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.4d+55)) .or. (.not. (y <= 4.8d+107))) then
tmp = (y * 5.0d0) + (x * (y + (y + t)))
else
tmp = (y * 5.0d0) + (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.4e+55) || !(y <= 4.8e+107)) {
tmp = (y * 5.0) + (x * (y + (y + t)));
} else {
tmp = (y * 5.0) + (x * (t + (z * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.4e+55) or not (y <= 4.8e+107): tmp = (y * 5.0) + (x * (y + (y + t))) else: tmp = (y * 5.0) + (x * (t + (z * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.4e+55) || !(y <= 4.8e+107)) tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(y + Float64(y + t)))); else tmp = Float64(Float64(y * 5.0) + 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.4e+55) || ~((y <= 4.8e+107))) tmp = (y * 5.0) + (x * (y + (y + t))); else tmp = (y * 5.0) + (x * (t + (z * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.4e+55], N[Not[LessEqual[y, 4.8e+107]], $MachinePrecision]], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(y + N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+55} \lor \neg \left(y \leq 4.8 \cdot 10^{+107}\right):\\
\;\;\;\;y \cdot 5 + x \cdot \left(y + \left(y + t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if y < -3.3999999999999998e55 or 4.8000000000000001e107 < y Initial program 99.9%
Taylor expanded in y around inf 93.6%
associate-+l+93.6%
distribute-lft-in89.0%
+-commutative89.0%
Applied egg-rr89.0%
Simplified93.6%
if -3.3999999999999998e55 < y < 4.8000000000000001e107Initial program 100.0%
Taylor expanded in y around 0 94.8%
Final simplification94.4%
(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 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (* x 2.0))))
(if (<= t -5.4e+167)
(* x t)
(if (<= t 1.35e-170)
t_1
(if (<= t 2.65e-95)
(* 2.0 (* x y))
(if (<= t 3.6e+101) t_1 (* x t)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x * 2.0);
double tmp;
if (t <= -5.4e+167) {
tmp = x * t;
} else if (t <= 1.35e-170) {
tmp = t_1;
} else if (t <= 2.65e-95) {
tmp = 2.0 * (x * y);
} else if (t <= 3.6e+101) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = z * (x * 2.0d0)
if (t <= (-5.4d+167)) then
tmp = x * t
else if (t <= 1.35d-170) then
tmp = t_1
else if (t <= 2.65d-95) then
tmp = 2.0d0 * (x * y)
else if (t <= 3.6d+101) then
tmp = t_1
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x * 2.0);
double tmp;
if (t <= -5.4e+167) {
tmp = x * t;
} else if (t <= 1.35e-170) {
tmp = t_1;
} else if (t <= 2.65e-95) {
tmp = 2.0 * (x * y);
} else if (t <= 3.6e+101) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x * 2.0) tmp = 0 if t <= -5.4e+167: tmp = x * t elif t <= 1.35e-170: tmp = t_1 elif t <= 2.65e-95: tmp = 2.0 * (x * y) elif t <= 3.6e+101: tmp = t_1 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x * 2.0)) tmp = 0.0 if (t <= -5.4e+167) tmp = Float64(x * t); elseif (t <= 1.35e-170) tmp = t_1; elseif (t <= 2.65e-95) tmp = Float64(2.0 * Float64(x * y)); elseif (t <= 3.6e+101) tmp = t_1; else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x * 2.0); tmp = 0.0; if (t <= -5.4e+167) tmp = x * t; elseif (t <= 1.35e-170) tmp = t_1; elseif (t <= 2.65e-95) tmp = 2.0 * (x * y); elseif (t <= 3.6e+101) tmp = t_1; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.4e+167], N[(x * t), $MachinePrecision], If[LessEqual[t, 1.35e-170], t$95$1, If[LessEqual[t, 2.65e-95], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.6e+101], t$95$1, N[(x * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x \cdot 2\right)\\
\mathbf{if}\;t \leq -5.4 \cdot 10^{+167}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{-170}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.65 \cdot 10^{-95}:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{+101}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -5.4000000000000001e167 or 3.60000000000000029e101 < t Initial program 100.0%
Taylor expanded in y around 0 95.1%
Taylor expanded in x around inf 86.4%
distribute-lft-in81.4%
*-commutative81.4%
*-commutative81.4%
associate-*r*81.4%
+-commutative81.4%
Applied egg-rr81.4%
Taylor expanded in z around 0 80.0%
if -5.4000000000000001e167 < t < 1.3499999999999999e-170 or 2.6499999999999999e-95 < t < 3.60000000000000029e101Initial program 100.0%
Taylor expanded in y around 0 82.2%
Taylor expanded in x around inf 58.7%
distribute-lft-in58.1%
*-commutative58.1%
*-commutative58.1%
associate-*r*58.1%
+-commutative58.1%
Applied egg-rr58.1%
Taylor expanded in z around inf 50.2%
Simplified50.2%
if 1.3499999999999999e-170 < t < 2.6499999999999999e-95Initial program 100.0%
Taylor expanded in y around inf 64.3%
Taylor expanded in x around inf 44.1%
Final simplification59.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.7e-209) (not (<= x 2.9e-135))) (* x (+ t (* z 2.0))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.7e-209) || !(x <= 2.9e-135)) {
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.7d-209)) .or. (.not. (x <= 2.9d-135))) 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.7e-209) || !(x <= 2.9e-135)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.7e-209) or not (x <= 2.9e-135): 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.7e-209) || !(x <= 2.9e-135)) 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.7e-209) || ~((x <= 2.9e-135))) 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.7e-209], N[Not[LessEqual[x, 2.9e-135]], $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.7 \cdot 10^{-209} \lor \neg \left(x \leq 2.9 \cdot 10^{-135}\right):\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.69999999999999994e-209 or 2.9000000000000002e-135 < x Initial program 100.0%
Taylor expanded in y around 0 80.5%
Taylor expanded in x around inf 74.2%
if -1.69999999999999994e-209 < x < 2.9000000000000002e-135Initial program 99.9%
Taylor expanded in x around 0 70.5%
Simplified70.5%
Final simplification73.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -780.0) (not (<= y 6.2e+106))) (* 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 <= -780.0) || !(y <= 6.2e+106)) {
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 <= (-780.0d0)) .or. (.not. (y <= 6.2d+106))) 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 <= -780.0) || !(y <= 6.2e+106)) {
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 <= -780.0) or not (y <= 6.2e+106): 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 <= -780.0) || !(y <= 6.2e+106)) 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 <= -780.0) || ~((y <= 6.2e+106))) 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, -780.0], N[Not[LessEqual[y, 6.2e+106]], $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 -780 \lor \neg \left(y \leq 6.2 \cdot 10^{+106}\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 < -780 or 6.1999999999999999e106 < y Initial program 100.0%
Taylor expanded in y around inf 79.0%
if -780 < y < 6.1999999999999999e106Initial program 100.0%
Taylor expanded in y around 0 96.3%
Taylor expanded in x around inf 85.7%
Final simplification83.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.6e-109) (not (<= x 8.8e-107))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.6e-109) || !(x <= 8.8e-107)) {
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 <= (-4.6d-109)) .or. (.not. (x <= 8.8d-107))) 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 <= -4.6e-109) || !(x <= 8.8e-107)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.6e-109) or not (x <= 8.8e-107): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.6e-109) || !(x <= 8.8e-107)) 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 <= -4.6e-109) || ~((x <= 8.8e-107))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.6e-109], N[Not[LessEqual[x, 8.8e-107]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{-109} \lor \neg \left(x \leq 8.8 \cdot 10^{-107}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -4.6000000000000003e-109 or 8.8000000000000005e-107 < x Initial program 100.0%
Taylor expanded in y around 0 78.2%
Taylor expanded in x around inf 74.3%
distribute-lft-in71.5%
*-commutative71.5%
*-commutative71.5%
associate-*r*71.5%
+-commutative71.5%
Applied egg-rr71.5%
Taylor expanded in z around 0 39.8%
if -4.6000000000000003e-109 < x < 8.8000000000000005e-107Initial program 99.9%
Taylor expanded in x around 0 58.5%
Simplified58.5%
Final simplification45.2%
(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 100.0%
Taylor expanded in y around 0 84.5%
Taylor expanded in x around inf 65.7%
distribute-lft-in63.8%
*-commutative63.8%
*-commutative63.8%
associate-*r*63.8%
+-commutative63.8%
Applied egg-rr63.8%
Taylor expanded in z around 0 32.8%
Final simplification32.8%
herbie shell --seed 2023308
(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)))