Average Error: 0.0 → 0.0
Time: 17.1s
Precision: 64
\[x + y \cdot \left(z + x\right)\]
\[x + \mathsf{fma}\left(y, z, x \cdot y\right)\]
x + y \cdot \left(z + x\right)
x + \mathsf{fma}\left(y, z, x \cdot y\right)
double f(double x, double y, double z) {
        double r113917 = x;
        double r113918 = y;
        double r113919 = z;
        double r113920 = r113919 + r113917;
        double r113921 = r113918 * r113920;
        double r113922 = r113917 + r113921;
        return r113922;
}

double f(double x, double y, double z) {
        double r113923 = x;
        double r113924 = y;
        double r113925 = z;
        double r113926 = r113923 * r113924;
        double r113927 = fma(r113924, r113925, r113926);
        double r113928 = r113923 + r113927;
        return r113928;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.0

    \[x + y \cdot \left(z + x\right)\]
  2. Using strategy rm
  3. Applied distribute-lft-in0.0

    \[\leadsto x + \color{blue}{\left(y \cdot z + y \cdot x\right)}\]
  4. Simplified0.0

    \[\leadsto x + \left(y \cdot z + \color{blue}{x \cdot y}\right)\]
  5. Using strategy rm
  6. Applied fma-def0.0

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

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

Reproduce

herbie shell --seed 2019326 +o rules:numerics
(FPCore (x y z)
  :name "Main:bigenough2 from A"
  :precision binary64
  (+ x (* y (+ z x))))