
(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 8 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 (let* ((t_1 (+ (* a b) (+ (* x y) (* z t))))) (if (<= t_1 INFINITY) 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) + ((x * y) + (z * t));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = z * (t + ((a * b) / z));
}
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 = z * (t + ((a * b) / z));
}
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 = z * (t + ((a * b) / z)) 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(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) + ((x * y) + (z * t)); tmp = 0.0; if (t_1 <= Inf) 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[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], 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 + \left(x \cdot y + z \cdot t\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t + \frac{a \cdot b}{z}\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 z around inf
associate-+r+N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6422.2%
Simplified22.2%
Taylor expanded in x around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6466.7%
Simplified66.7%
Final simplification98.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x y) -3.5e+106)
(* x y)
(if (<= (* x y) -8e-61)
(* z t)
(if (<= (* x y) 1.08e+55) (* a b) (* x y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -3.5e+106) {
tmp = x * y;
} else if ((x * y) <= -8e-61) {
tmp = z * t;
} else if ((x * y) <= 1.08e+55) {
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) <= (-3.5d+106)) then
tmp = x * y
else if ((x * y) <= (-8d-61)) then
tmp = z * t
else if ((x * y) <= 1.08d+55) 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) <= -3.5e+106) {
tmp = x * y;
} else if ((x * y) <= -8e-61) {
tmp = z * t;
} else if ((x * y) <= 1.08e+55) {
tmp = a * b;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -3.5e+106: tmp = x * y elif (x * y) <= -8e-61: tmp = z * t elif (x * y) <= 1.08e+55: tmp = a * b else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -3.5e+106) tmp = Float64(x * y); elseif (Float64(x * y) <= -8e-61) tmp = Float64(z * t); elseif (Float64(x * y) <= 1.08e+55) 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) <= -3.5e+106) tmp = x * y; elseif ((x * y) <= -8e-61) tmp = z * t; elseif ((x * y) <= 1.08e+55) 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], -3.5e+106], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -8e-61], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.08e+55], N[(a * b), $MachinePrecision], N[(x * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.5 \cdot 10^{+106}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq -8 \cdot 10^{-61}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 1.08 \cdot 10^{+55}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -3.49999999999999981e106 or 1.08000000000000004e55 < (*.f64 x y) Initial program 94.7%
Taylor expanded in x around inf
*-lowering-*.f6470.6%
Simplified70.6%
if -3.49999999999999981e106 < (*.f64 x y) < -8.0000000000000003e-61Initial program 97.0%
Taylor expanded in z around inf
*-lowering-*.f6452.4%
Simplified52.4%
if -8.0000000000000003e-61 < (*.f64 x y) < 1.08000000000000004e55Initial program 98.1%
Taylor expanded in a around inf
*-lowering-*.f6453.0%
Simplified53.0%
Final simplification60.7%
(FPCore (x y z t a b) :precision binary64 (if (<= (* x y) -5e+106) (* y (+ x (/ (* z t) y))) (if (<= (* x y) 2e+55) (+ (* a b) (* z t)) (+ (* x y) (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -5e+106) {
tmp = y * (x + ((z * t) / y));
} else if ((x * y) <= 2e+55) {
tmp = (a * b) + (z * t);
} else {
tmp = (x * y) + (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 ((x * y) <= (-5d+106)) then
tmp = y * (x + ((z * t) / y))
else if ((x * y) <= 2d+55) then
tmp = (a * b) + (z * t)
else
tmp = (x * y) + (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 ((x * y) <= -5e+106) {
tmp = y * (x + ((z * t) / y));
} else if ((x * y) <= 2e+55) {
tmp = (a * b) + (z * t);
} else {
tmp = (x * y) + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -5e+106: tmp = y * (x + ((z * t) / y)) elif (x * y) <= 2e+55: tmp = (a * b) + (z * t) else: tmp = (x * y) + (a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -5e+106) tmp = Float64(y * Float64(x + Float64(Float64(z * t) / y))); elseif (Float64(x * y) <= 2e+55) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(Float64(x * y) + Float64(a * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x * y) <= -5e+106) tmp = y * (x + ((z * t) / y)); elseif ((x * y) <= 2e+55) tmp = (a * b) + (z * t); else tmp = (x * y) + (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e+106], N[(y * N[(x + N[(N[(z * t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+55], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+106}:\\
\;\;\;\;y \cdot \left(x + \frac{z \cdot t}{y}\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+55}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\end{array}
\end{array}
if (*.f64 x y) < -4.9999999999999998e106Initial program 94.3%
Taylor expanded in a around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6487.2%
Simplified87.2%
Taylor expanded in y around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6489.1%
Simplified89.1%
if -4.9999999999999998e106 < (*.f64 x y) < 2.00000000000000002e55Initial program 97.9%
Taylor expanded in x around 0
*-lowering-*.f6489.6%
Simplified89.6%
if 2.00000000000000002e55 < (*.f64 x y) Initial program 95.0%
Taylor expanded in x around inf
*-lowering-*.f6483.8%
Simplified83.8%
Final simplification88.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* x y) (* a b))))
(if (<= (* x y) -1.5e+49)
t_1
(if (<= (* x y) 1.7e+59) (+ (* a b) (* z t)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * y) + (a * b);
double tmp;
if ((x * y) <= -1.5e+49) {
tmp = t_1;
} else if ((x * y) <= 1.7e+59) {
tmp = (a * b) + (z * t);
} else {
tmp = t_1;
}
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) + (a * b)
if ((x * y) <= (-1.5d+49)) then
tmp = t_1
else if ((x * y) <= 1.7d+59) then
tmp = (a * b) + (z * t)
else
tmp = t_1
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) + (a * b);
double tmp;
if ((x * y) <= -1.5e+49) {
tmp = t_1;
} else if ((x * y) <= 1.7e+59) {
tmp = (a * b) + (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x * y) + (a * b) tmp = 0 if (x * y) <= -1.5e+49: tmp = t_1 elif (x * y) <= 1.7e+59: tmp = (a * b) + (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * y) + Float64(a * b)) tmp = 0.0 if (Float64(x * y) <= -1.5e+49) tmp = t_1; elseif (Float64(x * y) <= 1.7e+59) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x * y) + (a * b); tmp = 0.0; if ((x * y) <= -1.5e+49) tmp = t_1; elseif ((x * y) <= 1.7e+59) tmp = (a * b) + (z * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1.5e+49], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.7e+59], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + a \cdot b\\
\mathbf{if}\;x \cdot y \leq -1.5 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 1.7 \cdot 10^{+59}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -1.5000000000000001e49 or 1.70000000000000003e59 < (*.f64 x y) Initial program 94.3%
Taylor expanded in x around inf
*-lowering-*.f6484.2%
Simplified84.2%
if -1.5000000000000001e49 < (*.f64 x y) < 1.70000000000000003e59Initial program 98.5%
Taylor expanded in x around 0
*-lowering-*.f6491.7%
Simplified91.7%
Final simplification88.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))))
(if (<= (* x y) -1.22e+106)
t_1
(if (<= (* x y) 38.0) (+ (* a b) (* z t)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * y) + (z * t);
double tmp;
if ((x * y) <= -1.22e+106) {
tmp = t_1;
} else if ((x * y) <= 38.0) {
tmp = (a * b) + (z * t);
} else {
tmp = t_1;
}
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 ((x * y) <= (-1.22d+106)) then
tmp = t_1
else if ((x * y) <= 38.0d0) then
tmp = (a * b) + (z * t)
else
tmp = t_1
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 ((x * y) <= -1.22e+106) {
tmp = t_1;
} else if ((x * y) <= 38.0) {
tmp = (a * b) + (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x * y) + (z * t) tmp = 0 if (x * y) <= -1.22e+106: tmp = t_1 elif (x * y) <= 38.0: tmp = (a * b) + (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (Float64(x * y) <= -1.22e+106) tmp = t_1; elseif (Float64(x * y) <= 38.0) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x * y) + (z * t); tmp = 0.0; if ((x * y) <= -1.22e+106) tmp = t_1; elseif ((x * y) <= 38.0) tmp = (a * b) + (z * t); else tmp = t_1; 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[N[(x * y), $MachinePrecision], -1.22e+106], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 38.0], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;x \cdot y \leq -1.22 \cdot 10^{+106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 38:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -1.2199999999999999e106 or 38 < (*.f64 x y) Initial program 95.0%
Taylor expanded in a around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6482.6%
Simplified82.6%
if -1.2199999999999999e106 < (*.f64 x y) < 38Initial program 97.8%
Taylor expanded in x around 0
*-lowering-*.f6490.4%
Simplified90.4%
Final simplification86.7%
(FPCore (x y z t a b) :precision binary64 (if (<= (* x y) -3.9e+133) (* x y) (if (<= (* x y) 7.6e+70) (+ (* a b) (* z t)) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * y) <= -3.9e+133) {
tmp = x * y;
} else if ((x * y) <= 7.6e+70) {
tmp = (a * b) + (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) <= (-3.9d+133)) then
tmp = x * y
else if ((x * y) <= 7.6d+70) then
tmp = (a * b) + (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) <= -3.9e+133) {
tmp = x * y;
} else if ((x * y) <= 7.6e+70) {
tmp = (a * b) + (z * t);
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x * y) <= -3.9e+133: tmp = x * y elif (x * y) <= 7.6e+70: tmp = (a * b) + (z * t) else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * y) <= -3.9e+133) tmp = Float64(x * y); elseif (Float64(x * y) <= 7.6e+70) tmp = Float64(Float64(a * b) + 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) <= -3.9e+133) tmp = x * y; elseif ((x * y) <= 7.6e+70) tmp = (a * b) + (z * t); else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * y), $MachinePrecision], -3.9e+133], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 7.6e+70], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.9 \cdot 10^{+133}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 7.6 \cdot 10^{+70}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -3.90000000000000014e133 or 7.5999999999999996e70 < (*.f64 x y) Initial program 94.4%
Taylor expanded in x around inf
*-lowering-*.f6472.3%
Simplified72.3%
if -3.90000000000000014e133 < (*.f64 x y) < 7.5999999999999996e70Initial program 98.0%
Taylor expanded in x around 0
*-lowering-*.f6488.1%
Simplified88.1%
Final simplification81.5%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -6.5e+53) (* a b) (if (<= (* a b) 7.5e+171) (* z t) (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -6.5e+53) {
tmp = a * b;
} else if ((a * b) <= 7.5e+171) {
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) <= (-6.5d+53)) then
tmp = a * b
else if ((a * b) <= 7.5d+171) 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) <= -6.5e+53) {
tmp = a * b;
} else if ((a * b) <= 7.5e+171) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -6.5e+53: tmp = a * b elif (a * b) <= 7.5e+171: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -6.5e+53) tmp = Float64(a * b); elseif (Float64(a * b) <= 7.5e+171) 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) <= -6.5e+53) tmp = a * b; elseif ((a * b) <= 7.5e+171) 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], -6.5e+53], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 7.5e+171], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -6.5 \cdot 10^{+53}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 7.5 \cdot 10^{+171}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -6.50000000000000017e53 or 7.4999999999999998e171 < (*.f64 a b) Initial program 91.5%
Taylor expanded in a around inf
*-lowering-*.f6475.4%
Simplified75.4%
if -6.50000000000000017e53 < (*.f64 a b) < 7.4999999999999998e171Initial program 99.4%
Taylor expanded in z around inf
*-lowering-*.f6443.7%
Simplified43.7%
Final simplification55.4%
(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 96.5%
Taylor expanded in a around inf
*-lowering-*.f6436.6%
Simplified36.6%
herbie shell --seed 2024161
(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)))