
(FPCore (x y z t a b c i) :precision binary64 :pre TRUE (+ (+ (+ (* 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)
use fmin_fmax_functions
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]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = (((x * y) + (z * t)) + (a * b)) + (c * i) END code
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 :pre TRUE (+ (+ (+ (* 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)
use fmin_fmax_functions
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]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = (((x * y) + (z * t)) + (a * b)) + (c * i) END code
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
(FPCore (x y z t a b c i) :precision binary64 :pre TRUE (fma x y (fma i c (fma b a (* t z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(x, y, fma(i, c, fma(b, a, (t * z))));
}
function code(x, y, z, t, a, b, c, i) return fma(x, y, fma(i, c, fma(b, a, Float64(t * z)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(x * y + N[(i * c + N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = (x * y) + ((i * c) + ((b * a) + (t * z))) END code
\mathsf{fma}\left(x, y, \mathsf{fma}\left(i, c, \mathsf{fma}\left(b, a, t \cdot z\right)\right)\right)
Initial program 95.9%
Applied rewrites97.9%
(FPCore (x y z t a b c i)
:precision binary64
:pre TRUE
(if (<= (* x y) -2e+42)
(fma a b (fma c i (* x y)))
(if (<= (* x y) 5e+84)
(fma a b (fma c i (* t z)))
(fma x y (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+42) {
tmp = fma(a, b, fma(c, i, (x * y)));
} else if ((x * y) <= 5e+84) {
tmp = fma(a, b, fma(c, i, (t * z)));
} else {
tmp = fma(x, y, 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+42) tmp = fma(a, b, fma(c, i, Float64(x * y))); elseif (Float64(x * y) <= 5e+84) tmp = fma(a, b, fma(c, i, Float64(t * z))); else tmp = fma(x, y, fma(i, c, Float64(t * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+42], N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+84], N[(a * b + N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = LET tmp_1 = IF ((x * y) <= (5000000000000000073153476153374365154850214939323275296393053935848981821255741079552)) THEN ((a * b) + ((c * i) + (t * z))) ELSE ((x * y) + ((i * c) + (t * z))) ENDIF IN LET tmp = IF ((x * y) <= (-2000000000000000089771425356151833571098624)) THEN ((a * b) + ((c * i) + (x * y))) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+42}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+84}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\end{array}
if (*.f64 x y) < -2.0000000000000001e42Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
if -2.0000000000000001e42 < (*.f64 x y) < 5.0000000000000001e84Initial program 95.9%
Taylor expanded in x around 0
Applied rewrites75.4%
if 5.0000000000000001e84 < (*.f64 x y) Initial program 95.9%
Taylor expanded in a around 0
Applied rewrites74.6%
Applied rewrites74.6%
(FPCore (x y z t a b c i)
:precision binary64
:pre TRUE
(if (<= (* x y) -3.1382117749624694e+42)
(fma a b (fma c i (* x y)))
(if (<= (* x y) 9.39991363007265e+97)
(fma a b (fma c i (* t z)))
(fma c i (fma t z (* 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) <= -3.1382117749624694e+42) {
tmp = fma(a, b, fma(c, i, (x * y)));
} else if ((x * y) <= 9.39991363007265e+97) {
tmp = fma(a, b, fma(c, i, (t * z)));
} else {
tmp = fma(c, i, fma(t, z, (x * y)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -3.1382117749624694e+42) tmp = fma(a, b, fma(c, i, Float64(x * y))); elseif (Float64(x * y) <= 9.39991363007265e+97) tmp = fma(a, b, fma(c, i, Float64(t * z))); else tmp = fma(c, i, fma(t, z, Float64(x * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -3.1382117749624694e+42], N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 9.39991363007265e+97], N[(a * b + N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * i + N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = LET tmp_1 = IF ((x * y) <= (93999136300726496045263588239683999000219775412683399171711992468226925889669915361728257616510976)) THEN ((a * b) + ((c * i) + (t * z))) ELSE ((c * i) + ((t * z) + (x * y))) ENDIF IN LET tmp = IF ((x * y) <= (-3138211774962469442935189429245078050701312)) THEN ((a * b) + ((c * i) + (x * y))) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.1382117749624694 \cdot 10^{+42}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{elif}\;x \cdot y \leq 9.39991363007265 \cdot 10^{+97}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, \mathsf{fma}\left(t, z, x \cdot y\right)\right)\\
\end{array}
if (*.f64 x y) < -3.1382117749624694e42Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
if -3.1382117749624694e42 < (*.f64 x y) < 9.3999136300726496e97Initial program 95.9%
Taylor expanded in x around 0
Applied rewrites75.4%
if 9.3999136300726496e97 < (*.f64 x y) Initial program 95.9%
Taylor expanded in a around 0
Applied rewrites74.6%
(FPCore (x y z t a b c i)
:precision binary64
:pre TRUE
(let* ((t_1 (fma a b (fma c i (* x y)))))
(if (<= (* x y) -3.1382117749624694e+42)
t_1
(if (<= (* x y) 6.334657605915576e+58)
(fma a b (fma c i (* t z)))
t_1))))double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(a, b, fma(c, i, (x * y)));
double tmp;
if ((x * y) <= -3.1382117749624694e+42) {
tmp = t_1;
} else if ((x * y) <= 6.334657605915576e+58) {
tmp = fma(a, b, fma(c, i, (t * z)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(a, b, fma(c, i, Float64(x * y))) tmp = 0.0 if (Float64(x * y) <= -3.1382117749624694e+42) tmp = t_1; elseif (Float64(x * y) <= 6.334657605915576e+58) tmp = fma(a, b, fma(c, i, Float64(t * z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -3.1382117749624694e+42], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 6.334657605915576e+58], N[(a * b + N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = LET t_1 = ((a * b) + ((c * i) + (x * y))) IN LET tmp_1 = IF ((x * y) <= (63346576059155758991410536067508989763166509466962578374656)) THEN ((a * b) + ((c * i) + (t * z))) ELSE t_1 ENDIF IN LET tmp = IF ((x * y) <= (-3138211774962469442935189429245078050701312)) THEN t_1 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{if}\;x \cdot y \leq -3.1382117749624694 \cdot 10^{+42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 6.334657605915576 \cdot 10^{+58}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 x y) < -3.1382117749624694e42 or 6.3346576059155759e58 < (*.f64 x y) Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
if -3.1382117749624694e42 < (*.f64 x y) < 6.3346576059155759e58Initial program 95.9%
Taylor expanded in x around 0
Applied rewrites75.4%
(FPCore (x y z t a b c i)
:precision binary64
:pre TRUE
(if (<= (* x y) -2.4310301300448993e+92)
(fma a b (* x y))
(if (<= (* x y) 9.39991363007265e+97)
(fma a b (fma c i (* t z)))
(fma c i (* 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) <= -2.4310301300448993e+92) {
tmp = fma(a, b, (x * y));
} else if ((x * y) <= 9.39991363007265e+97) {
tmp = fma(a, b, fma(c, i, (t * z)));
} else {
tmp = fma(c, i, (x * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -2.4310301300448993e+92) tmp = fma(a, b, Float64(x * y)); elseif (Float64(x * y) <= 9.39991363007265e+97) tmp = fma(a, b, fma(c, i, Float64(t * z))); else tmp = fma(c, i, Float64(x * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -2.4310301300448993e+92], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 9.39991363007265e+97], N[(a * b + N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = LET tmp_1 = IF ((x * y) <= (93999136300726496045263588239683999000219775412683399171711992468226925889669915361728257616510976)) THEN ((a * b) + ((c * i) + (t * z))) ELSE ((c * i) + (x * y)) ENDIF IN LET tmp = IF ((x * y) <= (-243103013004489926494550397719659858854683041112430769794729004330253462416167071178584752128)) THEN ((a * b) + (x * y)) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.4310301300448993 \cdot 10^{+92}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{elif}\;x \cdot y \leq 9.39991363007265 \cdot 10^{+97}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, x \cdot y\right)\\
\end{array}
if (*.f64 x y) < -2.4310301300448993e92Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
if -2.4310301300448993e92 < (*.f64 x y) < 9.3999136300726496e97Initial program 95.9%
Taylor expanded in x around 0
Applied rewrites75.4%
if 9.3999136300726496e97 < (*.f64 x y) Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
Taylor expanded in x around 0
Applied rewrites28.0%
Taylor expanded in a around 0
Applied rewrites51.1%
(FPCore (x y z t a b c i)
:precision binary64
:pre TRUE
(let* ((t_1 (fma a b (* x y))))
(if (<= (* x y) -2.4310301300448993e+92)
t_1
(if (<= (* x y) -1.0710483818950177e-139)
(fma a b (* c i))
(if (<= (* x y) 2.0945617706960675e+71)
(fma c i (* t z))
t_1)))))double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(a, b, (x * y));
double tmp;
if ((x * y) <= -2.4310301300448993e+92) {
tmp = t_1;
} else if ((x * y) <= -1.0710483818950177e-139) {
tmp = fma(a, b, (c * i));
} else if ((x * y) <= 2.0945617706960675e+71) {
tmp = fma(c, i, (t * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(a, b, Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -2.4310301300448993e+92) tmp = t_1; elseif (Float64(x * y) <= -1.0710483818950177e-139) tmp = fma(a, b, Float64(c * i)); elseif (Float64(x * y) <= 2.0945617706960675e+71) tmp = fma(c, i, Float64(t * z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.4310301300448993e+92], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -1.0710483818950177e-139], N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.0945617706960675e+71], N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = LET t_1 = ((a * b) + (x * y)) IN LET tmp_2 = IF ((x * y) <= (209456177069606752178698508544923590488057895263761271119959979620040704)) THEN ((c * i) + (t * z)) ELSE t_1 ENDIF IN LET tmp_1 = IF ((x * y) <= (-107104838189501766554745995275851255731985160615416250000722709665921879326123707863483014578860596749555539699001121875121062033618750874554338613557799004664033572357213644088861858746389876811579280891752445574204462531453812729847870665888073826689752541393267131659263832828851840074128472893231792503326728285470215802339274372041721949955217496608383953571319580078125e-513)) THEN ((a * b) + (c * i)) ELSE tmp_2 ENDIF IN LET tmp = IF ((x * y) <= (-243103013004489926494550397719659858854683041112430769794729004330253462416167071178584752128)) THEN t_1 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{if}\;x \cdot y \leq -2.4310301300448993 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq -1.0710483818950177 \cdot 10^{-139}:\\
\;\;\;\;\mathsf{fma}\left(a, b, c \cdot i\right)\\
\mathbf{elif}\;x \cdot y \leq 2.0945617706960675 \cdot 10^{+71}:\\
\;\;\;\;\mathsf{fma}\left(c, i, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 x y) < -2.4310301300448993e92 or 2.0945617706960675e71 < (*.f64 x y) Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
if -2.4310301300448993e92 < (*.f64 x y) < -1.0710483818950177e-139Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in x around 0
Applied rewrites52.1%
if -1.0710483818950177e-139 < (*.f64 x y) < 2.0945617706960675e71Initial program 95.9%
Taylor expanded in a around 0
Applied rewrites74.6%
Taylor expanded in x around 0
Applied rewrites51.3%
(FPCore (x y z t a b c i)
:precision binary64
:pre TRUE
(if (<= (* x y) -2.4310301300448993e+92)
(fma a b (* x y))
(if (<= (* x y) 9.39991363007265e+97)
(fma a b (* c i))
(fma c i (* 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) <= -2.4310301300448993e+92) {
tmp = fma(a, b, (x * y));
} else if ((x * y) <= 9.39991363007265e+97) {
tmp = fma(a, b, (c * i));
} else {
tmp = fma(c, i, (x * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -2.4310301300448993e+92) tmp = fma(a, b, Float64(x * y)); elseif (Float64(x * y) <= 9.39991363007265e+97) tmp = fma(a, b, Float64(c * i)); else tmp = fma(c, i, Float64(x * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -2.4310301300448993e+92], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 9.39991363007265e+97], N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = LET tmp_1 = IF ((x * y) <= (93999136300726496045263588239683999000219775412683399171711992468226925889669915361728257616510976)) THEN ((a * b) + (c * i)) ELSE ((c * i) + (x * y)) ENDIF IN LET tmp = IF ((x * y) <= (-243103013004489926494550397719659858854683041112430769794729004330253462416167071178584752128)) THEN ((a * b) + (x * y)) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.4310301300448993 \cdot 10^{+92}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{elif}\;x \cdot y \leq 9.39991363007265 \cdot 10^{+97}:\\
\;\;\;\;\mathsf{fma}\left(a, b, c \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, x \cdot y\right)\\
\end{array}
if (*.f64 x y) < -2.4310301300448993e92Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
if -2.4310301300448993e92 < (*.f64 x y) < 9.3999136300726496e97Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in x around 0
Applied rewrites52.1%
if 9.3999136300726496e97 < (*.f64 x y) Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
Taylor expanded in x around 0
Applied rewrites28.0%
Taylor expanded in a around 0
Applied rewrites51.1%
(FPCore (x y z t a b c i)
:precision binary64
:pre TRUE
(let* ((t_1 (fma c i (* x y))))
(if (<= (* c i) -4e+125)
t_1
(if (<= (* c i) 2e+37) (fma a b (* x y)) t_1))))double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(c, i, (x * y));
double tmp;
if ((c * i) <= -4e+125) {
tmp = t_1;
} else if ((c * i) <= 2e+37) {
tmp = fma(a, b, (x * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(c, i, Float64(x * y)) tmp = 0.0 if (Float64(c * i) <= -4e+125) tmp = t_1; elseif (Float64(c * i) <= 2e+37) tmp = fma(a, b, Float64(x * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -4e+125], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 2e+37], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = LET t_1 = ((c * i) + (x * y)) IN LET tmp_1 = IF ((c * i) <= (19999999999999999077525316404242284544)) THEN ((a * b) + (x * y)) ELSE t_1 ENDIF IN LET tmp = IF ((c * i) <= (-399999999999999969947104647597152817017868347933935384575690388890117679990317210641265397505127061500612023365462212913135616)) THEN t_1 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, i, x \cdot y\right)\\
\mathbf{if}\;c \cdot i \leq -4 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 c i) < -3.9999999999999997e125 or 1.9999999999999999e37 < (*.f64 c i) Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
Taylor expanded in x around 0
Applied rewrites28.0%
Taylor expanded in a around 0
Applied rewrites51.1%
if -3.9999999999999997e125 < (*.f64 c i) < 1.9999999999999999e37Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
(FPCore (x y z t a b c i) :precision binary64 :pre TRUE (if (<= (* z t) -4e+150) (* t z) (if (<= (* z t) 2e+152) (fma a b (* x y)) (* t z))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -4e+150) {
tmp = t * z;
} else if ((z * t) <= 2e+152) {
tmp = fma(a, b, (x * y));
} else {
tmp = t * z;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -4e+150) tmp = Float64(t * z); elseif (Float64(z * t) <= 2e+152) tmp = fma(a, b, Float64(x * y)); else tmp = Float64(t * z); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -4e+150], N[(t * z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+152], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(t * z), $MachinePrecision]]]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = LET tmp_1 = IF ((z * t) <= (200000000000000009250216271808398948002452544790145376983777454402545107507559301846766839764406850263979324900979381181838795379032883593269504018219008)) THEN ((a * b) + (x * y)) ELSE (t * z) ENDIF IN LET tmp = IF ((z * t) <= (-3999999999999999923342384689749498362292480056121275172364659240616400448814714331905193074464884607850808241064704021762268129324833615792933494063104)) THEN (t * z) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -4 \cdot 10^{+150}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+152}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
if (*.f64 z t) < -3.9999999999999999e150 or 2.0000000000000001e152 < (*.f64 z t) Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
Taylor expanded in x around 0
Applied rewrites28.0%
Taylor expanded in z around inf
Applied rewrites27.3%
if -3.9999999999999999e150 < (*.f64 z t) < 2.0000000000000001e152Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
(FPCore (x y z t a b c i) :precision binary64 :pre TRUE (if (<= (* a b) -1.872718146010244e+82) (* a b) (if (<= (* a b) 2.2915198281696953e+27) (* t z) (* 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) <= -1.872718146010244e+82) {
tmp = a * b;
} else if ((a * b) <= 2.2915198281696953e+27) {
tmp = t * z;
} else {
tmp = a * b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
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) <= (-1.872718146010244d+82)) then
tmp = a * b
else if ((a * b) <= 2.2915198281696953d+27) then
tmp = t * z
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 c, double i) {
double tmp;
if ((a * b) <= -1.872718146010244e+82) {
tmp = a * b;
} else if ((a * b) <= 2.2915198281696953e+27) {
tmp = t * z;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -1.872718146010244e+82: tmp = a * b elif (a * b) <= 2.2915198281696953e+27: tmp = t * z else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -1.872718146010244e+82) tmp = Float64(a * b); elseif (Float64(a * b) <= 2.2915198281696953e+27) tmp = Float64(t * z); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((a * b) <= -1.872718146010244e+82) tmp = a * b; elseif ((a * b) <= 2.2915198281696953e+27) tmp = t * z; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1.872718146010244e+82], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2.2915198281696953e+27], N[(t * z), $MachinePrecision], N[(a * b), $MachinePrecision]]]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = LET tmp_1 = IF ((a * b) <= (2291519828169695259242004480)) THEN (t * z) ELSE (a * b) ENDIF IN LET tmp = IF ((a * b) <= (-18727181460102439296841648963870213440793756189383544716934324050261809778630066176)) THEN (a * b) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.872718146010244 \cdot 10^{+82}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 2.2915198281696953 \cdot 10^{+27}:\\
\;\;\;\;t \cdot z\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
if (*.f64 a b) < -1.8727181460102439e82 or 2.2915198281696953e27 < (*.f64 a b) Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
Taylor expanded in x around 0
Applied rewrites28.0%
if -1.8727181460102439e82 < (*.f64 a b) < 2.2915198281696953e27Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
Taylor expanded in x around 0
Applied rewrites28.0%
Taylor expanded in z around inf
Applied rewrites27.3%
(FPCore (x y z t a b c i) :precision binary64 :pre TRUE (if (<= (* c i) -4.503682490157631e+125) (* c i) (if (<= (* c i) 3.8261387039131425e+38) (* 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 ((c * i) <= -4.503682490157631e+125) {
tmp = c * i;
} else if ((c * i) <= 3.8261387039131425e+38) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
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 ((c * i) <= (-4.503682490157631d+125)) then
tmp = c * i
else if ((c * i) <= 3.8261387039131425d+38) then
tmp = a * b
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 ((c * i) <= -4.503682490157631e+125) {
tmp = c * i;
} else if ((c * i) <= 3.8261387039131425e+38) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -4.503682490157631e+125: tmp = c * i elif (c * i) <= 3.8261387039131425e+38: tmp = a * b else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -4.503682490157631e+125) tmp = Float64(c * i); elseif (Float64(c * i) <= 3.8261387039131425e+38) tmp = Float64(a * b); 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 ((c * i) <= -4.503682490157631e+125) tmp = c * i; elseif ((c * i) <= 3.8261387039131425e+38) tmp = a * b; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -4.503682490157631e+125], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 3.8261387039131425e+38], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = LET tmp_1 = IF ((c * i) <= (382613870391314253124613801303561207808)) THEN (a * b) ELSE (c * i) ENDIF IN LET tmp = IF ((c * i) <= (-450368249015763130012492365230978570302056270030389531470603338831907784298328625971329005887457494838939231393676931761176576)) THEN (c * i) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -4.503682490157631 \cdot 10^{+125}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 3.8261387039131425 \cdot 10^{+38}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
if (*.f64 c i) < -4.5036824901576313e125 or 3.8261387039131425e38 < (*.f64 c i) Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
Taylor expanded in x around 0
Applied rewrites28.0%
Taylor expanded in c around inf
Applied rewrites27.1%
if -4.5036824901576313e125 < (*.f64 c i) < 3.8261387039131425e38Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
Taylor expanded in x around 0
Applied rewrites28.0%
(FPCore (x y z t a b c i) :precision binary64 :pre TRUE (* 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)
use fmin_fmax_functions
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]
f(x, y, z, t, a, b, c, i): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf], a in [-inf, +inf], b in [-inf, +inf], c in [-inf, +inf], i in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t, a, b, c, i: real): real = a * b END code
a \cdot b
Initial program 95.9%
Taylor expanded in z around 0
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites52.2%
Taylor expanded in x around 0
Applied rewrites28.0%
herbie shell --seed 2026092
(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)))