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 r735303 = x;
        double r735304 = y;
        double r735305 = r735304 - r735303;
        double r735306 = 6.0;
        double r735307 = r735305 * r735306;
        double r735308 = z;
        double r735309 = r735307 * r735308;
        double r735310 = r735303 + r735309;
        return r735310;
}

double f(double x, double y, double z) {
        double r735311 = y;
        double r735312 = x;
        double r735313 = r735311 - r735312;
        double r735314 = 6.0;
        double r735315 = z;
        double r735316 = r735314 * r735315;
        double r735317 = r735313 * r735316;
        double r735318 = r735317 + r735312;
        return r735318;
}

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