
(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 11 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-in97.6%
associate-+l+97.6%
+-commutative97.6%
count-297.6%
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-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))) (t_2 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -9e-9)
t_2
(if (<= y -1.95e-73)
t_1
(if (<= y -1.65e-107)
t_2
(if (<= y -2.4e-218)
(* x t)
(if (<= y 1.15e-262)
t_1
(if (<= y 1.75e-200) (* x t) (if (<= y 8.2e-51) t_1 t_2)))))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double t_2 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -9e-9) {
tmp = t_2;
} else if (y <= -1.95e-73) {
tmp = t_1;
} else if (y <= -1.65e-107) {
tmp = t_2;
} else if (y <= -2.4e-218) {
tmp = x * t;
} else if (y <= 1.15e-262) {
tmp = t_1;
} else if (y <= 1.75e-200) {
tmp = x * t;
} else if (y <= 8.2e-51) {
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 = 2.0d0 * (x * z)
t_2 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-9d-9)) then
tmp = t_2
else if (y <= (-1.95d-73)) then
tmp = t_1
else if (y <= (-1.65d-107)) then
tmp = t_2
else if (y <= (-2.4d-218)) then
tmp = x * t
else if (y <= 1.15d-262) then
tmp = t_1
else if (y <= 1.75d-200) then
tmp = x * t
else if (y <= 8.2d-51) 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 = 2.0 * (x * z);
double t_2 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -9e-9) {
tmp = t_2;
} else if (y <= -1.95e-73) {
tmp = t_1;
} else if (y <= -1.65e-107) {
tmp = t_2;
} else if (y <= -2.4e-218) {
tmp = x * t;
} else if (y <= 1.15e-262) {
tmp = t_1;
} else if (y <= 1.75e-200) {
tmp = x * t;
} else if (y <= 8.2e-51) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) t_2 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -9e-9: tmp = t_2 elif y <= -1.95e-73: tmp = t_1 elif y <= -1.65e-107: tmp = t_2 elif y <= -2.4e-218: tmp = x * t elif y <= 1.15e-262: tmp = t_1 elif y <= 1.75e-200: tmp = x * t elif y <= 8.2e-51: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) t_2 = Float64(y * Float64(5.0 + Float64(x * 2.0))) tmp = 0.0 if (y <= -9e-9) tmp = t_2; elseif (y <= -1.95e-73) tmp = t_1; elseif (y <= -1.65e-107) tmp = t_2; elseif (y <= -2.4e-218) tmp = Float64(x * t); elseif (y <= 1.15e-262) tmp = t_1; elseif (y <= 1.75e-200) tmp = Float64(x * t); elseif (y <= 8.2e-51) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); t_2 = y * (5.0 + (x * 2.0)); tmp = 0.0; if (y <= -9e-9) tmp = t_2; elseif (y <= -1.95e-73) tmp = t_1; elseif (y <= -1.65e-107) tmp = t_2; elseif (y <= -2.4e-218) tmp = x * t; elseif (y <= 1.15e-262) tmp = t_1; elseif (y <= 1.75e-200) tmp = x * t; elseif (y <= 8.2e-51) tmp = t_1; else tmp = t_2; 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[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9e-9], t$95$2, If[LessEqual[y, -1.95e-73], t$95$1, If[LessEqual[y, -1.65e-107], t$95$2, If[LessEqual[y, -2.4e-218], N[(x * t), $MachinePrecision], If[LessEqual[y, 1.15e-262], t$95$1, If[LessEqual[y, 1.75e-200], N[(x * t), $MachinePrecision], If[LessEqual[y, 8.2e-51], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
t_2 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -9 \cdot 10^{-9}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.95 \cdot 10^{-73}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.65 \cdot 10^{-107}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -2.4 \cdot 10^{-218}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-262}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-200}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-51}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if y < -8.99999999999999953e-9 or -1.94999999999999991e-73 < y < -1.65000000000000002e-107 or 8.19999999999999947e-51 < 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 73.2%
if -8.99999999999999953e-9 < y < -1.94999999999999991e-73 or -2.4000000000000001e-218 < y < 1.15000000000000005e-262 or 1.75000000000000011e-200 < y < 8.19999999999999947e-51Initial program 100.0%
Taylor expanded in z around inf 59.1%
if -1.65000000000000002e-107 < y < -2.4000000000000001e-218 or 1.15000000000000005e-262 < y < 1.75000000000000011e-200Initial program 100.0%
Taylor expanded in t around inf 68.7%
Final simplification68.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.1e-107) (not (<= y 2.8e+69))) (+ (* 2.0 (* x (+ y z))) (* y 5.0)) (* x (+ t (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.1e-107) || !(y <= 2.8e+69)) {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-4.1d-107)) .or. (.not. (y <= 2.8d+69))) then
tmp = (2.0d0 * (x * (y + z))) + (y * 5.0d0)
else
tmp = x * (t + (z * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.1e-107) || !(y <= 2.8e+69)) {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.1e-107) or not (y <= 2.8e+69): tmp = (2.0 * (x * (y + z))) + (y * 5.0) else: tmp = x * (t + (z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.1e-107) || !(y <= 2.8e+69)) tmp = Float64(Float64(2.0 * Float64(x * Float64(y + z))) + Float64(y * 5.0)); else tmp = Float64(x * Float64(t + Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.1e-107) || ~((y <= 2.8e+69))) tmp = (2.0 * (x * (y + z))) + (y * 5.0); else tmp = x * (t + (z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.1e-107], N[Not[LessEqual[y, 2.8e+69]], $MachinePrecision]], N[(N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{-107} \lor \neg \left(y \leq 2.8 \cdot 10^{+69}\right):\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if y < -4.0999999999999999e-107 or 2.79999999999999982e69 < y Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in t around 0 90.8%
if -4.0999999999999999e-107 < y < 2.79999999999999982e69Initial program 100.0%
Taylor expanded in y around 0 82.2%
Final simplification86.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5e+46) (not (<= z 1.4e+23))) (+ (* 2.0 (* x (+ y z))) (* y 5.0)) (+ (* y 5.0) (* x (+ t (* y 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e+46) || !(z <= 1.4e+23)) {
tmp = (2.0 * (x * (y + z))) + (y * 5.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 ((z <= (-5d+46)) .or. (.not. (z <= 1.4d+23))) then
tmp = (2.0d0 * (x * (y + z))) + (y * 5.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 ((z <= -5e+46) || !(z <= 1.4e+23)) {
tmp = (2.0 * (x * (y + z))) + (y * 5.0);
} else {
tmp = (y * 5.0) + (x * (t + (y * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5e+46) or not (z <= 1.4e+23): tmp = (2.0 * (x * (y + z))) + (y * 5.0) else: tmp = (y * 5.0) + (x * (t + (y * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5e+46) || !(z <= 1.4e+23)) tmp = Float64(Float64(2.0 * Float64(x * Float64(y + z))) + Float64(y * 5.0)); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y * 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5e+46) || ~((z <= 1.4e+23))) tmp = (2.0 * (x * (y + z))) + (y * 5.0); else tmp = (y * 5.0) + (x * (t + (y * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5e+46], N[Not[LessEqual[z, 1.4e+23]], $MachinePrecision]], N[(N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+46} \lor \neg \left(z \leq 1.4 \cdot 10^{+23}\right):\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + y \cdot 2\right)\\
\end{array}
\end{array}
if z < -5.0000000000000002e46 or 1.4e23 < z Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in t around 0 88.9%
if -5.0000000000000002e46 < z < 1.4e23Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in z around 0 94.7%
Final simplification92.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= t -7.4e+168)
(* x t)
(if (<= t -4e-275)
t_1
(if (<= t 1.25e-270)
(* y 5.0)
(if (<= t 2.9e-185) t_1 (if (<= t 3.7e+121) (* y 5.0) (* x t))))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (t <= -7.4e+168) {
tmp = x * t;
} else if (t <= -4e-275) {
tmp = t_1;
} else if (t <= 1.25e-270) {
tmp = y * 5.0;
} else if (t <= 2.9e-185) {
tmp = t_1;
} else if (t <= 3.7e+121) {
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) :: t_1
real(8) :: tmp
t_1 = 2.0d0 * (x * z)
if (t <= (-7.4d+168)) then
tmp = x * t
else if (t <= (-4d-275)) then
tmp = t_1
else if (t <= 1.25d-270) then
tmp = y * 5.0d0
else if (t <= 2.9d-185) then
tmp = t_1
else if (t <= 3.7d+121) 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 t_1 = 2.0 * (x * z);
double tmp;
if (t <= -7.4e+168) {
tmp = x * t;
} else if (t <= -4e-275) {
tmp = t_1;
} else if (t <= 1.25e-270) {
tmp = y * 5.0;
} else if (t <= 2.9e-185) {
tmp = t_1;
} else if (t <= 3.7e+121) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if t <= -7.4e+168: tmp = x * t elif t <= -4e-275: tmp = t_1 elif t <= 1.25e-270: tmp = y * 5.0 elif t <= 2.9e-185: tmp = t_1 elif t <= 3.7e+121: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) tmp = 0.0 if (t <= -7.4e+168) tmp = Float64(x * t); elseif (t <= -4e-275) tmp = t_1; elseif (t <= 1.25e-270) tmp = Float64(y * 5.0); elseif (t <= 2.9e-185) tmp = t_1; elseif (t <= 3.7e+121) tmp = Float64(y * 5.0); 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 (t <= -7.4e+168) tmp = x * t; elseif (t <= -4e-275) tmp = t_1; elseif (t <= 1.25e-270) tmp = y * 5.0; elseif (t <= 2.9e-185) tmp = t_1; elseif (t <= 3.7e+121) tmp = y * 5.0; 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[t, -7.4e+168], N[(x * t), $MachinePrecision], If[LessEqual[t, -4e-275], t$95$1, If[LessEqual[t, 1.25e-270], N[(y * 5.0), $MachinePrecision], If[LessEqual[t, 2.9e-185], t$95$1, If[LessEqual[t, 3.7e+121], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;t \leq -7.4 \cdot 10^{+168}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq -4 \cdot 10^{-275}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{-270}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-185}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{+121}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -7.40000000000000018e168 or 3.70000000000000013e121 < t Initial program 99.9%
Taylor expanded in t around inf 71.1%
if -7.40000000000000018e168 < t < -3.99999999999999974e-275 or 1.2499999999999999e-270 < t < 2.89999999999999995e-185Initial program 99.9%
Taylor expanded in z around inf 51.1%
if -3.99999999999999974e-275 < t < 1.2499999999999999e-270 or 2.89999999999999995e-185 < t < 3.70000000000000013e121Initial program 100.0%
Taylor expanded in x around 0 49.3%
Final simplification56.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -8.8e+123)
t_1
(if (<= y -5.3e-107)
(+ (* y 5.0) (* 2.0 (* x z)))
(if (<= y 1.2e+104) (* x (+ t (* z 2.0))) 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 <= -8.8e+123) {
tmp = t_1;
} else if (y <= -5.3e-107) {
tmp = (y * 5.0) + (2.0 * (x * z));
} else if (y <= 1.2e+104) {
tmp = x * (t + (z * 2.0));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-8.8d+123)) then
tmp = t_1
else if (y <= (-5.3d-107)) then
tmp = (y * 5.0d0) + (2.0d0 * (x * z))
else if (y <= 1.2d+104) then
tmp = x * (t + (z * 2.0d0))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -8.8e+123) {
tmp = t_1;
} else if (y <= -5.3e-107) {
tmp = (y * 5.0) + (2.0 * (x * z));
} else if (y <= 1.2e+104) {
tmp = x * (t + (z * 2.0));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -8.8e+123: tmp = t_1 elif y <= -5.3e-107: tmp = (y * 5.0) + (2.0 * (x * z)) elif y <= 1.2e+104: tmp = x * (t + (z * 2.0)) 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 <= -8.8e+123) tmp = t_1; elseif (y <= -5.3e-107) tmp = Float64(Float64(y * 5.0) + Float64(2.0 * Float64(x * z))); elseif (y <= 1.2e+104) tmp = Float64(x * Float64(t + Float64(z * 2.0))); 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 <= -8.8e+123) tmp = t_1; elseif (y <= -5.3e-107) tmp = (y * 5.0) + (2.0 * (x * z)); elseif (y <= 1.2e+104) tmp = x * (t + (z * 2.0)); 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, -8.8e+123], t$95$1, If[LessEqual[y, -5.3e-107], N[(N[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+104], N[(x * N[(t + N[(z * 2.0), $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 -8.8 \cdot 10^{+123}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -5.3 \cdot 10^{-107}:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+104}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -8.79999999999999969e123 or 1.2e104 < 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 88.9%
if -8.79999999999999969e123 < y < -5.3e-107Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in t around 0 88.7%
Taylor expanded in y around 0 88.5%
if -5.3e-107 < y < 1.2e104Initial program 100.0%
Taylor expanded in y around 0 81.3%
Final simplification84.8%
(FPCore (x y z t) :precision binary64 (+ (* x (+ t (* (+ y z) 2.0))) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * (t + ((y + z) * 2.0))) + (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) * 2.0d0))) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * (t + ((y + z) * 2.0))) + (y * 5.0);
}
def code(x, y, z, t): return (x * (t + ((y + z) * 2.0))) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * (t + ((y + z) * 2.0))) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(t + \left(y + z\right) \cdot 2\right) + y \cdot 5
\end{array}
Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
*-commutative99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.06e-5) (not (<= y 1.9e+102))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.06e-5) || !(y <= 1.9e+102)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.06d-5)) .or. (.not. (y <= 1.9d+102))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (z * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.06e-5) || !(y <= 1.9e+102)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.06e-5) or not (y <= 1.9e+102): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.06e-5) || !(y <= 1.9e+102)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.06e-5) || ~((y <= 1.9e+102))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.06e-5], N[Not[LessEqual[y, 1.9e+102]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.06 \cdot 10^{-5} \lor \neg \left(y \leq 1.9 \cdot 10^{+102}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if y < -1.06e-5 or 1.89999999999999989e102 < y Initial program 99.9%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in y around inf 84.7%
if -1.06e-5 < y < 1.89999999999999989e102Initial program 99.9%
Taylor expanded in y around 0 79.3%
Final simplification81.4%
(FPCore (x y z t) :precision binary64 (if (<= t -9.5e+49) (* x t) (if (<= t 5.2e+122) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9.5e+49) {
tmp = x * t;
} else if (t <= 5.2e+122) {
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 <= (-9.5d+49)) then
tmp = x * t
else if (t <= 5.2d+122) 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 <= -9.5e+49) {
tmp = x * t;
} else if (t <= 5.2e+122) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -9.5e+49: tmp = x * t elif t <= 5.2e+122: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -9.5e+49) tmp = Float64(x * t); elseif (t <= 5.2e+122) 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 <= -9.5e+49) tmp = x * t; elseif (t <= 5.2e+122) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -9.5e+49], N[(x * t), $MachinePrecision], If[LessEqual[t, 5.2e+122], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{+49}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{+122}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -9.49999999999999969e49 or 5.20000000000000015e122 < t Initial program 99.9%
Taylor expanded in t around inf 61.7%
if -9.49999999999999969e49 < t < 5.20000000000000015e122Initial program 100.0%
Taylor expanded in x around 0 36.0%
Final simplification46.5%
(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.2%
Final simplification29.2%
herbie shell --seed 2023199
(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)))