
(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 10 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 (fma x y (fma a b (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, fma(a, b, (z * t)));
}
function code(x, y, z, t, a, b) return fma(x, y, fma(a, b, Float64(z * t))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * y + N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, z \cdot t\right)\right)
\end{array}
Initial program 98.0%
associate-+l+98.0%
fma-define98.4%
+-commutative98.4%
fma-define99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a b) :precision binary64 (+ (fma x y (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, (z * t)) + (a * b);
}
function code(x, y, z, t, a, b) return Float64(fma(x, y, Float64(z * t)) + Float64(a * b)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, z \cdot t\right) + a \cdot b
\end{array}
Initial program 98.0%
fma-define98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* a b) -7.4e+185)
(* a b)
(if (<= (* a b) -1.05e-60)
(* z t)
(if (<= (* a b) -5.3e-233)
(* x y)
(if (<= (* a b) 7.5e-272)
(* z t)
(if (<= (* a b) 4.6e-80)
(* x y)
(if (<= (* a b) 1.32e+37) (* z t) (* a b))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -7.4e+185) {
tmp = a * b;
} else if ((a * b) <= -1.05e-60) {
tmp = z * t;
} else if ((a * b) <= -5.3e-233) {
tmp = x * y;
} else if ((a * b) <= 7.5e-272) {
tmp = z * t;
} else if ((a * b) <= 4.6e-80) {
tmp = x * y;
} else if ((a * b) <= 1.32e+37) {
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 ((a * b) <= (-7.4d+185)) then
tmp = a * b
else if ((a * b) <= (-1.05d-60)) then
tmp = z * t
else if ((a * b) <= (-5.3d-233)) then
tmp = x * y
else if ((a * b) <= 7.5d-272) then
tmp = z * t
else if ((a * b) <= 4.6d-80) then
tmp = x * y
else if ((a * b) <= 1.32d+37) 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 ((a * b) <= -7.4e+185) {
tmp = a * b;
} else if ((a * b) <= -1.05e-60) {
tmp = z * t;
} else if ((a * b) <= -5.3e-233) {
tmp = x * y;
} else if ((a * b) <= 7.5e-272) {
tmp = z * t;
} else if ((a * b) <= 4.6e-80) {
tmp = x * y;
} else if ((a * b) <= 1.32e+37) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -7.4e+185: tmp = a * b elif (a * b) <= -1.05e-60: tmp = z * t elif (a * b) <= -5.3e-233: tmp = x * y elif (a * b) <= 7.5e-272: tmp = z * t elif (a * b) <= 4.6e-80: tmp = x * y elif (a * b) <= 1.32e+37: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -7.4e+185) tmp = Float64(a * b); elseif (Float64(a * b) <= -1.05e-60) tmp = Float64(z * t); elseif (Float64(a * b) <= -5.3e-233) tmp = Float64(x * y); elseif (Float64(a * b) <= 7.5e-272) tmp = Float64(z * t); elseif (Float64(a * b) <= 4.6e-80) tmp = Float64(x * y); elseif (Float64(a * b) <= 1.32e+37) 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 ((a * b) <= -7.4e+185) tmp = a * b; elseif ((a * b) <= -1.05e-60) tmp = z * t; elseif ((a * b) <= -5.3e-233) tmp = x * y; elseif ((a * b) <= 7.5e-272) tmp = z * t; elseif ((a * b) <= 4.6e-80) tmp = x * y; elseif ((a * b) <= 1.32e+37) tmp = z * t; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -7.4e+185], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.05e-60], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -5.3e-233], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 7.5e-272], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 4.6e-80], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.32e+37], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -7.4 \cdot 10^{+185}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -1.05 \cdot 10^{-60}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -5.3 \cdot 10^{-233}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 7.5 \cdot 10^{-272}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 4.6 \cdot 10^{-80}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.32 \cdot 10^{+37}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -7.3999999999999995e185 or 1.3199999999999999e37 < (*.f64 a b) Initial program 95.5%
Taylor expanded in a around inf 75.9%
if -7.3999999999999995e185 < (*.f64 a b) < -1.04999999999999996e-60 or -5.29999999999999972e-233 < (*.f64 a b) < 7.50000000000000005e-272 or 4.5999999999999996e-80 < (*.f64 a b) < 1.3199999999999999e37Initial program 99.9%
Taylor expanded in z around inf 54.6%
if -1.04999999999999996e-60 < (*.f64 a b) < -5.29999999999999972e-233 or 7.50000000000000005e-272 < (*.f64 a b) < 4.5999999999999996e-80Initial program 98.0%
Taylor expanded in x around inf 60.7%
Final simplification63.1%
(FPCore (x y z t a b)
:precision binary64
(if (or (<= (* x y) -2.25e+234)
(not
(or (<= (* x y) -9e+92)
(and (not (<= (* x y) -3e+72)) (<= (* x y) 2.8e+236)))))
(* 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) <= -2.25e+234) || !(((x * y) <= -9e+92) || (!((x * y) <= -3e+72) && ((x * y) <= 2.8e+236)))) {
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) <= (-2.25d+234)) .or. (.not. ((x * y) <= (-9d+92)) .or. (.not. ((x * y) <= (-3d+72))) .and. ((x * y) <= 2.8d+236))) 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) <= -2.25e+234) || !(((x * y) <= -9e+92) || (!((x * y) <= -3e+72) && ((x * y) <= 2.8e+236)))) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -2.25e+234) or not (((x * y) <= -9e+92) or (not ((x * y) <= -3e+72) and ((x * y) <= 2.8e+236))): 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) <= -2.25e+234) || !((Float64(x * y) <= -9e+92) || (!(Float64(x * y) <= -3e+72) && (Float64(x * y) <= 2.8e+236)))) 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) <= -2.25e+234) || ~((((x * y) <= -9e+92) || (~(((x * y) <= -3e+72)) && ((x * y) <= 2.8e+236))))) 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], -2.25e+234], N[Not[Or[LessEqual[N[(x * y), $MachinePrecision], -9e+92], And[N[Not[LessEqual[N[(x * y), $MachinePrecision], -3e+72]], $MachinePrecision], LessEqual[N[(x * y), $MachinePrecision], 2.8e+236]]]], $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 -2.25 \cdot 10^{+234} \lor \neg \left(x \cdot y \leq -9 \cdot 10^{+92} \lor \neg \left(x \cdot y \leq -3 \cdot 10^{+72}\right) \land x \cdot y \leq 2.8 \cdot 10^{+236}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -2.24999999999999991e234 or -8.9999999999999998e92 < (*.f64 x y) < -3.00000000000000003e72 or 2.79999999999999992e236 < (*.f64 x y) Initial program 92.3%
Taylor expanded in x around inf 89.3%
if -2.24999999999999991e234 < (*.f64 x y) < -8.9999999999999998e92 or -3.00000000000000003e72 < (*.f64 x y) < 2.79999999999999992e236Initial program 99.5%
Taylor expanded in x around 0 81.2%
Final simplification82.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (* a b) (+ (* x y) (* z t))))) (if (<= t_1 INFINITY) t_1 (* x (+ y (* t (/ z x)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + ((x * y) + (z * t));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = x * (y + (t * (z / x)));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + ((x * y) + (z * t));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = x * (y + (t * (z / x)));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a * b) + ((x * y) + (z * t)) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = x * (y + (t * (z / x))) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(x * Float64(y + Float64(t * Float64(z / x)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a * b) + ((x * y) + (z * t)); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = x * (y + (t * (z / x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(x * N[(y + N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + t \cdot \frac{z}{x}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) Initial program 0.0%
Taylor expanded in x around inf 20.0%
Taylor expanded in a around 0 60.0%
associate-*r/80.0%
Simplified80.0%
Final simplification99.6%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -7.4e+185) (+ (* a b) (* x y)) (if (<= (* a b) 5.2e+23) (+ (* 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 ((a * b) <= -7.4e+185) {
tmp = (a * b) + (x * y);
} else if ((a * b) <= 5.2e+23) {
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 ((a * b) <= (-7.4d+185)) then
tmp = (a * b) + (x * y)
else if ((a * b) <= 5.2d+23) 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 ((a * b) <= -7.4e+185) {
tmp = (a * b) + (x * y);
} else if ((a * b) <= 5.2e+23) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -7.4e+185: tmp = (a * b) + (x * y) elif (a * b) <= 5.2e+23: 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(a * b) <= -7.4e+185) tmp = Float64(Float64(a * b) + Float64(x * y)); elseif (Float64(a * b) <= 5.2e+23) 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 ((a * b) <= -7.4e+185) tmp = (a * b) + (x * y); elseif ((a * b) <= 5.2e+23) 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[(a * b), $MachinePrecision], -7.4e+185], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5.2e+23], 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}\;a \cdot b \leq -7.4 \cdot 10^{+185}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 5.2 \cdot 10^{+23}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -7.3999999999999995e185Initial program 95.0%
Taylor expanded in z around 0 87.9%
if -7.3999999999999995e185 < (*.f64 a b) < 5.19999999999999983e23Initial program 99.4%
Taylor expanded in a around 0 86.7%
if 5.19999999999999983e23 < (*.f64 a b) Initial program 95.9%
Taylor expanded in x around 0 88.1%
Final simplification87.2%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -1e+194) (* a (+ b (/ (* x y) a))) (if (<= (* a b) 1e+18) (+ (* 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 ((a * b) <= -1e+194) {
tmp = a * (b + ((x * y) / a));
} else if ((a * b) <= 1e+18) {
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 ((a * b) <= (-1d+194)) then
tmp = a * (b + ((x * y) / a))
else if ((a * b) <= 1d+18) 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 ((a * b) <= -1e+194) {
tmp = a * (b + ((x * y) / a));
} else if ((a * b) <= 1e+18) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -1e+194: tmp = a * (b + ((x * y) / a)) elif (a * b) <= 1e+18: 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(a * b) <= -1e+194) tmp = Float64(a * Float64(b + Float64(Float64(x * y) / a))); elseif (Float64(a * b) <= 1e+18) 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 ((a * b) <= -1e+194) tmp = a * (b + ((x * y) / a)); elseif ((a * b) <= 1e+18) 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[(a * b), $MachinePrecision], -1e+194], N[(a * N[(b + N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+18], 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}\;a \cdot b \leq -1 \cdot 10^{+194}:\\
\;\;\;\;a \cdot \left(b + \frac{x \cdot y}{a}\right)\\
\mathbf{elif}\;a \cdot b \leq 10^{+18}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -9.99999999999999945e193Initial program 95.0%
Taylor expanded in z around 0 87.9%
Taylor expanded in a around inf 90.4%
if -9.99999999999999945e193 < (*.f64 a b) < 1e18Initial program 99.4%
Taylor expanded in a around 0 86.7%
if 1e18 < (*.f64 a b) Initial program 95.9%
Taylor expanded in x around 0 88.1%
Final simplification87.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -7.4e+185) (not (<= (* a b) 1.65e+32))) (* a b) (* z t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -7.4e+185) || !((a * b) <= 1.65e+32)) {
tmp = a * b;
} else {
tmp = 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 (((a * b) <= (-7.4d+185)) .or. (.not. ((a * b) <= 1.65d+32))) then
tmp = a * b
else
tmp = 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 (((a * b) <= -7.4e+185) || !((a * b) <= 1.65e+32)) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -7.4e+185) or not ((a * b) <= 1.65e+32): tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -7.4e+185) || !(Float64(a * b) <= 1.65e+32)) tmp = Float64(a * b); else tmp = Float64(z * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((a * b) <= -7.4e+185) || ~(((a * b) <= 1.65e+32))) tmp = a * b; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -7.4e+185], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1.65e+32]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -7.4 \cdot 10^{+185} \lor \neg \left(a \cdot b \leq 1.65 \cdot 10^{+32}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -7.3999999999999995e185 or 1.6500000000000001e32 < (*.f64 a b) Initial program 95.5%
Taylor expanded in a around inf 75.9%
if -7.3999999999999995e185 < (*.f64 a b) < 1.6500000000000001e32Initial program 99.4%
Taylor expanded in z around inf 47.5%
Final simplification57.3%
(FPCore (x y z t a b) :precision binary64 (if (<= t -800000.0) (* z t) (if (<= t 5.4e+103) (+ (* a b) (* x y)) (+ (* a b) (* z t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -800000.0) {
tmp = z * t;
} else if (t <= 5.4e+103) {
tmp = (a * b) + (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 (t <= (-800000.0d0)) then
tmp = z * t
else if (t <= 5.4d+103) then
tmp = (a * b) + (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 (t <= -800000.0) {
tmp = z * t;
} else if (t <= 5.4e+103) {
tmp = (a * b) + (x * y);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -800000.0: tmp = z * t elif t <= 5.4e+103: tmp = (a * b) + (x * y) else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -800000.0) tmp = Float64(z * t); elseif (t <= 5.4e+103) tmp = Float64(Float64(a * b) + 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 (t <= -800000.0) tmp = z * t; elseif (t <= 5.4e+103) tmp = (a * b) + (x * y); else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -800000.0], N[(z * t), $MachinePrecision], If[LessEqual[t, 5.4e+103], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -800000:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;t \leq 5.4 \cdot 10^{+103}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if t < -8e5Initial program 94.3%
Taylor expanded in z around inf 48.0%
if -8e5 < t < 5.39999999999999985e103Initial program 99.3%
Taylor expanded in z around 0 81.0%
if 5.39999999999999985e103 < t Initial program 98.1%
Taylor expanded in x around 0 94.5%
Final simplification77.0%
(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 98.0%
Taylor expanded in a around inf 35.1%
Final simplification35.1%
herbie shell --seed 2024095
(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)))