Average Error: 0.1 → 0.1
Time: 55.2s
Precision: 64
\[x + \left(y \cdot z\right) \cdot z\]
\[\mathsf{fma}\left(y \cdot z, z, x\right)\]
x + \left(y \cdot z\right) \cdot z
\mathsf{fma}\left(y \cdot z, z, x\right)
double f(double x, double y, double z) {
        double r747989 = x;
        double r747990 = y;
        double r747991 = z;
        double r747992 = r747990 * r747991;
        double r747993 = r747992 * r747991;
        double r747994 = r747989 + r747993;
        return r747994;
}

double f(double x, double y, double z) {
        double r747995 = y;
        double r747996 = z;
        double r747997 = r747995 * r747996;
        double r747998 = x;
        double r747999 = fma(r747997, r747996, r747998);
        return r747999;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.1

    \[x + \left(y \cdot z\right) \cdot z\]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot y, z, x\right)}\]
  3. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(y \cdot z, z, x\right)\]

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y z)
  :name "Statistics.Sample:robustSumVarWeighted from math-functions-0.1.5.2"
  (+ x (* (* y z) z)))