Average Error: 0.3 → 0.2
Time: 3.2s
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 r813354 = x;
        double r813355 = y;
        double r813356 = r813355 - r813354;
        double r813357 = 6.0;
        double r813358 = r813356 * r813357;
        double r813359 = z;
        double r813360 = r813358 * r813359;
        double r813361 = r813354 + r813360;
        return r813361;
}

double f(double x, double y, double z) {
        double r813362 = y;
        double r813363 = x;
        double r813364 = r813362 - r813363;
        double r813365 = 6.0;
        double r813366 = z;
        double r813367 = r813365 * r813366;
        double r813368 = r813364 * r813367;
        double r813369 = r813368 + r813363;
        return r813369;
}

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 2020039 +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)))