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 r684199 = x;
        double r684200 = y;
        double r684201 = r684200 - r684199;
        double r684202 = 6.0;
        double r684203 = r684201 * r684202;
        double r684204 = z;
        double r684205 = r684203 * r684204;
        double r684206 = r684199 + r684205;
        return r684206;
}

double f(double x, double y, double z) {
        double r684207 = y;
        double r684208 = x;
        double r684209 = r684207 - r684208;
        double r684210 = 6.0;
        double r684211 = z;
        double r684212 = r684210 * r684211;
        double r684213 = r684209 * r684212;
        double r684214 = r684213 + r684208;
        return r684214;
}

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