
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x * y) + (z * t)) + (a * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
def code(x, y, z, t, a, b): return ((x * y) + (z * t)) + (a * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * t)) + (a * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + z \cdot t\right) + a \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x * y) + (z * t)) + (a * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
def code(x, y, z, t, a, b): return ((x * y) + (z * t)) + (a * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * t)) + (a * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + z \cdot t\right) + a \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (* x y) (* z t)) 1e+302) (+ (fma x y (* z t)) (* a b)) (* z (+ t (+ (* x (/ y z)) (* a (/ b z)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) + (z * t)) <= 1e+302) {
tmp = fma(x, y, (z * t)) + (a * b);
} else {
tmp = z * (t + ((x * (y / z)) + (a * (b / z))));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(x * y) + Float64(z * t)) <= 1e+302) tmp = Float64(fma(x, y, Float64(z * t)) + Float64(a * b)); else tmp = Float64(z * Float64(t + Float64(Float64(x * Float64(y / z)) + Float64(a * Float64(b / z))))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], 1e+302], N[(N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(z * N[(t + N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] + N[(a * N[(b / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y + z \cdot t \leq 10^{+302}:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot t\right) + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t + \left(x \cdot \frac{y}{z} + a \cdot \frac{b}{z}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < 1.0000000000000001e302Initial program 100.0%
fma-define100.0%
Simplified100.0%
if 1.0000000000000001e302 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 81.3%
Taylor expanded in z around inf 93.8%
+-commutative93.8%
associate-/l*96.9%
associate-/l*100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t a b) :precision binary64 (fma a b (fma x y (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(a, b, fma(x, y, (z * t)));
}
function code(x, y, z, t, a, b) return fma(a, b, fma(x, y, Float64(z * t))) end
code[x_, y_, z_, t_, a_, b_] := N[(a * b + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)
\end{array}
Initial program 97.6%
+-commutative97.6%
fma-define98.0%
fma-define98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x y) -1.05e+54)
(* x y)
(if (<= (* x y) -5.5e-73)
(* z t)
(if (<= (* x y) 7.5e-77)
(* a b)
(if (<= (* x y) 0.145)
(* z t)
(if (<= (* x y) 1.35e+30) (* a b) (* x y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -1.05e+54) {
tmp = x * y;
} else if ((x * y) <= -5.5e-73) {
tmp = z * t;
} else if ((x * y) <= 7.5e-77) {
tmp = a * b;
} else if ((x * y) <= 0.145) {
tmp = z * t;
} else if ((x * y) <= 1.35e+30) {
tmp = a * b;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((x * y) <= (-1.05d+54)) then
tmp = x * y
else if ((x * y) <= (-5.5d-73)) then
tmp = z * t
else if ((x * y) <= 7.5d-77) then
tmp = a * b
else if ((x * y) <= 0.145d0) then
tmp = z * t
else if ((x * y) <= 1.35d+30) then
tmp = a * b
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -1.05e+54) {
tmp = x * y;
} else if ((x * y) <= -5.5e-73) {
tmp = z * t;
} else if ((x * y) <= 7.5e-77) {
tmp = a * b;
} else if ((x * y) <= 0.145) {
tmp = z * t;
} else if ((x * y) <= 1.35e+30) {
tmp = a * b;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -1.05e+54: tmp = x * y elif (x * y) <= -5.5e-73: tmp = z * t elif (x * y) <= 7.5e-77: tmp = a * b elif (x * y) <= 0.145: tmp = z * t elif (x * y) <= 1.35e+30: tmp = a * b else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -1.05e+54) tmp = Float64(x * y); elseif (Float64(x * y) <= -5.5e-73) tmp = Float64(z * t); elseif (Float64(x * y) <= 7.5e-77) tmp = Float64(a * b); elseif (Float64(x * y) <= 0.145) tmp = Float64(z * t); elseif (Float64(x * y) <= 1.35e+30) tmp = Float64(a * b); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x * y) <= -1.05e+54) tmp = x * y; elseif ((x * y) <= -5.5e-73) tmp = z * t; elseif ((x * y) <= 7.5e-77) tmp = a * b; elseif ((x * y) <= 0.145) tmp = z * t; elseif ((x * y) <= 1.35e+30) tmp = a * b; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -1.05e+54], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5.5e-73], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 7.5e-77], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 0.145], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.35e+30], N[(a * b), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.05 \cdot 10^{+54}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq -5.5 \cdot 10^{-73}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 7.5 \cdot 10^{-77}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 0.145:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 1.35 \cdot 10^{+30}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -1.04999999999999993e54 or 1.3499999999999999e30 < (*.f64 x y) Initial program 94.9%
Taylor expanded in x around inf 86.2%
Taylor expanded in y around inf 86.2%
associate-/l*86.3%
Simplified86.3%
Taylor expanded in y around inf 73.8%
if -1.04999999999999993e54 < (*.f64 x y) < -5.50000000000000006e-73 or 7.5000000000000006e-77 < (*.f64 x y) < 0.14499999999999999Initial program 99.9%
Taylor expanded in y around inf 88.4%
Taylor expanded in a around 0 71.9%
Taylor expanded in y around 0 66.3%
if -5.50000000000000006e-73 < (*.f64 x y) < 7.5000000000000006e-77 or 0.14499999999999999 < (*.f64 x y) < 1.3499999999999999e30Initial program 100.0%
Taylor expanded in a around inf 68.3%
Final simplification70.5%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x y) -2e+112)
(+ (* x y) (* a b))
(if (<= (* x y) -5e-16)
(+ (* x y) (* z t))
(if (<= (* x y) 2e+41) (+ (* a b) (* z t)) (* y (+ x (/ (* z t) y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -2e+112) {
tmp = (x * y) + (a * b);
} else if ((x * y) <= -5e-16) {
tmp = (x * y) + (z * t);
} else if ((x * y) <= 2e+41) {
tmp = (a * b) + (z * t);
} else {
tmp = y * (x + ((z * t) / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((x * y) <= (-2d+112)) then
tmp = (x * y) + (a * b)
else if ((x * y) <= (-5d-16)) then
tmp = (x * y) + (z * t)
else if ((x * y) <= 2d+41) then
tmp = (a * b) + (z * t)
else
tmp = y * (x + ((z * t) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -2e+112) {
tmp = (x * y) + (a * b);
} else if ((x * y) <= -5e-16) {
tmp = (x * y) + (z * t);
} else if ((x * y) <= 2e+41) {
tmp = (a * b) + (z * t);
} else {
tmp = y * (x + ((z * t) / y));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -2e+112: tmp = (x * y) + (a * b) elif (x * y) <= -5e-16: tmp = (x * y) + (z * t) elif (x * y) <= 2e+41: tmp = (a * b) + (z * t) else: tmp = y * (x + ((z * t) / y)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -2e+112) tmp = Float64(Float64(x * y) + Float64(a * b)); elseif (Float64(x * y) <= -5e-16) tmp = Float64(Float64(x * y) + Float64(z * t)); elseif (Float64(x * y) <= 2e+41) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(y * Float64(x + Float64(Float64(z * t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x * y) <= -2e+112) tmp = (x * y) + (a * b); elseif ((x * y) <= -5e-16) tmp = (x * y) + (z * t); elseif ((x * y) <= 2e+41) tmp = (a * b) + (z * t); else tmp = y * (x + ((z * t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+112], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5e-16], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+41], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(y * N[(x + N[(N[(z * t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+112}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-16}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+41}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + \frac{z \cdot t}{y}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.9999999999999999e112Initial program 97.9%
Taylor expanded in x around inf 94.1%
if -1.9999999999999999e112 < (*.f64 x y) < -5.0000000000000004e-16Initial program 99.9%
Taylor expanded in y around inf 90.3%
Taylor expanded in a around 0 80.8%
Taylor expanded in y around 0 90.5%
if -5.0000000000000004e-16 < (*.f64 x y) < 2.00000000000000001e41Initial program 100.0%
Taylor expanded in x around 0 95.4%
if 2.00000000000000001e41 < (*.f64 x y) Initial program 91.6%
Taylor expanded in y around inf 91.8%
Taylor expanded in a around 0 87.0%
Final simplification92.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x y) -2e+112)
(+ (* x y) (* a b))
(if (or (<= (* x y) -5e-16) (not (<= (* x y) 2e+28)))
(+ (* x y) (* z t))
(+ (* a b) (* z t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -2e+112) {
tmp = (x * y) + (a * b);
} else if (((x * y) <= -5e-16) || !((x * y) <= 2e+28)) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((x * y) <= (-2d+112)) then
tmp = (x * y) + (a * b)
else if (((x * y) <= (-5d-16)) .or. (.not. ((x * y) <= 2d+28))) then
tmp = (x * y) + (z * t)
else
tmp = (a * b) + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -2e+112) {
tmp = (x * y) + (a * b);
} else if (((x * y) <= -5e-16) || !((x * y) <= 2e+28)) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -2e+112: tmp = (x * y) + (a * b) elif ((x * y) <= -5e-16) or not ((x * y) <= 2e+28): tmp = (x * y) + (z * t) else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -2e+112) tmp = Float64(Float64(x * y) + Float64(a * b)); elseif ((Float64(x * y) <= -5e-16) || !(Float64(x * y) <= 2e+28)) tmp = Float64(Float64(x * y) + Float64(z * t)); else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x * y) <= -2e+112) tmp = (x * y) + (a * b); elseif (((x * y) <= -5e-16) || ~(((x * y) <= 2e+28))) tmp = (x * y) + (z * t); else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+112], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * y), $MachinePrecision], -5e-16], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+28]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+112}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-16} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+28}\right):\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -1.9999999999999999e112Initial program 97.9%
Taylor expanded in x around inf 94.1%
if -1.9999999999999999e112 < (*.f64 x y) < -5.0000000000000004e-16 or 1.99999999999999992e28 < (*.f64 x y) Initial program 94.4%
Taylor expanded in y around inf 91.4%
Taylor expanded in a around 0 85.1%
Taylor expanded in y around 0 88.1%
if -5.0000000000000004e-16 < (*.f64 x y) < 1.99999999999999992e28Initial program 100.0%
Taylor expanded in x around 0 95.3%
Final simplification92.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))))
(if (<= t_1 1e+302)
(+ (* a b) t_1)
(* z (+ t (+ (* x (/ y z)) (* a (/ b z))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * y) + (z * t);
double tmp;
if (t_1 <= 1e+302) {
tmp = (a * b) + t_1;
} else {
tmp = z * (t + ((x * (y / z)) + (a * (b / z))));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) + (z * t)
if (t_1 <= 1d+302) then
tmp = (a * b) + t_1
else
tmp = z * (t + ((x * (y / z)) + (a * (b / z))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * y) + (z * t);
double tmp;
if (t_1 <= 1e+302) {
tmp = (a * b) + t_1;
} else {
tmp = z * (t + ((x * (y / z)) + (a * (b / z))));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x * y) + (z * t) tmp = 0 if t_1 <= 1e+302: tmp = (a * b) + t_1 else: tmp = z * (t + ((x * (y / z)) + (a * (b / z)))) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (t_1 <= 1e+302) tmp = Float64(Float64(a * b) + t_1); else tmp = Float64(z * Float64(t + Float64(Float64(x * Float64(y / z)) + Float64(a * Float64(b / z))))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x * y) + (z * t); tmp = 0.0; if (t_1 <= 1e+302) tmp = (a * b) + t_1; else tmp = z * (t + ((x * (y / z)) + (a * (b / z)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+302], N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision], N[(z * N[(t + N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] + N[(a * N[(b / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_1 \leq 10^{+302}:\\
\;\;\;\;a \cdot b + t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t + \left(x \cdot \frac{y}{z} + a \cdot \frac{b}{z}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < 1.0000000000000001e302Initial program 100.0%
if 1.0000000000000001e302 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 81.3%
Taylor expanded in z around inf 93.8%
+-commutative93.8%
associate-/l*96.9%
associate-/l*100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (* x y) (* z t)))) (if (<= t_1 1e+302) (+ (* a b) t_1) (* t (* y (+ (/ x t) (/ z y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * y) + (z * t);
double tmp;
if (t_1 <= 1e+302) {
tmp = (a * b) + t_1;
} else {
tmp = t * (y * ((x / t) + (z / y)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) + (z * t)
if (t_1 <= 1d+302) then
tmp = (a * b) + t_1
else
tmp = t * (y * ((x / t) + (z / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * y) + (z * t);
double tmp;
if (t_1 <= 1e+302) {
tmp = (a * b) + t_1;
} else {
tmp = t * (y * ((x / t) + (z / y)));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x * y) + (z * t) tmp = 0 if t_1 <= 1e+302: tmp = (a * b) + t_1 else: tmp = t * (y * ((x / t) + (z / y))) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (t_1 <= 1e+302) tmp = Float64(Float64(a * b) + t_1); else tmp = Float64(t * Float64(y * Float64(Float64(x / t) + Float64(z / y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x * y) + (z * t); tmp = 0.0; if (t_1 <= 1e+302) tmp = (a * b) + t_1; else tmp = t * (y * ((x / t) + (z / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+302], N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t * N[(y * N[(N[(x / t), $MachinePrecision] + N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_1 \leq 10^{+302}:\\
\;\;\;\;a \cdot b + t\_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(\frac{x}{t} + \frac{z}{y}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < 1.0000000000000001e302Initial program 100.0%
if 1.0000000000000001e302 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 81.3%
Taylor expanded in t around inf 90.6%
Taylor expanded in y around inf 93.8%
Taylor expanded in a around 0 96.9%
Final simplification99.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -3.8e+124) (not (<= (* x y) 3.6e+94))) (* x y) (+ (* a b) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -3.8e+124) || !((x * y) <= 3.6e+94)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (((x * y) <= (-3.8d+124)) .or. (.not. ((x * y) <= 3.6d+94))) then
tmp = x * y
else
tmp = (a * b) + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -3.8e+124) || !((x * y) <= 3.6e+94)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -3.8e+124) or not ((x * y) <= 3.6e+94): tmp = x * y else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(x * y) <= -3.8e+124) || !(Float64(x * y) <= 3.6e+94)) tmp = Float64(x * y); else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((x * y) <= -3.8e+124) || ~(((x * y) <= 3.6e+94))) tmp = x * y; else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -3.8e+124], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3.6e+94]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.8 \cdot 10^{+124} \lor \neg \left(x \cdot y \leq 3.6 \cdot 10^{+94}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -3.7999999999999998e124 or 3.59999999999999992e94 < (*.f64 x y) Initial program 93.8%
Taylor expanded in x around inf 91.1%
Taylor expanded in y around inf 91.1%
associate-/l*92.2%
Simplified92.2%
Taylor expanded in y around inf 81.0%
if -3.7999999999999998e124 < (*.f64 x y) < 3.59999999999999992e94Initial program 100.0%
Taylor expanded in x around 0 88.2%
Final simplification85.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -5.9e-16) (not (<= (* x y) 4.2e+30))) (+ (* x y) (* z t)) (+ (* a b) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -5.9e-16) || !((x * y) <= 4.2e+30)) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (((x * y) <= (-5.9d-16)) .or. (.not. ((x * y) <= 4.2d+30))) then
tmp = (x * y) + (z * t)
else
tmp = (a * b) + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * y) <= -5.9e-16) || !((x * y) <= 4.2e+30)) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -5.9e-16) or not ((x * y) <= 4.2e+30): tmp = (x * y) + (z * t) else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(x * y) <= -5.9e-16) || !(Float64(x * y) <= 4.2e+30)) tmp = Float64(Float64(x * y) + Float64(z * t)); else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((x * y) <= -5.9e-16) || ~(((x * y) <= 4.2e+30))) tmp = (x * y) + (z * t); else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -5.9e-16], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4.2e+30]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5.9 \cdot 10^{-16} \lor \neg \left(x \cdot y \leq 4.2 \cdot 10^{+30}\right):\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -5.90000000000000022e-16 or 4.2e30 < (*.f64 x y) Initial program 95.6%
Taylor expanded in y around inf 93.6%
Taylor expanded in a around 0 82.3%
Taylor expanded in y around 0 84.3%
if -5.90000000000000022e-16 < (*.f64 x y) < 4.2e30Initial program 100.0%
Taylor expanded in x around 0 95.3%
Final simplification89.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -3.1e+139) (not (<= z 7.2e-136))) (* z t) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.1e+139) || !(z <= 7.2e-136)) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((z <= (-3.1d+139)) .or. (.not. (z <= 7.2d-136))) then
tmp = z * t
else
tmp = a * b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.1e+139) || !(z <= 7.2e-136)) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -3.1e+139) or not (z <= 7.2e-136): tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.1e+139) || !(z <= 7.2e-136)) tmp = Float64(z * t); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -3.1e+139) || ~((z <= 7.2e-136))) tmp = z * t; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.1e+139], N[Not[LessEqual[z, 7.2e-136]], $MachinePrecision]], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+139} \lor \neg \left(z \leq 7.2 \cdot 10^{-136}\right):\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if z < -3.1e139 or 7.1999999999999996e-136 < z Initial program 96.1%
Taylor expanded in y around inf 88.7%
Taylor expanded in a around 0 69.0%
Taylor expanded in y around 0 43.2%
if -3.1e139 < z < 7.1999999999999996e-136Initial program 99.2%
Taylor expanded in a around inf 46.4%
Final simplification44.8%
(FPCore (x y z t a b) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b) {
return a * b;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a * b;
}
def code(x, y, z, t, a, b): return a * b
function code(x, y, z, t, a, b) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b
\end{array}
Initial program 97.6%
Taylor expanded in a around inf 36.7%
Final simplification36.7%
herbie shell --seed 2024055
(FPCore (x y z t a b)
:name "Linear.V3:$cdot from linear-1.19.1.3, B"
:precision binary64
(+ (+ (* x y) (* z t)) (* a b)))