Average Error: 0.3 → 0.2
Time: 12.2s
Precision: 64
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot z\]
\[x + \left(z \cdot \left(y - x\right)\right) \cdot 6\]
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
x + \left(z \cdot \left(y - x\right)\right) \cdot 6
double f(double x, double y, double z) {
        double r23553317 = x;
        double r23553318 = y;
        double r23553319 = r23553318 - r23553317;
        double r23553320 = 6.0;
        double r23553321 = r23553319 * r23553320;
        double r23553322 = z;
        double r23553323 = r23553321 * r23553322;
        double r23553324 = r23553317 + r23553323;
        return r23553324;
}

double f(double x, double y, double z) {
        double r23553325 = x;
        double r23553326 = z;
        double r23553327 = y;
        double r23553328 = r23553327 - r23553325;
        double r23553329 = r23553326 * r23553328;
        double r23553330 = 6.0;
        double r23553331 = r23553329 * r23553330;
        double r23553332 = r23553325 + r23553331;
        return r23553332;
}

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

    \[\leadsto x + \left(z \cdot \left(y - x\right)\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)))