Average Error: 0.3 → 0.3
Time: 17.0s
Precision: 64
\[x + \left(\left(y - x\right) \cdot 6.0\right) \cdot z\]
\[\mathsf{fma}\left(z, 6.0 \cdot \left(y - x\right), x\right)\]
x + \left(\left(y - x\right) \cdot 6.0\right) \cdot z
\mathsf{fma}\left(z, 6.0 \cdot \left(y - x\right), x\right)
double f(double x, double y, double z) {
        double r37104638 = x;
        double r37104639 = y;
        double r37104640 = r37104639 - r37104638;
        double r37104641 = 6.0;
        double r37104642 = r37104640 * r37104641;
        double r37104643 = z;
        double r37104644 = r37104642 * r37104643;
        double r37104645 = r37104638 + r37104644;
        return r37104645;
}

double f(double x, double y, double z) {
        double r37104646 = z;
        double r37104647 = 6.0;
        double r37104648 = y;
        double r37104649 = x;
        double r37104650 = r37104648 - r37104649;
        double r37104651 = r37104647 * r37104650;
        double r37104652 = fma(r37104646, r37104651, r37104649);
        return r37104652;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original0.3
Target0.2
Herbie0.3
\[x - \left(6.0 \cdot z\right) \cdot \left(x - y\right)\]

Derivation

  1. Initial program 0.3

    \[x + \left(\left(y - x\right) \cdot 6.0\right) \cdot z\]
  2. Simplified0.3

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

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

Reproduce

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

  :herbie-target
  (- x (* (* 6.0 z) (- x y)))

  (+ x (* (* (- y x) 6.0) z)))