Average Error: 0.0 → 0
Time: 5.6s
Precision: 64
\[x \cdot \left(y + 1.0\right)\]
\[\mathsf{fma}\left(x, y, x \cdot 1.0\right)\]
x \cdot \left(y + 1.0\right)
\mathsf{fma}\left(x, y, x \cdot 1.0\right)
double f(double x, double y) {
        double r41347773 = x;
        double r41347774 = y;
        double r41347775 = 1.0;
        double r41347776 = r41347774 + r41347775;
        double r41347777 = r41347773 * r41347776;
        return r41347777;
}

double f(double x, double y) {
        double r41347778 = x;
        double r41347779 = y;
        double r41347780 = 1.0;
        double r41347781 = r41347778 * r41347780;
        double r41347782 = fma(r41347778, r41347779, r41347781);
        return r41347782;
}

Error

Bits error versus x

Bits error versus y

Target

Original0.0
Target0.0
Herbie0
\[x + x \cdot y\]

Derivation

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{x \cdot y + x \cdot 1.0}\]
  4. Using strategy rm
  5. Applied fma-def0

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

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

Reproduce

herbie shell --seed 2019163 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, B"

  :herbie-target
  (+ x (* x y))

  (* x (+ y 1.0)))