
(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-def100.0%
distribute-rgt-in94.9%
associate-+l+94.9%
+-commutative94.9%
count-294.9%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (fma x (+ t (* (+ y z) 2.0)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, (t + ((y + z) * 2.0)), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(t + Float64(Float64(y + z) * 2.0)), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right)
\end{array}
Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -1.55e+172)
t_1
(if (<= x -7.5e+17)
(* x t)
(if (<= x 5.9e-12)
(* y 5.0)
(if (<= x 1.26e+188) (* x t) (if (<= x 2.3e+298) t_1 (* x t))))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (x <= -1.55e+172) {
tmp = t_1;
} else if (x <= -7.5e+17) {
tmp = x * t;
} else if (x <= 5.9e-12) {
tmp = y * 5.0;
} else if (x <= 1.26e+188) {
tmp = x * t;
} else if (x <= 2.3e+298) {
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 = 2.0d0 * (x * z)
if (x <= (-1.55d+172)) then
tmp = t_1
else if (x <= (-7.5d+17)) then
tmp = x * t
else if (x <= 5.9d-12) then
tmp = y * 5.0d0
else if (x <= 1.26d+188) then
tmp = x * t
else if (x <= 2.3d+298) 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 = 2.0 * (x * z);
double tmp;
if (x <= -1.55e+172) {
tmp = t_1;
} else if (x <= -7.5e+17) {
tmp = x * t;
} else if (x <= 5.9e-12) {
tmp = y * 5.0;
} else if (x <= 1.26e+188) {
tmp = x * t;
} else if (x <= 2.3e+298) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if x <= -1.55e+172: tmp = t_1 elif x <= -7.5e+17: tmp = x * t elif x <= 5.9e-12: tmp = y * 5.0 elif x <= 1.26e+188: tmp = x * t elif x <= 2.3e+298: tmp = t_1 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) tmp = 0.0 if (x <= -1.55e+172) tmp = t_1; elseif (x <= -7.5e+17) tmp = Float64(x * t); elseif (x <= 5.9e-12) tmp = Float64(y * 5.0); elseif (x <= 1.26e+188) tmp = Float64(x * t); elseif (x <= 2.3e+298) tmp = t_1; else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); tmp = 0.0; if (x <= -1.55e+172) tmp = t_1; elseif (x <= -7.5e+17) tmp = x * t; elseif (x <= 5.9e-12) tmp = y * 5.0; elseif (x <= 1.26e+188) tmp = x * t; elseif (x <= 2.3e+298) tmp = t_1; else tmp = x * t; 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.55e+172], t$95$1, If[LessEqual[x, -7.5e+17], N[(x * t), $MachinePrecision], If[LessEqual[x, 5.9e-12], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.26e+188], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.3e+298], t$95$1, N[(x * t), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;x \leq -1.55 \cdot 10^{+172}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -7.5 \cdot 10^{+17}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 5.9 \cdot 10^{-12}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.26 \cdot 10^{+188}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+298}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -1.54999999999999994e172 or 1.26000000000000001e188 < x < 2.29999999999999995e298Initial program 100.0%
Taylor expanded in z around inf 54.0%
if -1.54999999999999994e172 < x < -7.5e17 or 5.9e-12 < x < 1.26000000000000001e188 or 2.29999999999999995e298 < x Initial program 99.9%
Taylor expanded in t around inf 42.3%
if -7.5e17 < x < 5.9e-12Initial program 99.8%
Taylor expanded in x around 0 63.0%
Final simplification54.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))) (t_2 (* x (* y 2.0))))
(if (<= x -2e+172)
t_1
(if (<= x -7.5e+17)
t_2
(if (<= x 2.5e-18)
(* y 5.0)
(if (<= x 1.32e+222) (* x t) (if (<= x 4.6e+287) t_2 t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double t_2 = x * (y * 2.0);
double tmp;
if (x <= -2e+172) {
tmp = t_1;
} else if (x <= -7.5e+17) {
tmp = t_2;
} else if (x <= 2.5e-18) {
tmp = y * 5.0;
} else if (x <= 1.32e+222) {
tmp = x * t;
} else if (x <= 4.6e+287) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = 2.0d0 * (x * z)
t_2 = x * (y * 2.0d0)
if (x <= (-2d+172)) then
tmp = t_1
else if (x <= (-7.5d+17)) then
tmp = t_2
else if (x <= 2.5d-18) then
tmp = y * 5.0d0
else if (x <= 1.32d+222) then
tmp = x * t
else if (x <= 4.6d+287) then
tmp = t_2
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 * z);
double t_2 = x * (y * 2.0);
double tmp;
if (x <= -2e+172) {
tmp = t_1;
} else if (x <= -7.5e+17) {
tmp = t_2;
} else if (x <= 2.5e-18) {
tmp = y * 5.0;
} else if (x <= 1.32e+222) {
tmp = x * t;
} else if (x <= 4.6e+287) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) t_2 = x * (y * 2.0) tmp = 0 if x <= -2e+172: tmp = t_1 elif x <= -7.5e+17: tmp = t_2 elif x <= 2.5e-18: tmp = y * 5.0 elif x <= 1.32e+222: tmp = x * t elif x <= 4.6e+287: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) t_2 = Float64(x * Float64(y * 2.0)) tmp = 0.0 if (x <= -2e+172) tmp = t_1; elseif (x <= -7.5e+17) tmp = t_2; elseif (x <= 2.5e-18) tmp = Float64(y * 5.0); elseif (x <= 1.32e+222) tmp = Float64(x * t); elseif (x <= 4.6e+287) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); t_2 = x * (y * 2.0); tmp = 0.0; if (x <= -2e+172) tmp = t_1; elseif (x <= -7.5e+17) tmp = t_2; elseif (x <= 2.5e-18) tmp = y * 5.0; elseif (x <= 1.32e+222) tmp = x * t; elseif (x <= 4.6e+287) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2e+172], t$95$1, If[LessEqual[x, -7.5e+17], t$95$2, If[LessEqual[x, 2.5e-18], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.32e+222], N[(x * t), $MachinePrecision], If[LessEqual[x, 4.6e+287], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
t_2 := x \cdot \left(y \cdot 2\right)\\
\mathbf{if}\;x \leq -2 \cdot 10^{+172}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -7.5 \cdot 10^{+17}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-18}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+222}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+287}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -2.0000000000000002e172 or 4.60000000000000028e287 < x Initial program 100.0%
Taylor expanded in z around inf 60.1%
if -2.0000000000000002e172 < x < -7.5e17 or 1.31999999999999997e222 < x < 4.60000000000000028e287Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in y around inf 47.1%
if -7.5e17 < x < 2.50000000000000018e-18Initial program 99.8%
Taylor expanded in x around 0 63.0%
if 2.50000000000000018e-18 < x < 1.31999999999999997e222Initial program 100.0%
Taylor expanded in t around inf 40.0%
Final simplification54.9%
(FPCore (x y z t)
:precision binary64
(if (or (<= y -2.2e+34)
(not (or (<= y 9e-63) (and (not (<= y 2.4e-18)) (<= y 1.8e+22)))))
(* 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+34) || !((y <= 9e-63) || (!(y <= 2.4e-18) && (y <= 1.8e+22)))) {
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+34)) .or. (.not. (y <= 9d-63) .or. (.not. (y <= 2.4d-18)) .and. (y <= 1.8d+22))) 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+34) || !((y <= 9e-63) || (!(y <= 2.4e-18) && (y <= 1.8e+22)))) {
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+34) or not ((y <= 9e-63) or (not (y <= 2.4e-18) and (y <= 1.8e+22))): 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+34) || !((y <= 9e-63) || (!(y <= 2.4e-18) && (y <= 1.8e+22)))) 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+34) || ~(((y <= 9e-63) || (~((y <= 2.4e-18)) && (y <= 1.8e+22))))) 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+34], N[Not[Or[LessEqual[y, 9e-63], And[N[Not[LessEqual[y, 2.4e-18]], $MachinePrecision], LessEqual[y, 1.8e+22]]]], $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^{+34} \lor \neg \left(y \leq 9 \cdot 10^{-63} \lor \neg \left(y \leq 2.4 \cdot 10^{-18}\right) \land y \leq 1.8 \cdot 10^{+22}\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.2000000000000002e34 or 8.9999999999999999e-63 < y < 2.39999999999999994e-18 or 1.8e22 < y Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 83.1%
if -2.2000000000000002e34 < y < 8.9999999999999999e-63 or 2.39999999999999994e-18 < y < 1.8e22Initial program 99.9%
Taylor expanded in y around 0 80.0%
Final simplification81.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.5e+17) (not (<= x 3.1e-28))) (* x (+ t (* (+ y z) 2.0))) (+ (* 2.0 (* x (+ y z))) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.5e+17) || !(x <= 3.1e-28)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-7.5d+17)) .or. (.not. (x <= 3.1d-28))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (2.0d0 * (x * (y + z))) + (y * 5.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.5e+17) || !(x <= 3.1e-28)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.5e+17) or not (x <= 3.1e-28): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (2.0 * (x * (y + z))) + (y * 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.5e+17) || !(x <= 3.1e-28)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(2.0 * Float64(x * Float64(y + z))) + Float64(y * 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.5e+17) || ~((x <= 3.1e-28))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (2.0 * (x * (y + z))) + (y * 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.5e+17], N[Not[LessEqual[x, 3.1e-28]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+17} \lor \neg \left(x \leq 3.1 \cdot 10^{-28}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + y \cdot 5\\
\end{array}
\end{array}
if x < -7.5e17 or 3.09999999999999992e-28 < x Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 99.2%
if -7.5e17 < x < 3.09999999999999992e-28Initial program 99.8%
fma-def99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in t around 0 86.6%
Final simplification93.7%
(FPCore (x y z t) :precision binary64 (+ (* x (+ t (+ y (+ z (+ y z))))) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (t + (y + (z + (y + z))))) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (y * 5.0);
}
def code(x, y, z, t): return (x * (t + (y + (z + (y + z))))) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z))))) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * (t + (y + (z + (y + z))))) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(if (<= x -5e+77)
(* x (* (+ y z) 2.0))
(if (or (<= x -7.5e+17) (not (<= x 2.25e-29)))
(* x (+ t (* y 2.0)))
(* y (+ 5.0 (* x 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5e+77) {
tmp = x * ((y + z) * 2.0);
} else if ((x <= -7.5e+17) || !(x <= 2.25e-29)) {
tmp = x * (t + (y * 2.0));
} else {
tmp = y * (5.0 + (x * 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 <= (-5d+77)) then
tmp = x * ((y + z) * 2.0d0)
else if ((x <= (-7.5d+17)) .or. (.not. (x <= 2.25d-29))) then
tmp = x * (t + (y * 2.0d0))
else
tmp = y * (5.0d0 + (x * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5e+77) {
tmp = x * ((y + z) * 2.0);
} else if ((x <= -7.5e+17) || !(x <= 2.25e-29)) {
tmp = x * (t + (y * 2.0));
} else {
tmp = y * (5.0 + (x * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5e+77: tmp = x * ((y + z) * 2.0) elif (x <= -7.5e+17) or not (x <= 2.25e-29): tmp = x * (t + (y * 2.0)) else: tmp = y * (5.0 + (x * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5e+77) tmp = Float64(x * Float64(Float64(y + z) * 2.0)); elseif ((x <= -7.5e+17) || !(x <= 2.25e-29)) tmp = Float64(x * Float64(t + Float64(y * 2.0))); else tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5e+77) tmp = x * ((y + z) * 2.0); elseif ((x <= -7.5e+17) || ~((x <= 2.25e-29))) tmp = x * (t + (y * 2.0)); else tmp = y * (5.0 + (x * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5e+77], N[(x * N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -7.5e+17], N[Not[LessEqual[x, 2.25e-29]], $MachinePrecision]], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+77}:\\
\;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right)\\
\mathbf{elif}\;x \leq -7.5 \cdot 10^{+17} \lor \neg \left(x \leq 2.25 \cdot 10^{-29}\right):\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\end{array}
\end{array}
if x < -5.00000000000000004e77Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in t around 0 79.2%
+-commutative79.2%
Simplified79.2%
if -5.00000000000000004e77 < x < -7.5e17 or 2.2499999999999999e-29 < x Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 98.8%
Taylor expanded in z around 0 73.1%
if -7.5e17 < x < 2.2499999999999999e-29Initial program 99.8%
fma-def99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in y around inf 64.3%
Final simplification70.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.2e-5) (not (<= x 1.5e-18))) (* 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 <= -7.2e-5) || !(x <= 1.5e-18)) {
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 <= (-7.2d-5)) .or. (.not. (x <= 1.5d-18))) 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 <= -7.2e-5) || !(x <= 1.5e-18)) {
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 <= -7.2e-5) or not (x <= 1.5e-18): 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 <= -7.2e-5) || !(x <= 1.5e-18)) 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 <= -7.2e-5) || ~((x <= 1.5e-18))) 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, -7.2e-5], N[Not[LessEqual[x, 1.5e-18]], $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 -7.2 \cdot 10^{-5} \lor \neg \left(x \leq 1.5 \cdot 10^{-18}\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 < -7.20000000000000018e-5 or 1.49999999999999991e-18 < x Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 99.8%
if -7.20000000000000018e-5 < x < 1.49999999999999991e-18Initial program 99.8%
associate-+l+99.8%
distribute-rgt-in99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in t around inf 76.8%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.5e+17) (not (<= x 1.65e-28))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* x (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.5e+17) || !(x <= 1.65e-28)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * (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 <= (-7.5d+17)) .or. (.not. (x <= 1.65d-28))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + (x * (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 <= -7.5e+17) || !(x <= 1.65e-28)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * (z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.5e+17) or not (x <= 1.65e-28): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (x * (z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.5e+17) || !(x <= 1.65e-28)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.5e+17) || ~((x <= 1.65e-28))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (x * (z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.5e+17], N[Not[LessEqual[x, 1.65e-28]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+17} \lor \neg \left(x \leq 1.65 \cdot 10^{-28}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(z \cdot 2\right)\\
\end{array}
\end{array}
if x < -7.5e17 or 1.6500000000000001e-28 < x Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 99.2%
if -7.5e17 < x < 1.6500000000000001e-28Initial program 99.8%
associate-+l+99.8%
distribute-rgt-in99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 85.6%
associate-*r*85.6%
*-commutative85.6%
Simplified85.6%
Final simplification93.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.2e-5) (not (<= x 1.5e-13))) (* x (* (+ y z) 2.0)) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.2e-5) || !(x <= 1.5e-13)) {
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 <= (-6.2d-5)) .or. (.not. (x <= 1.5d-13))) 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 <= -6.2e-5) || !(x <= 1.5e-13)) {
tmp = x * ((y + z) * 2.0);
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.2e-5) or not (x <= 1.5e-13): tmp = x * ((y + z) * 2.0) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.2e-5) || !(x <= 1.5e-13)) 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 <= -6.2e-5) || ~((x <= 1.5e-13))) 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, -6.2e-5], N[Not[LessEqual[x, 1.5e-13]], $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 -6.2 \cdot 10^{-5} \lor \neg \left(x \leq 1.5 \cdot 10^{-13}\right):\\
\;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -6.20000000000000027e-5 or 1.49999999999999992e-13 < x Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 99.8%
Taylor expanded in t around 0 70.4%
+-commutative70.4%
Simplified70.4%
if -6.20000000000000027e-5 < x < 1.49999999999999992e-13Initial program 99.8%
Taylor expanded in x around 0 63.6%
Final simplification67.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.00045) (not (<= x 3.65e-6))) (* x (* (+ y z) 2.0)) (* y (+ 5.0 (* x 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.00045) || !(x <= 3.65e-6)) {
tmp = x * ((y + z) * 2.0);
} else {
tmp = y * (5.0 + (x * 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 <= (-0.00045d0)) .or. (.not. (x <= 3.65d-6))) then
tmp = x * ((y + z) * 2.0d0)
else
tmp = y * (5.0d0 + (x * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.00045) || !(x <= 3.65e-6)) {
tmp = x * ((y + z) * 2.0);
} else {
tmp = y * (5.0 + (x * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.00045) or not (x <= 3.65e-6): tmp = x * ((y + z) * 2.0) else: tmp = y * (5.0 + (x * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.00045) || !(x <= 3.65e-6)) tmp = Float64(x * Float64(Float64(y + z) * 2.0)); else tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -0.00045) || ~((x <= 3.65e-6))) tmp = x * ((y + z) * 2.0); else tmp = y * (5.0 + (x * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.00045], N[Not[LessEqual[x, 3.65e-6]], $MachinePrecision]], N[(x * N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00045 \lor \neg \left(x \leq 3.65 \cdot 10^{-6}\right):\\
\;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\end{array}
\end{array}
if x < -4.4999999999999999e-4 or 3.65000000000000021e-6 < x Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 99.8%
Taylor expanded in t around 0 70.4%
+-commutative70.4%
Simplified70.4%
if -4.4999999999999999e-4 < x < 3.65000000000000021e-6Initial program 99.8%
fma-def99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in y around inf 64.6%
Final simplification67.8%
(FPCore (x y z t) :precision binary64 (if (<= x -7.5e+17) (* x t) (if (<= x 5.6e-18) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.5e+17) {
tmp = x * t;
} else if (x <= 5.6e-18) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-7.5d+17)) then
tmp = x * t
else if (x <= 5.6d-18) then
tmp = y * 5.0d0
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.5e+17) {
tmp = x * t;
} else if (x <= 5.6e-18) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.5e+17: tmp = x * t elif x <= 5.6e-18: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.5e+17) tmp = Float64(x * t); elseif (x <= 5.6e-18) tmp = Float64(y * 5.0); else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.5e+17) tmp = x * t; elseif (x <= 5.6e-18) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.5e+17], N[(x * t), $MachinePrecision], If[LessEqual[x, 5.6e-18], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+17}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{-18}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -7.5e17 or 5.60000000000000025e-18 < x Initial program 99.9%
Taylor expanded in t around inf 38.8%
if -7.5e17 < x < 5.60000000000000025e-18Initial program 99.8%
Taylor expanded in x around 0 63.0%
Final simplification49.6%
(FPCore (x y z t) :precision binary64 (* y 5.0))
double code(double x, double y, double z, double t) {
return y * 5.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y * 5.0d0
end function
public static double code(double x, double y, double z, double t) {
return y * 5.0;
}
def code(x, y, z, t): return y * 5.0
function code(x, y, z, t) return Float64(y * 5.0) end
function tmp = code(x, y, z, t) tmp = y * 5.0; end
code[x_, y_, z_, t_] := N[(y * 5.0), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 29.4%
Final simplification29.4%
herbie shell --seed 2023238
(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)))