Average Error: 0.2 → 0.2
Time: 2.7s
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 r843593 = x;
        double r843594 = y;
        double r843595 = r843594 - r843593;
        double r843596 = 6.0;
        double r843597 = r843595 * r843596;
        double r843598 = z;
        double r843599 = r843597 * r843598;
        double r843600 = r843593 + r843599;
        return r843600;
}

double f(double x, double y, double z) {
        double r843601 = y;
        double r843602 = x;
        double r843603 = r843601 - r843602;
        double r843604 = 6.0;
        double r843605 = z;
        double r843606 = r843604 * r843605;
        double r843607 = r843603 * r843606;
        double r843608 = r843607 + r843602;
        return r843608;
}

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.2
Target0.2
Herbie0.2
\[x - \left(6 \cdot z\right) \cdot \left(x - y\right)\]

Derivation

  1. Initial program 0.2

    \[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 2020062 +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)))