Average Error: 0.3 → 0.2
Time: 11.0s
Precision: 64
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot z\]
\[x + \left(\left(y - x\right) \cdot z\right) \cdot 6\]
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
x + \left(\left(y - x\right) \cdot z\right) \cdot 6
double f(double x, double y, double z) {
        double r548056 = x;
        double r548057 = y;
        double r548058 = r548057 - r548056;
        double r548059 = 6.0;
        double r548060 = r548058 * r548059;
        double r548061 = z;
        double r548062 = r548060 * r548061;
        double r548063 = r548056 + r548062;
        return r548063;
}

double f(double x, double y, double z) {
        double r548064 = x;
        double r548065 = y;
        double r548066 = r548065 - r548064;
        double r548067 = z;
        double r548068 = r548066 * r548067;
        double r548069 = 6.0;
        double r548070 = r548068 * r548069;
        double r548071 = r548064 + r548070;
        return r548071;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 0.3

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, \left(y - x\right) \cdot 6, x\right)}\]
  3. Taylor expanded around 0 0.2

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(6, z \cdot \left(y - x\right), x\right)}\]
  5. Using strategy rm
  6. Applied fma-udef0.2

    \[\leadsto \color{blue}{6 \cdot \left(z \cdot \left(y - x\right)\right) + x}\]
  7. Simplified0.2

    \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x\]
  8. Final simplification0.2

    \[\leadsto x + \left(\left(y - x\right) \cdot z\right) \cdot 6\]

Reproduce

herbie shell --seed 2019174 +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)))