
(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 x (+ (* 2.0 (+ y z)) t) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, ((2.0 * (y + z)) + t), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(Float64(2.0 * Float64(y + z)) + t), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)
\end{array}
Initial program 99.9%
fma-define99.9%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (* x 2.0))))
(if (<= t -1.55e+111)
(* x t)
(if (<= t -6.8e-181)
t_1
(if (<= t 9e-284) (* y 5.0) (if (<= t 0.021) 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 <= -1.55e+111) {
tmp = x * t;
} else if (t <= -6.8e-181) {
tmp = t_1;
} else if (t <= 9e-284) {
tmp = y * 5.0;
} else if (t <= 0.021) {
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 <= (-1.55d+111)) then
tmp = x * t
else if (t <= (-6.8d-181)) then
tmp = t_1
else if (t <= 9d-284) then
tmp = y * 5.0d0
else if (t <= 0.021d0) 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 <= -1.55e+111) {
tmp = x * t;
} else if (t <= -6.8e-181) {
tmp = t_1;
} else if (t <= 9e-284) {
tmp = y * 5.0;
} else if (t <= 0.021) {
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 <= -1.55e+111: tmp = x * t elif t <= -6.8e-181: tmp = t_1 elif t <= 9e-284: tmp = y * 5.0 elif t <= 0.021: 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 <= -1.55e+111) tmp = Float64(x * t); elseif (t <= -6.8e-181) tmp = t_1; elseif (t <= 9e-284) tmp = Float64(y * 5.0); elseif (t <= 0.021) 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 <= -1.55e+111) tmp = x * t; elseif (t <= -6.8e-181) tmp = t_1; elseif (t <= 9e-284) tmp = y * 5.0; elseif (t <= 0.021) 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, -1.55e+111], N[(x * t), $MachinePrecision], If[LessEqual[t, -6.8e-181], t$95$1, If[LessEqual[t, 9e-284], N[(y * 5.0), $MachinePrecision], If[LessEqual[t, 0.021], 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 -1.55 \cdot 10^{+111}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq -6.8 \cdot 10^{-181}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 9 \cdot 10^{-284}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;t \leq 0.021:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -1.55e111 or 0.0210000000000000013 < t Initial program 99.9%
Taylor expanded in t around inf 65.6%
Simplified65.6%
if -1.55e111 < t < -6.8000000000000001e-181 or 8.9999999999999999e-284 < t < 0.0210000000000000013Initial program 99.9%
Taylor expanded in z around inf 48.2%
Simplified48.2%
if -6.8000000000000001e-181 < t < 8.9999999999999999e-284Initial program 100.0%
Taylor expanded in x around 0 49.0%
Final simplification55.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.4e-7) (not (<= x 1.4e-87))) (* x (+ t (+ (* 2.0 (+ y z)) (* 5.0 (/ y x))))) (+ (* y 5.0) (* x (+ t (* 2.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.4e-7) || !(x <= 1.4e-87)) {
tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + (x * (t + (2.0 * 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 <= (-2.4d-7)) .or. (.not. (x <= 1.4d-87))) then
tmp = x * (t + ((2.0d0 * (y + z)) + (5.0d0 * (y / x))))
else
tmp = (y * 5.0d0) + (x * (t + (2.0d0 * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.4e-7) || !(x <= 1.4e-87)) {
tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + (x * (t + (2.0 * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.4e-7) or not (x <= 1.4e-87): tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x)))) else: tmp = (y * 5.0) + (x * (t + (2.0 * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.4e-7) || !(x <= 1.4e-87)) tmp = Float64(x * Float64(t + Float64(Float64(2.0 * Float64(y + z)) + Float64(5.0 * Float64(y / x))))); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(2.0 * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.4e-7) || ~((x <= 1.4e-87))) tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x)))); else tmp = (y * 5.0) + (x * (t + (2.0 * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.4e-7], N[Not[LessEqual[x, 1.4e-87]], $MachinePrecision]], N[(x * N[(t + N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + N[(5.0 * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-7} \lor \neg \left(x \leq 1.4 \cdot 10^{-87}\right):\\
\;\;\;\;x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if x < -2.39999999999999979e-7 or 1.4e-87 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -2.39999999999999979e-7 < x < 1.4e-87Initial program 99.9%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -1.7e+69)
t_1
(if (<= y -1.5e-76)
(+ (* y 5.0) (* x t))
(if (<= y 1.75e+99) (* x (+ t (* 2.0 z))) 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 <= -1.7e+69) {
tmp = t_1;
} else if (y <= -1.5e-76) {
tmp = (y * 5.0) + (x * t);
} else if (y <= 1.75e+99) {
tmp = x * (t + (2.0 * z));
} 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 <= (-1.7d+69)) then
tmp = t_1
else if (y <= (-1.5d-76)) then
tmp = (y * 5.0d0) + (x * t)
else if (y <= 1.75d+99) then
tmp = x * (t + (2.0d0 * z))
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 <= -1.7e+69) {
tmp = t_1;
} else if (y <= -1.5e-76) {
tmp = (y * 5.0) + (x * t);
} else if (y <= 1.75e+99) {
tmp = x * (t + (2.0 * z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -1.7e+69: tmp = t_1 elif y <= -1.5e-76: tmp = (y * 5.0) + (x * t) elif y <= 1.75e+99: tmp = x * (t + (2.0 * z)) 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 <= -1.7e+69) tmp = t_1; elseif (y <= -1.5e-76) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); elseif (y <= 1.75e+99) tmp = Float64(x * Float64(t + Float64(2.0 * z))); 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 <= -1.7e+69) tmp = t_1; elseif (y <= -1.5e-76) tmp = (y * 5.0) + (x * t); elseif (y <= 1.75e+99) tmp = x * (t + (2.0 * z)); 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, -1.7e+69], t$95$1, If[LessEqual[y, -1.5e-76], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.75e+99], N[(x * N[(t + N[(2.0 * z), $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 -1.7 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.5 \cdot 10^{-76}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{+99}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.69999999999999993e69 or 1.7499999999999999e99 < y Initial program 99.9%
Taylor expanded in y around inf 88.8%
Simplified88.8%
if -1.69999999999999993e69 < y < -1.50000000000000012e-76Initial program 99.8%
Taylor expanded in y around 0 90.8%
Taylor expanded in z around 0 65.6%
if -1.50000000000000012e-76 < y < 1.7499999999999999e99Initial program 100.0%
Taylor expanded in y around 0 83.4%
Final simplification82.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9500.0) (not (<= x 0.49))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x (+ t (* 2.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9500.0) || !(x <= 0.49)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * (t + (2.0 * 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 <= (-9500.0d0)) .or. (.not. (x <= 0.49d0))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (y * 5.0d0) + (x * (t + (2.0d0 * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9500.0) || !(x <= 0.49)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * (t + (2.0 * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9500.0) or not (x <= 0.49): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * (t + (2.0 * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9500.0) || !(x <= 0.49)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(2.0 * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -9500.0) || ~((x <= 0.49))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (x * (t + (2.0 * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9500.0], N[Not[LessEqual[x, 0.49]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9500 \lor \neg \left(x \leq 0.49\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if x < -9500 or 0.48999999999999999 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 99.8%
if -9500 < x < 0.48999999999999999Initial program 99.9%
Taylor expanded in y around 0 99.1%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.8e-24) (not (<= x 1.5e-45))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.8e-24) || !(x <= 1.5e-45)) {
tmp = x * ((2.0 * (y + z)) + t);
} 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 <= (-6.8d-24)) .or. (.not. (x <= 1.5d-45))) then
tmp = x * ((2.0d0 * (y + z)) + t)
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 <= -6.8e-24) || !(x <= 1.5e-45)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.8e-24) or not (x <= 1.5e-45): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.8e-24) || !(x <= 1.5e-45)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); 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 <= -6.8e-24) || ~((x <= 1.5e-45))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.8e-24], N[Not[LessEqual[x, 1.5e-45]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-24} \lor \neg \left(x \leq 1.5 \cdot 10^{-45}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -6.79999999999999985e-24 or 1.50000000000000005e-45 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 97.9%
if -6.79999999999999985e-24 < x < 1.50000000000000005e-45Initial program 99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in z around 0 77.1%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.4e-20) (not (<= x 1.2e-70))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* 2.0 (* x z)) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.4e-20) || !(x <= 1.2e-70)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (2.0 * (x * 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 <= (-4.4d-20)) .or. (.not. (x <= 1.2d-70))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (2.0d0 * (x * 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 <= -4.4e-20) || !(x <= 1.2e-70)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (2.0 * (x * z)) + (y * 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.4e-20) or not (x <= 1.2e-70): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (2.0 * (x * z)) + (y * 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.4e-20) || !(x <= 1.2e-70)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(2.0 * Float64(x * z)) + Float64(y * 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.4e-20) || ~((x <= 1.2e-70))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (2.0 * (x * z)) + (y * 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.4e-20], N[Not[LessEqual[x, 1.2e-70]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{-20} \lor \neg \left(x \leq 1.2 \cdot 10^{-70}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right) + y \cdot 5\\
\end{array}
\end{array}
if x < -4.39999999999999982e-20 or 1.2000000000000001e-70 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 96.6%
if -4.39999999999999982e-20 < x < 1.2000000000000001e-70Initial program 99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in t around 0 79.0%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (<= y -1.05e+102) (* x (* 2.0 y)) (if (or (<= y -2.5e-82) (not (<= y 7e+26))) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.05e+102) {
tmp = x * (2.0 * y);
} else if ((y <= -2.5e-82) || !(y <= 7e+26)) {
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 (y <= (-1.05d+102)) then
tmp = x * (2.0d0 * y)
else if ((y <= (-2.5d-82)) .or. (.not. (y <= 7d+26))) 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 (y <= -1.05e+102) {
tmp = x * (2.0 * y);
} else if ((y <= -2.5e-82) || !(y <= 7e+26)) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.05e+102: tmp = x * (2.0 * y) elif (y <= -2.5e-82) or not (y <= 7e+26): tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.05e+102) tmp = Float64(x * Float64(2.0 * y)); elseif ((y <= -2.5e-82) || !(y <= 7e+26)) 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 (y <= -1.05e+102) tmp = x * (2.0 * y); elseif ((y <= -2.5e-82) || ~((y <= 7e+26))) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.05e+102], N[(x * N[(2.0 * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -2.5e-82], N[Not[LessEqual[y, 7e+26]], $MachinePrecision]], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+102}:\\
\;\;\;\;x \cdot \left(2 \cdot y\right)\\
\mathbf{elif}\;y \leq -2.5 \cdot 10^{-82} \lor \neg \left(y \leq 7 \cdot 10^{+26}\right):\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if y < -1.05000000000000001e102Initial program 99.9%
Taylor expanded in y around inf 93.3%
Simplified93.3%
Taylor expanded in x around inf 65.7%
Taylor expanded in x around inf 61.2%
associate-*r*61.2%
*-commutative61.2%
associate-*r*61.2%
Simplified61.2%
if -1.05000000000000001e102 < y < -2.4999999999999999e-82 or 6.9999999999999998e26 < y Initial program 99.9%
Taylor expanded in x around 0 50.5%
if -2.4999999999999999e-82 < y < 6.9999999999999998e26Initial program 100.0%
Taylor expanded in t around inf 47.9%
Simplified47.9%
Final simplification50.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.8e+22) (not (<= z 1.8e+116))) (* z (* x 2.0)) (* x (+ t (* 2.0 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e+22) || !(z <= 1.8e+116)) {
tmp = z * (x * 2.0);
} else {
tmp = x * (t + (2.0 * y));
}
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 <= (-4.8d+22)) .or. (.not. (z <= 1.8d+116))) then
tmp = z * (x * 2.0d0)
else
tmp = x * (t + (2.0d0 * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e+22) || !(z <= 1.8e+116)) {
tmp = z * (x * 2.0);
} else {
tmp = x * (t + (2.0 * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.8e+22) or not (z <= 1.8e+116): tmp = z * (x * 2.0) else: tmp = x * (t + (2.0 * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.8e+22) || !(z <= 1.8e+116)) tmp = Float64(z * Float64(x * 2.0)); else tmp = Float64(x * Float64(t + Float64(2.0 * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.8e+22) || ~((z <= 1.8e+116))) tmp = z * (x * 2.0); else tmp = x * (t + (2.0 * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.8e+22], N[Not[LessEqual[z, 1.8e+116]], $MachinePrecision]], N[(z * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+22} \lor \neg \left(z \leq 1.8 \cdot 10^{+116}\right):\\
\;\;\;\;z \cdot \left(x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\
\end{array}
\end{array}
if z < -4.8e22 or 1.79999999999999985e116 < z Initial program 99.9%
Taylor expanded in z around inf 67.6%
Simplified67.6%
if -4.8e22 < z < 1.79999999999999985e116Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 69.8%
Taylor expanded in z around 0 60.7%
Final simplification63.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.4e-50) (not (<= z 1.95e+31))) (* x (+ t (* 2.0 z))) (* x (+ t (* 2.0 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.4e-50) || !(z <= 1.95e+31)) {
tmp = x * (t + (2.0 * z));
} else {
tmp = x * (t + (2.0 * y));
}
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 <= (-5.4d-50)) .or. (.not. (z <= 1.95d+31))) then
tmp = x * (t + (2.0d0 * z))
else
tmp = x * (t + (2.0d0 * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.4e-50) || !(z <= 1.95e+31)) {
tmp = x * (t + (2.0 * z));
} else {
tmp = x * (t + (2.0 * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.4e-50) or not (z <= 1.95e+31): tmp = x * (t + (2.0 * z)) else: tmp = x * (t + (2.0 * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.4e-50) || !(z <= 1.95e+31)) tmp = Float64(x * Float64(t + Float64(2.0 * z))); else tmp = Float64(x * Float64(t + Float64(2.0 * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.4e-50) || ~((z <= 1.95e+31))) tmp = x * (t + (2.0 * z)); else tmp = x * (t + (2.0 * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.4e-50], N[Not[LessEqual[z, 1.95e+31]], $MachinePrecision]], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{-50} \lor \neg \left(z \leq 1.95 \cdot 10^{+31}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\
\end{array}
\end{array}
if z < -5.3999999999999999e-50 or 1.95e31 < z Initial program 99.9%
Taylor expanded in y around 0 76.5%
if -5.3999999999999999e-50 < z < 1.95e31Initial program 99.9%
fma-define99.9%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 67.7%
Taylor expanded in z around 0 64.0%
Final simplification70.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.9e+64) (not (<= y 4.1e+96))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* 2.0 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.9e+64) || !(y <= 4.1e+96)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (2.0 * 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 ((y <= (-3.9d+64)) .or. (.not. (y <= 4.1d+96))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (2.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.9e+64) || !(y <= 4.1e+96)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (2.0 * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.9e+64) or not (y <= 4.1e+96): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (2.0 * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.9e+64) || !(y <= 4.1e+96)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(2.0 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.9e+64) || ~((y <= 4.1e+96))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (2.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.9e+64], N[Not[LessEqual[y, 4.1e+96]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \cdot 10^{+64} \lor \neg \left(y \leq 4.1 \cdot 10^{+96}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if y < -3.8999999999999998e64 or 4.09999999999999998e96 < y Initial program 99.9%
Taylor expanded in y around inf 88.8%
Simplified88.8%
if -3.8999999999999998e64 < y < 4.09999999999999998e96Initial program 99.9%
Taylor expanded in y around 0 76.5%
Final simplification80.1%
(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 -1.1e-23) (not (<= x 1.12e-73))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.1e-23) || !(x <= 1.12e-73)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.1d-23)) .or. (.not. (x <= 1.12d-73))) then
tmp = x * t
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.1e-23) || !(x <= 1.12e-73)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.1e-23) or not (x <= 1.12e-73): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.1e-23) || !(x <= 1.12e-73)) tmp = Float64(x * t); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.1e-23) || ~((x <= 1.12e-73))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.1e-23], N[Not[LessEqual[x, 1.12e-73]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-23} \lor \neg \left(x \leq 1.12 \cdot 10^{-73}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.1e-23 or 1.11999999999999995e-73 < x Initial program 100.0%
Taylor expanded in t around inf 41.2%
Simplified41.2%
if -1.1e-23 < x < 1.11999999999999995e-73Initial program 99.9%
Taylor expanded in x around 0 55.6%
Final simplification47.7%
(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 27.4%
Final simplification27.4%
herbie shell --seed 2024115
(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)))