Average Error: 0.0 → 0.0
Time: 3.6s
Precision: 64
\[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i\]
\[y \cdot x + \mathsf{fma}\left(t, z, \mathsf{fma}\left(a, b, i \cdot c\right)\right)\]
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
y \cdot x + \mathsf{fma}\left(t, z, \mathsf{fma}\left(a, b, i \cdot c\right)\right)
double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r103401 = x;
        double r103402 = y;
        double r103403 = r103401 * r103402;
        double r103404 = z;
        double r103405 = t;
        double r103406 = r103404 * r103405;
        double r103407 = r103403 + r103406;
        double r103408 = a;
        double r103409 = b;
        double r103410 = r103408 * r103409;
        double r103411 = r103407 + r103410;
        double r103412 = c;
        double r103413 = i;
        double r103414 = r103412 * r103413;
        double r103415 = r103411 + r103414;
        return r103415;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r103416 = y;
        double r103417 = x;
        double r103418 = r103416 * r103417;
        double r103419 = t;
        double r103420 = z;
        double r103421 = a;
        double r103422 = b;
        double r103423 = i;
        double r103424 = c;
        double r103425 = r103423 * r103424;
        double r103426 = fma(r103421, r103422, r103425);
        double r103427 = fma(r103419, r103420, r103426);
        double r103428 = r103418 + r103427;
        return r103428;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus i

Derivation

  1. Initial program 0.0

    \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i\]
  2. Taylor expanded around inf 0.0

    \[\leadsto \color{blue}{\left(t \cdot z + \left(a \cdot b + x \cdot y\right)\right)} + c \cdot i\]
  3. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, \mathsf{fma}\left(z, t, a \cdot b\right)\right)} + c \cdot i\]
  4. Using strategy rm
  5. Applied fma-udef0.0

    \[\leadsto \color{blue}{\left(y \cdot x + \mathsf{fma}\left(z, t, a \cdot b\right)\right)} + c \cdot i\]
  6. Applied associate-+l+0.0

    \[\leadsto \color{blue}{y \cdot x + \left(\mathsf{fma}\left(z, t, a \cdot b\right) + c \cdot i\right)}\]
  7. Simplified0.0

    \[\leadsto y \cdot x + \color{blue}{\mathsf{fma}\left(t, z, \mathsf{fma}\left(a, b, i \cdot c\right)\right)}\]
  8. Final simplification0.0

    \[\leadsto y \cdot x + \mathsf{fma}\left(t, z, \mathsf{fma}\left(a, b, i \cdot c\right)\right)\]

Reproduce

herbie shell --seed 2020001 +o rules:numerics
(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)))