
(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 12 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-in96.9%
associate-+l+96.9%
+-commutative96.9%
count-296.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 (<= t -24000000000000.0)
(* x t)
(if (<= t -2.5e-244)
t_1
(if (<= t 3.7e-175)
(* y 5.0)
(if (<= t 7.4e-122)
t_1
(if (<= t 7e-56) (* y 5.0) (if (<= t 1.95e+110) t_1 (* x t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (t <= -24000000000000.0) {
tmp = x * t;
} else if (t <= -2.5e-244) {
tmp = t_1;
} else if (t <= 3.7e-175) {
tmp = y * 5.0;
} else if (t <= 7.4e-122) {
tmp = t_1;
} else if (t <= 7e-56) {
tmp = y * 5.0;
} else if (t <= 1.95e+110) {
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 (t <= (-24000000000000.0d0)) then
tmp = x * t
else if (t <= (-2.5d-244)) then
tmp = t_1
else if (t <= 3.7d-175) then
tmp = y * 5.0d0
else if (t <= 7.4d-122) then
tmp = t_1
else if (t <= 7d-56) then
tmp = y * 5.0d0
else if (t <= 1.95d+110) 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 (t <= -24000000000000.0) {
tmp = x * t;
} else if (t <= -2.5e-244) {
tmp = t_1;
} else if (t <= 3.7e-175) {
tmp = y * 5.0;
} else if (t <= 7.4e-122) {
tmp = t_1;
} else if (t <= 7e-56) {
tmp = y * 5.0;
} else if (t <= 1.95e+110) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if t <= -24000000000000.0: tmp = x * t elif t <= -2.5e-244: tmp = t_1 elif t <= 3.7e-175: tmp = y * 5.0 elif t <= 7.4e-122: tmp = t_1 elif t <= 7e-56: tmp = y * 5.0 elif t <= 1.95e+110: 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 (t <= -24000000000000.0) tmp = Float64(x * t); elseif (t <= -2.5e-244) tmp = t_1; elseif (t <= 3.7e-175) tmp = Float64(y * 5.0); elseif (t <= 7.4e-122) tmp = t_1; elseif (t <= 7e-56) tmp = Float64(y * 5.0); elseif (t <= 1.95e+110) 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 (t <= -24000000000000.0) tmp = x * t; elseif (t <= -2.5e-244) tmp = t_1; elseif (t <= 3.7e-175) tmp = y * 5.0; elseif (t <= 7.4e-122) tmp = t_1; elseif (t <= 7e-56) tmp = y * 5.0; elseif (t <= 1.95e+110) 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[t, -24000000000000.0], N[(x * t), $MachinePrecision], If[LessEqual[t, -2.5e-244], t$95$1, If[LessEqual[t, 3.7e-175], N[(y * 5.0), $MachinePrecision], If[LessEqual[t, 7.4e-122], t$95$1, If[LessEqual[t, 7e-56], N[(y * 5.0), $MachinePrecision], If[LessEqual[t, 1.95e+110], t$95$1, N[(x * t), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;t \leq -24000000000000:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq -2.5 \cdot 10^{-244}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{-175}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;t \leq 7.4 \cdot 10^{-122}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 7 \cdot 10^{-56}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{+110}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -2.4e13 or 1.9500000000000002e110 < t Initial program 100.0%
Taylor expanded in t around inf 63.8%
if -2.4e13 < t < -2.49999999999999999e-244 or 3.69999999999999998e-175 < t < 7.3999999999999995e-122 or 6.9999999999999996e-56 < t < 1.9500000000000002e110Initial program 100.0%
Taylor expanded in z around inf 53.8%
if -2.49999999999999999e-244 < t < 3.69999999999999998e-175 or 7.3999999999999995e-122 < t < 6.9999999999999996e-56Initial program 99.8%
Taylor expanded in x around 0 47.3%
Final simplification55.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (+ y z) (* x 2.0))))
(if (<= x -1.85e+62)
t_1
(if (<= x -1.75e+46)
(* x t)
(if (or (<= x -1.8e-87) (not (<= x 1.7e-80))) t_1 (* y 5.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (y + z) * (x * 2.0);
double tmp;
if (x <= -1.85e+62) {
tmp = t_1;
} else if (x <= -1.75e+46) {
tmp = x * t;
} else if ((x <= -1.8e-87) || !(x <= 1.7e-80)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (y + z) * (x * 2.0d0)
if (x <= (-1.85d+62)) then
tmp = t_1
else if (x <= (-1.75d+46)) then
tmp = x * t
else if ((x <= (-1.8d-87)) .or. (.not. (x <= 1.7d-80))) then
tmp = t_1
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y + z) * (x * 2.0);
double tmp;
if (x <= -1.85e+62) {
tmp = t_1;
} else if (x <= -1.75e+46) {
tmp = x * t;
} else if ((x <= -1.8e-87) || !(x <= 1.7e-80)) {
tmp = t_1;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y + z) * (x * 2.0) tmp = 0 if x <= -1.85e+62: tmp = t_1 elif x <= -1.75e+46: tmp = x * t elif (x <= -1.8e-87) or not (x <= 1.7e-80): tmp = t_1 else: tmp = y * 5.0 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y + z) * Float64(x * 2.0)) tmp = 0.0 if (x <= -1.85e+62) tmp = t_1; elseif (x <= -1.75e+46) tmp = Float64(x * t); elseif ((x <= -1.8e-87) || !(x <= 1.7e-80)) tmp = t_1; else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y + z) * (x * 2.0); tmp = 0.0; if (x <= -1.85e+62) tmp = t_1; elseif (x <= -1.75e+46) tmp = x * t; elseif ((x <= -1.8e-87) || ~((x <= 1.7e-80))) tmp = t_1; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y + z), $MachinePrecision] * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.85e+62], t$95$1, If[LessEqual[x, -1.75e+46], N[(x * t), $MachinePrecision], If[Or[LessEqual[x, -1.8e-87], N[Not[LessEqual[x, 1.7e-80]], $MachinePrecision]], t$95$1, N[(y * 5.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + z\right) \cdot \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq -1.85 \cdot 10^{+62}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.75 \cdot 10^{+46}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -1.8 \cdot 10^{-87} \lor \neg \left(x \leq 1.7 \cdot 10^{-80}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.85000000000000007e62 or -1.74999999999999992e46 < x < -1.79999999999999996e-87 or 1.7e-80 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 96.0%
Taylor expanded in t around 0 68.4%
associate-*r*68.4%
+-commutative68.4%
*-commutative68.4%
associate-*r*68.4%
+-commutative68.4%
Simplified68.4%
if -1.85000000000000007e62 < x < -1.74999999999999992e46Initial program 99.7%
Taylor expanded in t around inf 86.1%
if -1.79999999999999996e-87 < x < 1.7e-80Initial program 99.9%
Taylor expanded in x around 0 68.4%
Final simplification68.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* y 2.0)))))
(if (<= x -23000000000.0)
t_1
(if (<= x 1.65e-81)
(* y (+ 5.0 (* x 2.0)))
(if (or (<= x 1.8) (not (<= x 1.3e+93))) (* (+ y z) (* x 2.0)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (y * 2.0));
double tmp;
if (x <= -23000000000.0) {
tmp = t_1;
} else if (x <= 1.65e-81) {
tmp = y * (5.0 + (x * 2.0));
} else if ((x <= 1.8) || !(x <= 1.3e+93)) {
tmp = (y + z) * (x * 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 = x * (t + (y * 2.0d0))
if (x <= (-23000000000.0d0)) then
tmp = t_1
else if (x <= 1.65d-81) then
tmp = y * (5.0d0 + (x * 2.0d0))
else if ((x <= 1.8d0) .or. (.not. (x <= 1.3d+93))) then
tmp = (y + z) * (x * 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 = x * (t + (y * 2.0));
double tmp;
if (x <= -23000000000.0) {
tmp = t_1;
} else if (x <= 1.65e-81) {
tmp = y * (5.0 + (x * 2.0));
} else if ((x <= 1.8) || !(x <= 1.3e+93)) {
tmp = (y + z) * (x * 2.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (y * 2.0)) tmp = 0 if x <= -23000000000.0: tmp = t_1 elif x <= 1.65e-81: tmp = y * (5.0 + (x * 2.0)) elif (x <= 1.8) or not (x <= 1.3e+93): tmp = (y + z) * (x * 2.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(y * 2.0))) tmp = 0.0 if (x <= -23000000000.0) tmp = t_1; elseif (x <= 1.65e-81) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); elseif ((x <= 1.8) || !(x <= 1.3e+93)) tmp = Float64(Float64(y + z) * Float64(x * 2.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (y * 2.0)); tmp = 0.0; if (x <= -23000000000.0) tmp = t_1; elseif (x <= 1.65e-81) tmp = y * (5.0 + (x * 2.0)); elseif ((x <= 1.8) || ~((x <= 1.3e+93))) tmp = (y + z) * (x * 2.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -23000000000.0], t$95$1, If[LessEqual[x, 1.65e-81], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 1.8], N[Not[LessEqual[x, 1.3e+93]], $MachinePrecision]], N[(N[(y + z), $MachinePrecision] * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + y \cdot 2\right)\\
\mathbf{if}\;x \leq -23000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-81}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{elif}\;x \leq 1.8 \lor \neg \left(x \leq 1.3 \cdot 10^{+93}\right):\\
\;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -2.3e10 or 1.80000000000000004 < x < 1.3e93Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in z around 0 71.6%
Taylor expanded in x around inf 71.6%
if -2.3e10 < x < 1.64999999999999994e-81Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 64.8%
if 1.64999999999999994e-81 < x < 1.80000000000000004 or 1.3e93 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 96.2%
Taylor expanded in t around 0 77.1%
associate-*r*77.1%
+-commutative77.1%
*-commutative77.1%
associate-*r*77.1%
+-commutative77.1%
Simplified77.1%
Final simplification69.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -31000000000.0) (not (<= x 4.1e-46))) (* 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 <= -31000000000.0) || !(x <= 4.1e-46)) {
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 <= (-31000000000.0d0)) .or. (.not. (x <= 4.1d-46))) 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 <= -31000000000.0) || !(x <= 4.1e-46)) {
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 <= -31000000000.0) or not (x <= 4.1e-46): 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 <= -31000000000.0) || !(x <= 4.1e-46)) 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 <= -31000000000.0) || ~((x <= 4.1e-46))) 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, -31000000000.0], N[Not[LessEqual[x, 4.1e-46]], $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 -31000000000 \lor \neg \left(x \leq 4.1 \cdot 10^{-46}\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 < -3.1e10 or 4.0999999999999999e-46 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 99.9%
if -3.1e10 < x < 4.0999999999999999e-46Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in t around 0 85.5%
Final simplification93.6%
(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 (or (<= x -2.4e-91) (not (<= x 1.05e-80))) (* 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 <= -2.4e-91) || !(x <= 1.05e-80)) {
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 <= (-2.4d-91)) .or. (.not. (x <= 1.05d-80))) 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 <= -2.4e-91) || !(x <= 1.05e-80)) {
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 <= -2.4e-91) or not (x <= 1.05e-80): 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 <= -2.4e-91) || !(x <= 1.05e-80)) 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 <= -2.4e-91) || ~((x <= 1.05e-80))) 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, -2.4e-91], N[Not[LessEqual[x, 1.05e-80]], $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 -2.4 \cdot 10^{-91} \lor \neg \left(x \leq 1.05 \cdot 10^{-80}\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 < -2.40000000000000011e-91 or 1.05000000000000001e-80 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 96.1%
if -2.40000000000000011e-91 < x < 1.05000000000000001e-80Initial program 99.9%
+-commutative99.9%
fma-def100.0%
distribute-rgt-in100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in t around inf 81.5%
Taylor expanded in y around 0 81.6%
Final simplification90.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.8e-85) (not (<= x 3.5e-43))) (* 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 <= -4.8e-85) || !(x <= 3.5e-43)) {
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 <= (-4.8d-85)) .or. (.not. (x <= 3.5d-43))) 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 <= -4.8e-85) || !(x <= 3.5e-43)) {
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 <= -4.8e-85) or not (x <= 3.5e-43): 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 <= -4.8e-85) || !(x <= 3.5e-43)) 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 <= -4.8e-85) || ~((x <= 3.5e-43))) 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, -4.8e-85], N[Not[LessEqual[x, 3.5e-43]], $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 -4.8 \cdot 10^{-85} \lor \neg \left(x \leq 3.5 \cdot 10^{-43}\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 < -4.8000000000000001e-85 or 3.49999999999999997e-43 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 97.2%
if -4.8000000000000001e-85 < x < 3.49999999999999997e-43Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in t around 0 86.7%
Taylor expanded in y around 0 86.7%
Final simplification93.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7e+23) (not (<= y 5.5e+50))) (* 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 <= -7e+23) || !(y <= 5.5e+50)) {
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 <= (-7d+23)) .or. (.not. (y <= 5.5d+50))) 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 <= -7e+23) || !(y <= 5.5e+50)) {
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 <= -7e+23) or not (y <= 5.5e+50): 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 <= -7e+23) || !(y <= 5.5e+50)) 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 <= -7e+23) || ~((y <= 5.5e+50))) 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, -7e+23], N[Not[LessEqual[y, 5.5e+50]], $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 -7 \cdot 10^{+23} \lor \neg \left(y \leq 5.5 \cdot 10^{+50}\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 < -7.0000000000000004e23 or 5.4999999999999998e50 < 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 85.7%
if -7.0000000000000004e23 < y < 5.4999999999999998e50Initial program 99.9%
Taylor expanded in y around 0 82.6%
Final simplification83.9%
(FPCore (x y z t) :precision binary64 (if (<= x -3.45e-93) (* x t) (if (<= x 2.9e-44) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.45e-93) {
tmp = x * t;
} else if (x <= 2.9e-44) {
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 <= (-3.45d-93)) then
tmp = x * t
else if (x <= 2.9d-44) 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 <= -3.45e-93) {
tmp = x * t;
} else if (x <= 2.9e-44) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.45e-93: tmp = x * t elif x <= 2.9e-44: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.45e-93) tmp = Float64(x * t); elseif (x <= 2.9e-44) 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 <= -3.45e-93) tmp = x * t; elseif (x <= 2.9e-44) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.45e-93], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.9e-44], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.45 \cdot 10^{-93}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-44}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -3.45000000000000015e-93 or 2.9000000000000001e-44 < x Initial program 100.0%
Taylor expanded in t around inf 35.0%
if -3.45000000000000015e-93 < x < 2.9000000000000001e-44Initial program 99.9%
Taylor expanded in x around 0 66.4%
Final simplification47.3%
(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 28.3%
Final simplification28.3%
herbie shell --seed 2023185
(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)))