Average Error: 0.3 → 0.2
Time: 2.8s
Precision: 64
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot z\]
\[\left(y - x\right) \cdot \left(6 \cdot z\right) + x\]
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\left(y - x\right) \cdot \left(6 \cdot z\right) + x
double f(double x, double y, double z) {
        double r767882 = x;
        double r767883 = y;
        double r767884 = r767883 - r767882;
        double r767885 = 6.0;
        double r767886 = r767884 * r767885;
        double r767887 = z;
        double r767888 = r767886 * r767887;
        double r767889 = r767882 + r767888;
        return r767889;
}

double f(double x, double y, double z) {
        double r767890 = y;
        double r767891 = x;
        double r767892 = r767890 - r767891;
        double r767893 = 6.0;
        double r767894 = z;
        double r767895 = r767893 * r767894;
        double r767896 = r767892 * r767895;
        double r767897 = r767896 + r767891;
        return r767897;
}

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.2

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

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

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

Reproduce

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

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

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