
(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 12 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 (fma i c (fma b a (fma t z (* y x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(i, c, fma(b, a, fma(t, z, (y * x))));
}
function code(x, y, z, t, a, b, c, i) return fma(i, c, fma(b, a, fma(t, z, Float64(y * x)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(i * c + N[(b * a + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(i, c, \mathsf{fma}\left(b, a, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\right)
\end{array}
Initial program 95.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6496.5
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.6
Applied rewrites97.6%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -5e+170) (not (<= (* a b) 5e+146))) (fma b a (fma y x (* c i))) (fma i c (fma t z (* y x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) <= -5e+170) || !((a * b) <= 5e+146)) {
tmp = fma(b, a, fma(y, x, (c * i)));
} else {
tmp = fma(i, c, fma(t, z, (y * x)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -5e+170) || !(Float64(a * b) <= 5e+146)) tmp = fma(b, a, fma(y, x, Float64(c * i))); else tmp = fma(i, c, fma(t, z, Float64(y * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -5e+170], N[Not[LessEqual[N[(a * b), $MachinePrecision], 5e+146]], $MachinePrecision]], N[(b * a + N[(y * x + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(i * c + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+170} \lor \neg \left(a \cdot b \leq 5 \cdot 10^{+146}\right):\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -4.99999999999999977e170 or 4.9999999999999999e146 < (*.f64 a b) Initial program 89.2%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.9
Applied rewrites90.9%
Applied rewrites92.4%
if -4.99999999999999977e170 < (*.f64 a b) < 4.9999999999999999e146Initial program 97.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6493.8
Applied rewrites93.8%
Final simplification93.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -2e+124) (not (<= (* x y) 1e+37))) (fma b a (fma y x (* c i))) (fma b a (fma i c (* t z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -2e+124) || !((x * y) <= 1e+37)) {
tmp = fma(b, a, fma(y, x, (c * i)));
} else {
tmp = fma(b, a, fma(i, c, (t * z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -2e+124) || !(Float64(x * y) <= 1e+37)) tmp = fma(b, a, fma(y, x, Float64(c * i))); else tmp = fma(b, a, fma(i, c, Float64(t * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -2e+124], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e+37]], $MachinePrecision]], N[(b * a + N[(y * x + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+124} \lor \neg \left(x \cdot y \leq 10^{+37}\right):\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.9999999999999999e124 or 9.99999999999999954e36 < (*.f64 x y) Initial program 91.6%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6486.4
Applied rewrites86.4%
Applied rewrites86.5%
if -1.9999999999999999e124 < (*.f64 x y) < 9.99999999999999954e36Initial program 98.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6494.2
Applied rewrites94.2%
Final simplification91.0%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -2e+124) (not (<= (* x y) 1e+37))) (fma b a (fma i c (* y x))) (fma b a (fma i c (* t z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -2e+124) || !((x * y) <= 1e+37)) {
tmp = fma(b, a, fma(i, c, (y * x)));
} else {
tmp = fma(b, a, fma(i, c, (t * z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -2e+124) || !(Float64(x * y) <= 1e+37)) tmp = fma(b, a, fma(i, c, Float64(y * x))); else tmp = fma(b, a, fma(i, c, Float64(t * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -2e+124], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e+37]], $MachinePrecision]], N[(b * a + N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+124} \lor \neg \left(x \cdot y \leq 10^{+37}\right):\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.9999999999999999e124 or 9.99999999999999954e36 < (*.f64 x y) Initial program 91.6%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6486.4
Applied rewrites86.4%
if -1.9999999999999999e124 < (*.f64 x y) < 9.99999999999999954e36Initial program 98.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6494.2
Applied rewrites94.2%
Final simplification91.0%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -1e+236) (not (<= (* x y) 2e+181))) (* y x) (fma b a (fma i c (* t z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -1e+236) || !((x * y) <= 2e+181)) {
tmp = y * x;
} else {
tmp = fma(b, a, fma(i, c, (t * z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -1e+236) || !(Float64(x * y) <= 2e+181)) tmp = Float64(y * x); else tmp = fma(b, a, fma(i, c, Float64(t * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1e+236], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+181]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+236} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+181}\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000005e236 or 1.9999999999999998e181 < (*.f64 x y) Initial program 85.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6488.0
Applied rewrites88.0%
Applied rewrites88.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6480.3
Applied rewrites80.3%
if -1.00000000000000005e236 < (*.f64 x y) < 1.9999999999999998e181Initial program 98.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6486.8
Applied rewrites86.8%
Final simplification85.2%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -5e+170)
(fma b a (fma y x (* c i)))
(if (<= (* a b) 5e+102)
(fma i c (fma t z (* y x)))
(fma i c (fma z t (* a b))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -5e+170) {
tmp = fma(b, a, fma(y, x, (c * i)));
} else if ((a * b) <= 5e+102) {
tmp = fma(i, c, fma(t, z, (y * x)));
} else {
tmp = fma(i, c, fma(z, t, (a * b)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -5e+170) tmp = fma(b, a, fma(y, x, Float64(c * i))); elseif (Float64(a * b) <= 5e+102) tmp = fma(i, c, fma(t, z, Float64(y * x))); else tmp = fma(i, c, fma(z, t, Float64(a * b))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -5e+170], N[(b * a + N[(y * x + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+102], N[(i * c + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(i * c + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+170}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, c \cdot i\right)\right)\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -4.99999999999999977e170Initial program 89.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6493.2
Applied rewrites93.2%
Applied rewrites96.7%
if -4.99999999999999977e170 < (*.f64 a b) < 5e102Initial program 97.3%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6493.6
Applied rewrites93.6%
if 5e102 < (*.f64 a b) Initial program 90.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6493.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6493.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6493.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.0
Applied rewrites93.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6493.2
Applied rewrites93.2%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -2e+124) (not (<= (* x y) 1e+179))) (* y x) (fma i c (* 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) <= -2e+124) || !((x * y) <= 1e+179)) {
tmp = y * x;
} else {
tmp = fma(i, c, (z * t));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -2e+124) || !(Float64(x * y) <= 1e+179)) tmp = Float64(y * x); else tmp = fma(i, c, Float64(z * t)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -2e+124], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e+179]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(i * c + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+124} \lor \neg \left(x \cdot y \leq 10^{+179}\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.9999999999999999e124 or 9.9999999999999998e178 < (*.f64 x y) Initial program 89.5%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6487.6
Applied rewrites87.6%
Applied rewrites87.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6469.5
Applied rewrites69.5%
if -1.9999999999999999e124 < (*.f64 x y) < 9.9999999999999998e178Initial program 98.2%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6476.5
Applied rewrites76.5%
Taylor expanded in x around 0
Applied rewrites67.8%
Final simplification68.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -1e+236) (not (<= (* x y) 2e+51))) (* y x) (fma b a (* 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) <= -1e+236) || !((x * y) <= 2e+51)) {
tmp = y * x;
} else {
tmp = fma(b, a, (c * i));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -1e+236) || !(Float64(x * y) <= 2e+51)) tmp = Float64(y * x); else tmp = fma(b, a, Float64(c * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1e+236], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+51]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(b * a + N[(c * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+236} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+51}\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, c \cdot i\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000005e236 or 2e51 < (*.f64 x y) Initial program 89.1%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6486.1
Applied rewrites86.1%
Applied rewrites86.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6471.9
Applied rewrites71.9%
if -1.00000000000000005e236 < (*.f64 x y) < 2e51Initial program 98.2%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6473.6
Applied rewrites73.6%
Taylor expanded in x around 0
Applied rewrites64.0%
Final simplification66.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -2e+124) (not (<= (* x y) 2e+51))) (* y x) (* i c)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -2e+124) || !((x * y) <= 2e+51)) {
tmp = y * x;
} else {
tmp = i * c;
}
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+124)) .or. (.not. ((x * y) <= 2d+51))) then
tmp = y * x
else
tmp = i * c
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+124) || !((x * y) <= 2e+51)) {
tmp = y * x;
} else {
tmp = i * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -2e+124) or not ((x * y) <= 2e+51): tmp = y * x else: tmp = i * c return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -2e+124) || !(Float64(x * y) <= 2e+51)) tmp = Float64(y * x); else tmp = Float64(i * c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((x * y) <= -2e+124) || ~(((x * y) <= 2e+51))) tmp = y * x; else tmp = i * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -2e+124], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+51]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(i * c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+124} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+51}\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;i \cdot c\\
\end{array}
\end{array}
if (*.f64 x y) < -1.9999999999999999e124 or 2e51 < (*.f64 x y) Initial program 91.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6486.1
Applied rewrites86.1%
Applied rewrites86.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6465.3
Applied rewrites65.3%
if -1.9999999999999999e124 < (*.f64 x y) < 2e51Initial program 98.0%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6443.2
Applied rewrites43.2%
Final simplification52.2%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* z t) -2e+116) (not (<= (* z t) 5e+215))) (* t z) (* i c)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((z * t) <= -2e+116) || !((z * t) <= 5e+215)) {
tmp = t * z;
} else {
tmp = i * c;
}
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 (((z * t) <= (-2d+116)) .or. (.not. ((z * t) <= 5d+215))) then
tmp = t * z
else
tmp = i * c
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 (((z * t) <= -2e+116) || !((z * t) <= 5e+215)) {
tmp = t * z;
} else {
tmp = i * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((z * t) <= -2e+116) or not ((z * t) <= 5e+215): tmp = t * z else: tmp = i * c return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(z * t) <= -2e+116) || !(Float64(z * t) <= 5e+215)) tmp = Float64(t * z); else tmp = Float64(i * c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((z * t) <= -2e+116) || ~(((z * t) <= 5e+215))) tmp = t * z; else tmp = i * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -2e+116], N[Not[LessEqual[N[(z * t), $MachinePrecision], 5e+215]], $MachinePrecision]], N[(t * z), $MachinePrecision], N[(i * c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+116} \lor \neg \left(z \cdot t \leq 5 \cdot 10^{+215}\right):\\
\;\;\;\;t \cdot z\\
\mathbf{else}:\\
\;\;\;\;i \cdot c\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000003e116 or 5.0000000000000001e215 < (*.f64 z t) Initial program 88.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6433.6
Applied rewrites33.6%
Applied rewrites32.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6418.0
Applied rewrites18.0%
Taylor expanded in z around inf
lower-*.f6470.2
Applied rewrites70.2%
if -2.00000000000000003e116 < (*.f64 z t) < 5.0000000000000001e215Initial program 97.4%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6438.5
Applied rewrites38.5%
Final simplification46.3%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -3.8e+192) (not (<= (* a b) 8.2e+146))) (* a b) (* i c)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) <= -3.8e+192) || !((a * b) <= 8.2e+146)) {
tmp = a * b;
} else {
tmp = i * c;
}
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 (((a * b) <= (-3.8d+192)) .or. (.not. ((a * b) <= 8.2d+146))) then
tmp = a * b
else
tmp = i * c
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 (((a * b) <= -3.8e+192) || !((a * b) <= 8.2e+146)) {
tmp = a * b;
} else {
tmp = i * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((a * b) <= -3.8e+192) or not ((a * b) <= 8.2e+146): tmp = a * b else: tmp = i * c return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -3.8e+192) || !(Float64(a * b) <= 8.2e+146)) tmp = Float64(a * b); else tmp = Float64(i * c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((a * b) <= -3.8e+192) || ~(((a * b) <= 8.2e+146))) tmp = a * b; else tmp = i * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -3.8e+192], N[Not[LessEqual[N[(a * b), $MachinePrecision], 8.2e+146]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(i * c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -3.8 \cdot 10^{+192} \lor \neg \left(a \cdot b \leq 8.2 \cdot 10^{+146}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;i \cdot c\\
\end{array}
\end{array}
if (*.f64 a b) < -3.7999999999999999e192 or 8.2000000000000007e146 < (*.f64 a b) Initial program 88.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6490.3
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6493.5
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6493.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.5
Applied rewrites93.5%
Taylor expanded in a around inf
lower-*.f6471.5
Applied rewrites71.5%
if -3.7999999999999999e192 < (*.f64 a b) < 8.2000000000000007e146Initial program 97.4%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6435.8
Applied rewrites35.8%
Final simplification44.5%
(FPCore (x y z t a b c i) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
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 = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
def code(x, y, z, t, a, b, c, i): return a * b
function code(x, y, z, t, a, b, c, i) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b
\end{array}
Initial program 95.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6496.5
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.6
Applied rewrites97.6%
Taylor expanded in a around inf
lower-*.f6421.9
Applied rewrites21.9%
Final simplification21.9%
herbie shell --seed 2024339
(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)))