Average Error: 0.0 → 0.0
Time: 3.4s
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 r98868 = x;
        double r98869 = y;
        double r98870 = r98868 * r98869;
        double r98871 = z;
        double r98872 = t;
        double r98873 = r98871 * r98872;
        double r98874 = r98870 + r98873;
        double r98875 = a;
        double r98876 = b;
        double r98877 = r98875 * r98876;
        double r98878 = r98874 + r98877;
        double r98879 = c;
        double r98880 = i;
        double r98881 = r98879 * r98880;
        double r98882 = r98878 + r98881;
        return r98882;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r98883 = y;
        double r98884 = x;
        double r98885 = r98883 * r98884;
        double r98886 = t;
        double r98887 = z;
        double r98888 = a;
        double r98889 = b;
        double r98890 = i;
        double r98891 = c;
        double r98892 = r98890 * r98891;
        double r98893 = fma(r98888, r98889, r98892);
        double r98894 = fma(r98886, r98887, r98893);
        double r98895 = r98885 + r98894;
        return r98895;
}

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)))