
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (+ (* a b) (+ (* x y) (* z t))) (* c i)))) (if (<= t_1 INFINITY) t_1 (+ (* c i) (* y (+ x (/ (* a b) y)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a * b) + ((x * y) + (z * t))) + (c * i);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (c * i) + (y * (x + ((a * b) / y)));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = ((a * b) + ((x * y) + (z * t))) + (c * i);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (c * i) + (y * (x + ((a * b) / y)));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = ((a * b) + ((x * y) + (z * t))) + (c * i) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (c * i) + (y * (x + ((a * b) / y))) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))) + Float64(c * i)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(c * i) + Float64(y * Float64(x + Float64(Float64(a * b) / y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = ((a * b) + ((x * y) + (z * t))) + (c * i); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (c * i) + (y * (x + ((a * b) / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(c * i), $MachinePrecision] + N[(y * N[(x + N[(N[(a * b), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right) + c \cdot i\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + y \cdot \left(x + \frac{a \cdot b}{y}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
Taylor expanded in t around inf 25.0%
associate-/l*25.0%
Simplified25.0%
Taylor expanded in t around 0 37.5%
Taylor expanded in y around inf 62.5%
Final simplification98.8%
(FPCore (x y z t a b c i) :precision binary64 (fma c i (fma x y (fma z t (* a b)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(c, i, fma(x, y, fma(z, t, (a * b))));
}
function code(x, y, z, t, a, b, c, i) return fma(c, i, fma(x, y, fma(z, t, Float64(a * b)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right)
\end{array}
Initial program 96.9%
+-commutative96.9%
fma-define96.9%
associate-+l+96.9%
fma-define97.3%
fma-define97.7%
Simplified97.7%
(FPCore (x y z t a b c i) :precision binary64 (fma c i (fma a b (fma x y (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(c, i, fma(a, b, fma(x, y, (z * t))));
}
function code(x, y, z, t, a, b, c, i) return fma(c, i, fma(a, b, fma(x, y, Float64(z * t)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(a * b + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)
\end{array}
Initial program 96.9%
+-commutative96.9%
fma-define96.9%
+-commutative96.9%
fma-define97.6%
fma-define97.6%
Simplified97.6%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -4e+123)
(+ (* x y) (* c i))
(if (<= (* x y) 2e-304)
(+ (* a b) (* c i))
(if (<= (* x y) 2e+144) (+ (* c i) (* z t)) (* y (+ x (/ (* a b) y)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -4e+123) {
tmp = (x * y) + (c * i);
} else if ((x * y) <= 2e-304) {
tmp = (a * b) + (c * i);
} else if ((x * y) <= 2e+144) {
tmp = (c * i) + (z * t);
} else {
tmp = y * (x + ((a * b) / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((x * y) <= (-4d+123)) then
tmp = (x * y) + (c * i)
else if ((x * y) <= 2d-304) then
tmp = (a * b) + (c * i)
else if ((x * y) <= 2d+144) then
tmp = (c * i) + (z * t)
else
tmp = y * (x + ((a * b) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -4e+123) {
tmp = (x * y) + (c * i);
} else if ((x * y) <= 2e-304) {
tmp = (a * b) + (c * i);
} else if ((x * y) <= 2e+144) {
tmp = (c * i) + (z * t);
} else {
tmp = y * (x + ((a * b) / y));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -4e+123: tmp = (x * y) + (c * i) elif (x * y) <= 2e-304: tmp = (a * b) + (c * i) elif (x * y) <= 2e+144: tmp = (c * i) + (z * t) else: tmp = y * (x + ((a * b) / y)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -4e+123) tmp = Float64(Float64(x * y) + Float64(c * i)); elseif (Float64(x * y) <= 2e-304) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(x * y) <= 2e+144) tmp = Float64(Float64(c * i) + Float64(z * t)); else tmp = Float64(y * Float64(x + Float64(Float64(a * b) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((x * y) <= -4e+123) tmp = (x * y) + (c * i); elseif ((x * y) <= 2e-304) tmp = (a * b) + (c * i); elseif ((x * y) <= 2e+144) tmp = (c * i) + (z * t); else tmp = y * (x + ((a * b) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -4e+123], N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-304], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+144], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(y * N[(x + N[(N[(a * b), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+123}:\\
\;\;\;\;x \cdot y + c \cdot i\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-304}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+144}:\\
\;\;\;\;c \cdot i + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + \frac{a \cdot b}{y}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999991e123Initial program 95.9%
Taylor expanded in x around inf 83.9%
if -3.99999999999999991e123 < (*.f64 x y) < 1.99999999999999994e-304Initial program 99.0%
Taylor expanded in a around inf 73.9%
if 1.99999999999999994e-304 < (*.f64 x y) < 2.00000000000000005e144Initial program 98.6%
Taylor expanded in z around inf 69.3%
if 2.00000000000000005e144 < (*.f64 x y) Initial program 87.8%
Taylor expanded in t around inf 82.3%
associate-/l*76.7%
Simplified76.7%
Taylor expanded in t around 0 89.7%
Taylor expanded in y around inf 92.8%
Taylor expanded in c around 0 91.2%
Final simplification76.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* c i))))
(if (<= (* x y) -4e+123)
t_1
(if (<= (* x y) 2e-304)
(+ (* a b) (* c i))
(if (<= (* x y) 4e+149) (+ (* c i) (* z t)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (c * i);
double tmp;
if ((x * y) <= -4e+123) {
tmp = t_1;
} else if ((x * y) <= 2e-304) {
tmp = (a * b) + (c * i);
} else if ((x * y) <= 4e+149) {
tmp = (c * i) + (z * t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) + (c * i)
if ((x * y) <= (-4d+123)) then
tmp = t_1
else if ((x * y) <= 2d-304) then
tmp = (a * b) + (c * i)
else if ((x * y) <= 4d+149) then
tmp = (c * i) + (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 c, double i) {
double t_1 = (x * y) + (c * i);
double tmp;
if ((x * y) <= -4e+123) {
tmp = t_1;
} else if ((x * y) <= 2e-304) {
tmp = (a * b) + (c * i);
} else if ((x * y) <= 4e+149) {
tmp = (c * i) + (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (c * i) tmp = 0 if (x * y) <= -4e+123: tmp = t_1 elif (x * y) <= 2e-304: tmp = (a * b) + (c * i) elif (x * y) <= 4e+149: tmp = (c * i) + (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(c * i)) tmp = 0.0 if (Float64(x * y) <= -4e+123) tmp = t_1; elseif (Float64(x * y) <= 2e-304) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(x * y) <= 4e+149) tmp = Float64(Float64(c * i) + Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (x * y) + (c * i); tmp = 0.0; if ((x * y) <= -4e+123) tmp = t_1; elseif ((x * y) <= 2e-304) tmp = (a * b) + (c * i); elseif ((x * y) <= 4e+149) tmp = (c * i) + (z * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -4e+123], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e-304], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e+149], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + c \cdot i\\
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+123}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-304}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+149}:\\
\;\;\;\;c \cdot i + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999991e123 or 4.0000000000000002e149 < (*.f64 x y) Initial program 92.6%
Taylor expanded in x around inf 82.7%
if -3.99999999999999991e123 < (*.f64 x y) < 1.99999999999999994e-304Initial program 99.0%
Taylor expanded in a around inf 73.9%
if 1.99999999999999994e-304 < (*.f64 x y) < 4.0000000000000002e149Initial program 98.6%
Taylor expanded in z around inf 68.5%
Final simplification75.1%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -4e+123)
(* x y)
(if (<= (* x y) 2e-304)
(+ (* a b) (* c i))
(if (<= (* x y) 4e+149) (+ (* c i) (* z t)) (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -4e+123) {
tmp = x * y;
} else if ((x * y) <= 2e-304) {
tmp = (a * b) + (c * i);
} else if ((x * y) <= 4e+149) {
tmp = (c * i) + (z * t);
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((x * y) <= (-4d+123)) then
tmp = x * y
else if ((x * y) <= 2d-304) then
tmp = (a * b) + (c * i)
else if ((x * y) <= 4d+149) then
tmp = (c * i) + (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 c, double i) {
double tmp;
if ((x * y) <= -4e+123) {
tmp = x * y;
} else if ((x * y) <= 2e-304) {
tmp = (a * b) + (c * i);
} else if ((x * y) <= 4e+149) {
tmp = (c * i) + (z * t);
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -4e+123: tmp = x * y elif (x * y) <= 2e-304: tmp = (a * b) + (c * i) elif (x * y) <= 4e+149: tmp = (c * i) + (z * t) else: tmp = x * y return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -4e+123) tmp = Float64(x * y); elseif (Float64(x * y) <= 2e-304) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(x * y) <= 4e+149) tmp = Float64(Float64(c * i) + Float64(z * t)); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((x * y) <= -4e+123) tmp = x * y; elseif ((x * y) <= 2e-304) tmp = (a * b) + (c * i); elseif ((x * y) <= 4e+149) tmp = (c * i) + (z * t); else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -4e+123], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-304], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e+149], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+123}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-304}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+149}:\\
\;\;\;\;c \cdot i + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999991e123 or 4.0000000000000002e149 < (*.f64 x y) Initial program 92.6%
Taylor expanded in x around inf 82.7%
Taylor expanded in i around inf 73.5%
Taylor expanded in i around 0 75.3%
if -3.99999999999999991e123 < (*.f64 x y) < 1.99999999999999994e-304Initial program 99.0%
Taylor expanded in a around inf 73.9%
if 1.99999999999999994e-304 < (*.f64 x y) < 4.0000000000000002e149Initial program 98.6%
Taylor expanded in z around inf 68.5%
Final simplification72.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -1e+105) (not (<= (* x y) 4e+136))) (+ (* c i) (* y (+ x (/ (* a b) y)))) (+ (* c i) (+ (* a b) (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -1e+105) || !((x * y) <= 4e+136)) {
tmp = (c * i) + (y * (x + ((a * b) / y)));
} else {
tmp = (c * i) + ((a * b) + (z * t));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((x * y) <= (-1d+105)) .or. (.not. ((x * y) <= 4d+136))) then
tmp = (c * i) + (y * (x + ((a * b) / y)))
else
tmp = (c * i) + ((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 c, double i) {
double tmp;
if (((x * y) <= -1e+105) || !((x * y) <= 4e+136)) {
tmp = (c * i) + (y * (x + ((a * b) / y)));
} else {
tmp = (c * i) + ((a * b) + (z * t));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -1e+105) or not ((x * y) <= 4e+136): tmp = (c * i) + (y * (x + ((a * b) / y))) else: tmp = (c * i) + ((a * b) + (z * t)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -1e+105) || !(Float64(x * y) <= 4e+136)) tmp = Float64(Float64(c * i) + Float64(y * Float64(x + Float64(Float64(a * b) / y)))); else tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((x * y) <= -1e+105) || ~(((x * y) <= 4e+136))) tmp = (c * i) + (y * (x + ((a * b) / y))); else tmp = (c * i) + ((a * b) + (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1e+105], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4e+136]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + N[(y * N[(x + N[(N[(a * b), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+105} \lor \neg \left(x \cdot y \leq 4 \cdot 10^{+136}\right):\\
\;\;\;\;c \cdot i + y \cdot \left(x + \frac{a \cdot b}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -9.9999999999999994e104 or 4.00000000000000023e136 < (*.f64 x y) Initial program 93.0%
Taylor expanded in t around inf 77.7%
associate-/l*72.1%
Simplified72.1%
Taylor expanded in t around 0 89.2%
Taylor expanded in y around inf 91.6%
if -9.9999999999999994e104 < (*.f64 x y) < 4.00000000000000023e136Initial program 98.8%
Taylor expanded in x around 0 93.8%
Final simplification93.1%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -4e+123)
(+ (* c i) (+ (* x y) (* z t)))
(if (<= (* x y) 2e+144)
(+ (* c i) (+ (* a b) (* z t)))
(* y (+ x (/ (* a b) y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -4e+123) {
tmp = (c * i) + ((x * y) + (z * t));
} else if ((x * y) <= 2e+144) {
tmp = (c * i) + ((a * b) + (z * t));
} else {
tmp = y * (x + ((a * b) / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((x * y) <= (-4d+123)) then
tmp = (c * i) + ((x * y) + (z * t))
else if ((x * y) <= 2d+144) then
tmp = (c * i) + ((a * b) + (z * t))
else
tmp = y * (x + ((a * b) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -4e+123) {
tmp = (c * i) + ((x * y) + (z * t));
} else if ((x * y) <= 2e+144) {
tmp = (c * i) + ((a * b) + (z * t));
} else {
tmp = y * (x + ((a * b) / y));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -4e+123: tmp = (c * i) + ((x * y) + (z * t)) elif (x * y) <= 2e+144: tmp = (c * i) + ((a * b) + (z * t)) else: tmp = y * (x + ((a * b) / y)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -4e+123) tmp = Float64(Float64(c * i) + Float64(Float64(x * y) + Float64(z * t))); elseif (Float64(x * y) <= 2e+144) tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(z * t))); else tmp = Float64(y * Float64(x + Float64(Float64(a * b) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((x * y) <= -4e+123) tmp = (c * i) + ((x * y) + (z * t)); elseif ((x * y) <= 2e+144) tmp = (c * i) + ((a * b) + (z * t)); else tmp = y * (x + ((a * b) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -4e+123], N[(N[(c * i), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+144], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x + N[(N[(a * b), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+123}:\\
\;\;\;\;c \cdot i + \left(x \cdot y + z \cdot t\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+144}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + \frac{a \cdot b}{y}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999991e123Initial program 95.9%
Taylor expanded in a around 0 91.5%
if -3.99999999999999991e123 < (*.f64 x y) < 2.00000000000000005e144Initial program 98.8%
Taylor expanded in x around 0 93.4%
if 2.00000000000000005e144 < (*.f64 x y) Initial program 87.8%
Taylor expanded in t around inf 82.3%
associate-/l*76.7%
Simplified76.7%
Taylor expanded in t around 0 89.7%
Taylor expanded in y around inf 92.8%
Taylor expanded in c around 0 91.2%
Final simplification92.8%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -1e+105)
(+ (* c i) (+ (* a b) (* x y)))
(if (<= (* x y) 2e+144)
(+ (* c i) (+ (* a b) (* z t)))
(* y (+ x (/ (* a b) y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -1e+105) {
tmp = (c * i) + ((a * b) + (x * y));
} else if ((x * y) <= 2e+144) {
tmp = (c * i) + ((a * b) + (z * t));
} else {
tmp = y * (x + ((a * b) / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((x * y) <= (-1d+105)) then
tmp = (c * i) + ((a * b) + (x * y))
else if ((x * y) <= 2d+144) then
tmp = (c * i) + ((a * b) + (z * t))
else
tmp = y * (x + ((a * b) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -1e+105) {
tmp = (c * i) + ((a * b) + (x * y));
} else if ((x * y) <= 2e+144) {
tmp = (c * i) + ((a * b) + (z * t));
} else {
tmp = y * (x + ((a * b) / y));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -1e+105: tmp = (c * i) + ((a * b) + (x * y)) elif (x * y) <= 2e+144: tmp = (c * i) + ((a * b) + (z * t)) else: tmp = y * (x + ((a * b) / y)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -1e+105) tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(x * y))); elseif (Float64(x * y) <= 2e+144) tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(z * t))); else tmp = Float64(y * Float64(x + Float64(Float64(a * b) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((x * y) <= -1e+105) tmp = (c * i) + ((a * b) + (x * y)); elseif ((x * y) <= 2e+144) tmp = (c * i) + ((a * b) + (z * t)); else tmp = y * (x + ((a * b) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+105], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+144], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x + N[(N[(a * b), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+105}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+144}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + \frac{a \cdot b}{y}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -9.9999999999999994e104Initial program 96.1%
Taylor expanded in z around 0 88.7%
if -9.9999999999999994e104 < (*.f64 x y) < 2.00000000000000005e144Initial program 98.8%
Taylor expanded in x around 0 93.9%
if 2.00000000000000005e144 < (*.f64 x y) Initial program 87.8%
Taylor expanded in t around inf 82.3%
associate-/l*76.7%
Simplified76.7%
Taylor expanded in t around 0 89.7%
Taylor expanded in y around inf 92.8%
Taylor expanded in c around 0 91.2%
Final simplification92.5%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -4e+123)
(+ (* x y) (* c i))
(if (<= (* x y) 2e+144)
(+ (* c i) (+ (* a b) (* z t)))
(* y (+ x (/ (* a b) y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -4e+123) {
tmp = (x * y) + (c * i);
} else if ((x * y) <= 2e+144) {
tmp = (c * i) + ((a * b) + (z * t));
} else {
tmp = y * (x + ((a * b) / y));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((x * y) <= (-4d+123)) then
tmp = (x * y) + (c * i)
else if ((x * y) <= 2d+144) then
tmp = (c * i) + ((a * b) + (z * t))
else
tmp = y * (x + ((a * b) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -4e+123) {
tmp = (x * y) + (c * i);
} else if ((x * y) <= 2e+144) {
tmp = (c * i) + ((a * b) + (z * t));
} else {
tmp = y * (x + ((a * b) / y));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -4e+123: tmp = (x * y) + (c * i) elif (x * y) <= 2e+144: tmp = (c * i) + ((a * b) + (z * t)) else: tmp = y * (x + ((a * b) / y)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -4e+123) tmp = Float64(Float64(x * y) + Float64(c * i)); elseif (Float64(x * y) <= 2e+144) tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(z * t))); else tmp = Float64(y * Float64(x + Float64(Float64(a * b) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((x * y) <= -4e+123) tmp = (x * y) + (c * i); elseif ((x * y) <= 2e+144) tmp = (c * i) + ((a * b) + (z * t)); else tmp = y * (x + ((a * b) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -4e+123], N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+144], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x + N[(N[(a * b), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+123}:\\
\;\;\;\;x \cdot y + c \cdot i\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+144}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + \frac{a \cdot b}{y}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999991e123Initial program 95.9%
Taylor expanded in x around inf 83.9%
if -3.99999999999999991e123 < (*.f64 x y) < 2.00000000000000005e144Initial program 98.8%
Taylor expanded in x around 0 93.4%
if 2.00000000000000005e144 < (*.f64 x y) Initial program 87.8%
Taylor expanded in t around inf 82.3%
associate-/l*76.7%
Simplified76.7%
Taylor expanded in t around 0 89.7%
Taylor expanded in y around inf 92.8%
Taylor expanded in c around 0 91.2%
Final simplification91.3%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -4e+123) (not (<= (* x y) 4e+149))) (* x y) (+ (* a b) (* c i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -4e+123) || !((x * y) <= 4e+149)) {
tmp = x * y;
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((x * y) <= (-4d+123)) .or. (.not. ((x * y) <= 4d+149))) then
tmp = x * y
else
tmp = (a * b) + (c * i)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -4e+123) || !((x * y) <= 4e+149)) {
tmp = x * y;
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -4e+123) or not ((x * y) <= 4e+149): tmp = x * y else: tmp = (a * b) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -4e+123) || !(Float64(x * y) <= 4e+149)) tmp = Float64(x * y); else tmp = Float64(Float64(a * b) + Float64(c * i)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((x * y) <= -4e+123) || ~(((x * y) <= 4e+149))) tmp = x * y; else tmp = (a * b) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -4e+123], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4e+149]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+123} \lor \neg \left(x \cdot y \leq 4 \cdot 10^{+149}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999991e123 or 4.0000000000000002e149 < (*.f64 x y) Initial program 92.6%
Taylor expanded in x around inf 82.7%
Taylor expanded in i around inf 73.5%
Taylor expanded in i around 0 75.3%
if -3.99999999999999991e123 < (*.f64 x y) < 4.0000000000000002e149Initial program 98.8%
Taylor expanded in a around inf 67.6%
Final simplification70.1%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -2e+110) (not (<= (* x y) 4e+149))) (* x y) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -2e+110) || !((x * y) <= 4e+149)) {
tmp = x * y;
} else {
tmp = c * i;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((x * y) <= (-2d+110)) .or. (.not. ((x * y) <= 4d+149))) then
tmp = x * y
else
tmp = c * i
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -2e+110) || !((x * y) <= 4e+149)) {
tmp = x * y;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -2e+110) or not ((x * y) <= 4e+149): tmp = x * y else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -2e+110) || !(Float64(x * y) <= 4e+149)) tmp = Float64(x * y); else tmp = Float64(c * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((x * y) <= -2e+110) || ~(((x * y) <= 4e+149))) tmp = x * y; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -2e+110], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4e+149]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(c * i), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+110} \lor \neg \left(x \cdot y \leq 4 \cdot 10^{+149}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 x y) < -2e110 or 4.0000000000000002e149 < (*.f64 x y) Initial program 92.6%
Taylor expanded in x around inf 81.7%
Taylor expanded in i around inf 72.7%
Taylor expanded in i around 0 74.5%
if -2e110 < (*.f64 x y) < 4.0000000000000002e149Initial program 98.8%
Taylor expanded in c around inf 37.0%
Final simplification49.0%
(FPCore (x y z t a b c i) :precision binary64 (* c i))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return c * i;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = c * i
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return c * i;
}
def code(x, y, z, t, a, b, c, i): return c * i
function code(x, y, z, t, a, b, c, i) return Float64(c * i) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = c * i; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i), $MachinePrecision]
\begin{array}{l}
\\
c \cdot i
\end{array}
Initial program 96.9%
Taylor expanded in c around inf 28.9%
herbie shell --seed 2024087
(FPCore (x y z t a b c i)
:name "Linear.V4:$cdot from linear-1.19.1.3, C"
:precision binary64
(+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))