
(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 9 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 (<= (+ (* a b) (+ (* x y) (* z t))) INFINITY) (+ (* a b) (fma x y (* z t))) (* b (+ a (* x (/ y b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) + ((x * y) + (z * t))) <= ((double) INFINITY)) {
tmp = (a * b) + fma(x, y, (z * t));
} else {
tmp = b * (a + (x * (y / b)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))) <= Inf) tmp = Float64(Float64(a * b) + fma(x, y, Float64(z * t))); else tmp = Float64(b * Float64(a + Float64(x * Float64(y / b)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(a * b), $MachinePrecision] + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * N[(a + N[(x * N[(y / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b + \left(x \cdot y + z \cdot t\right) \leq \infty:\\
\;\;\;\;a \cdot b + \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a + x \cdot \frac{y}{b}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) < +inf.0Initial program 100.0%
fma-define100.0%
Simplified100.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 83.3%
Taylor expanded in b around inf 83.3%
associate-/l*100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t a b) :precision binary64 (fma x y (fma z t (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, fma(z, t, (a * b)));
}
function code(x, y, z, t, a, b) return fma(x, y, fma(z, t, Float64(a * b))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)
\end{array}
Initial program 97.6%
associate-+l+97.6%
fma-define98.0%
fma-define99.6%
Simplified99.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x y) -4.7e+88)
(* x y)
(if (<= (* x y) 7.2e-282)
(* z t)
(if (<= (* x y) 2.5e-93)
(* a b)
(if (<= (* x y) 1e+158) (* z t) (* x y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -4.7e+88) {
tmp = x * y;
} else if ((x * y) <= 7.2e-282) {
tmp = z * t;
} else if ((x * y) <= 2.5e-93) {
tmp = a * b;
} else if ((x * y) <= 1e+158) {
tmp = z * t;
} 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) <= (-4.7d+88)) then
tmp = x * y
else if ((x * y) <= 7.2d-282) then
tmp = z * t
else if ((x * y) <= 2.5d-93) then
tmp = a * b
else if ((x * y) <= 1d+158) then
tmp = z * t
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) <= -4.7e+88) {
tmp = x * y;
} else if ((x * y) <= 7.2e-282) {
tmp = z * t;
} else if ((x * y) <= 2.5e-93) {
tmp = a * b;
} else if ((x * y) <= 1e+158) {
tmp = z * t;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -4.7e+88: tmp = x * y elif (x * y) <= 7.2e-282: tmp = z * t elif (x * y) <= 2.5e-93: tmp = a * b elif (x * y) <= 1e+158: tmp = z * t else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -4.7e+88) tmp = Float64(x * y); elseif (Float64(x * y) <= 7.2e-282) tmp = Float64(z * t); elseif (Float64(x * y) <= 2.5e-93) tmp = Float64(a * b); elseif (Float64(x * y) <= 1e+158) tmp = Float64(z * t); 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) <= -4.7e+88) tmp = x * y; elseif ((x * y) <= 7.2e-282) tmp = z * t; elseif ((x * y) <= 2.5e-93) tmp = a * b; elseif ((x * y) <= 1e+158) tmp = z * t; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -4.7e+88], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 7.2e-282], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.5e-93], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+158], N[(z * t), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4.7 \cdot 10^{+88}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 7.2 \cdot 10^{-282}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 2.5 \cdot 10^{-93}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 10^{+158}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -4.70000000000000007e88 or 9.99999999999999953e157 < (*.f64 x y) Initial program 97.4%
Taylor expanded in x around inf 91.9%
Taylor expanded in x around inf 79.6%
if -4.70000000000000007e88 < (*.f64 x y) < 7.1999999999999995e-282 or 2.49999999999999997e-93 < (*.f64 x y) < 9.99999999999999953e157Initial program 98.0%
fma-define98.0%
Simplified98.0%
Taylor expanded in x around 0 86.3%
Taylor expanded in a around 0 58.2%
if 7.1999999999999995e-282 < (*.f64 x y) < 2.49999999999999997e-93Initial program 96.4%
fma-define96.4%
Simplified96.4%
Taylor expanded in a around inf 65.4%
Final simplification65.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* a b) (* z t))))
(if (<= (* a b) -5e+81)
t_1
(if (<= (* a b) 5e+14)
(+ (* x y) (* z t))
(if (<= (* a b) 1e+278) t_1 (* z (+ t (/ (* a b) z))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + (z * t);
double tmp;
if ((a * b) <= -5e+81) {
tmp = t_1;
} else if ((a * b) <= 5e+14) {
tmp = (x * y) + (z * t);
} else if ((a * b) <= 1e+278) {
tmp = t_1;
} else {
tmp = z * (t + ((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 = (a * b) + (z * t)
if ((a * b) <= (-5d+81)) then
tmp = t_1
else if ((a * b) <= 5d+14) then
tmp = (x * y) + (z * t)
else if ((a * b) <= 1d+278) then
tmp = t_1
else
tmp = z * (t + ((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 = (a * b) + (z * t);
double tmp;
if ((a * b) <= -5e+81) {
tmp = t_1;
} else if ((a * b) <= 5e+14) {
tmp = (x * y) + (z * t);
} else if ((a * b) <= 1e+278) {
tmp = t_1;
} else {
tmp = z * (t + ((a * b) / z));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a * b) + (z * t) tmp = 0 if (a * b) <= -5e+81: tmp = t_1 elif (a * b) <= 5e+14: tmp = (x * y) + (z * t) elif (a * b) <= 1e+278: tmp = t_1 else: tmp = z * (t + ((a * b) / z)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * b) + Float64(z * t)) tmp = 0.0 if (Float64(a * b) <= -5e+81) tmp = t_1; elseif (Float64(a * b) <= 5e+14) tmp = Float64(Float64(x * y) + Float64(z * t)); elseif (Float64(a * b) <= 1e+278) tmp = t_1; else tmp = Float64(z * Float64(t + Float64(Float64(a * b) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a * b) + (z * t); tmp = 0.0; if ((a * b) <= -5e+81) tmp = t_1; elseif ((a * b) <= 5e+14) tmp = (x * y) + (z * t); elseif ((a * b) <= 1e+278) tmp = t_1; else tmp = z * (t + ((a * b) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+81], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 5e+14], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+278], t$95$1, N[(z * N[(t + N[(N[(a * b), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+14}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 10^{+278}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t + \frac{a \cdot b}{z}\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -4.9999999999999998e81 or 5e14 < (*.f64 a b) < 9.99999999999999964e277Initial program 100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 90.1%
if -4.9999999999999998e81 < (*.f64 a b) < 5e14Initial program 99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in z around inf 89.9%
+-commutative89.9%
Simplified89.9%
Taylor expanded in a around 0 82.7%
Taylor expanded in z around 0 92.1%
if 9.99999999999999964e277 < (*.f64 a b) Initial program 73.6%
fma-define78.9%
Simplified78.9%
Taylor expanded in x around 0 78.9%
Taylor expanded in z around inf 100.0%
Final simplification92.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* a b) (* z t))))
(if (<= (* a b) -5e+81)
t_1
(if (<= (* a b) 5e+14)
(+ (* x y) (* z t))
(if (<= (* a b) 5e+299) t_1 (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * b) + (z * t);
double tmp;
if ((a * b) <= -5e+81) {
tmp = t_1;
} else if ((a * b) <= 5e+14) {
tmp = (x * y) + (z * t);
} else if ((a * b) <= 5e+299) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (a * b) + (z * t)
if ((a * b) <= (-5d+81)) then
tmp = t_1
else if ((a * b) <= 5d+14) then
tmp = (x * y) + (z * t)
else if ((a * b) <= 5d+299) then
tmp = t_1
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 t_1 = (a * b) + (z * t);
double tmp;
if ((a * b) <= -5e+81) {
tmp = t_1;
} else if ((a * b) <= 5e+14) {
tmp = (x * y) + (z * t);
} else if ((a * b) <= 5e+299) {
tmp = t_1;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a * b) + (z * t) tmp = 0 if (a * b) <= -5e+81: tmp = t_1 elif (a * b) <= 5e+14: tmp = (x * y) + (z * t) elif (a * b) <= 5e+299: tmp = t_1 else: tmp = a * b return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * b) + Float64(z * t)) tmp = 0.0 if (Float64(a * b) <= -5e+81) tmp = t_1; elseif (Float64(a * b) <= 5e+14) tmp = Float64(Float64(x * y) + Float64(z * t)); elseif (Float64(a * b) <= 5e+299) tmp = t_1; else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a * b) + (z * t); tmp = 0.0; if ((a * b) <= -5e+81) tmp = t_1; elseif ((a * b) <= 5e+14) tmp = (x * y) + (z * t); elseif ((a * b) <= 5e+299) tmp = t_1; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+81], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 5e+14], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+299], t$95$1, N[(a * b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+14}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+299}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -4.9999999999999998e81 or 5e14 < (*.f64 a b) < 5.0000000000000003e299Initial program 100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 90.5%
if -4.9999999999999998e81 < (*.f64 a b) < 5e14Initial program 99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in z around inf 89.9%
+-commutative89.9%
Simplified89.9%
Taylor expanded in a around 0 82.7%
Taylor expanded in z around 0 92.1%
if 5.0000000000000003e299 < (*.f64 a b) Initial program 68.8%
fma-define75.0%
Simplified75.0%
Taylor expanded in a around inf 100.0%
Final simplification92.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (* a b) (+ (* x y) (* z t))))) (if (<= t_1 INFINITY) t_1 (* b (+ a (* x (/ y b)))))))
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 = b * (a + (x * (y / b)));
}
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 = b * (a + (x * (y / b)));
}
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 = b * (a + (x * (y / b))) 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(b * Float64(a + Float64(x * Float64(y / b)))); 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 = b * (a + (x * (y / b))); 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[(b * N[(a + N[(x * N[(y / b), $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}:\\
\;\;\;\;b \cdot \left(a + x \cdot \frac{y}{b}\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 83.3%
Taylor expanded in b around inf 83.3%
associate-/l*100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* x y) -1.8e+90) (not (<= (* x y) 4.5e+178))) (* 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) <= -1.8e+90) || !((x * y) <= 4.5e+178)) {
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) <= (-1.8d+90)) .or. (.not. ((x * y) <= 4.5d+178))) 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) <= -1.8e+90) || !((x * y) <= 4.5e+178)) {
tmp = x * y;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((x * y) <= -1.8e+90) or not ((x * y) <= 4.5e+178): 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) <= -1.8e+90) || !(Float64(x * y) <= 4.5e+178)) 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) <= -1.8e+90) || ~(((x * y) <= 4.5e+178))) 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], -1.8e+90], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4.5e+178]], $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 -1.8 \cdot 10^{+90} \lor \neg \left(x \cdot y \leq 4.5 \cdot 10^{+178}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 x y) < -1.8e90 or 4.4999999999999997e178 < (*.f64 x y) Initial program 97.4%
Taylor expanded in x around inf 91.9%
Taylor expanded in x around inf 79.6%
if -1.8e90 < (*.f64 x y) < 4.4999999999999997e178Initial program 97.7%
fma-define97.8%
Simplified97.8%
Taylor expanded in x around 0 85.8%
Final simplification83.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (* a b) -6.3e+156) (not (<= (* a b) 8.5e+92))) (* a b) (* z t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a * b) <= -6.3e+156) || !((a * b) <= 8.5e+92)) {
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) <= (-6.3d+156)) .or. (.not. ((a * b) <= 8.5d+92))) 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) <= -6.3e+156) || !((a * b) <= 8.5e+92)) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a * b) <= -6.3e+156) or not ((a * b) <= 8.5e+92): tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a * b) <= -6.3e+156) || !(Float64(a * b) <= 8.5e+92)) 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) <= -6.3e+156) || ~(((a * b) <= 8.5e+92))) 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], -6.3e+156], N[Not[LessEqual[N[(a * b), $MachinePrecision], 8.5e+92]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -6.3 \cdot 10^{+156} \lor \neg \left(a \cdot b \leq 8.5 \cdot 10^{+92}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -6.29999999999999982e156 or 8.5000000000000001e92 < (*.f64 a b) Initial program 93.1%
fma-define94.5%
Simplified94.5%
Taylor expanded in a around inf 79.2%
if -6.29999999999999982e156 < (*.f64 a b) < 8.5000000000000001e92Initial program 99.4%
fma-define99.5%
Simplified99.5%
Taylor expanded in x around 0 60.1%
Taylor expanded in a around 0 48.4%
Final simplification57.2%
(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%
fma-define98.0%
Simplified98.0%
Taylor expanded in a around inf 32.5%
herbie shell --seed 2024165
(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)))