Average Error: 0.4 → 0.2
Time: 3.7s
Precision: 64
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)\]
\[\left(4 \cdot y - 3 \cdot x\right) + \left(z \cdot \left(x - y\right)\right) \cdot 6\]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\left(4 \cdot y - 3 \cdot x\right) + \left(z \cdot \left(x - y\right)\right) \cdot 6
double f(double x, double y, double z) {
        double r193304 = x;
        double r193305 = y;
        double r193306 = r193305 - r193304;
        double r193307 = 6.0;
        double r193308 = r193306 * r193307;
        double r193309 = 2.0;
        double r193310 = 3.0;
        double r193311 = r193309 / r193310;
        double r193312 = z;
        double r193313 = r193311 - r193312;
        double r193314 = r193308 * r193313;
        double r193315 = r193304 + r193314;
        return r193315;
}

double f(double x, double y, double z) {
        double r193316 = 4.0;
        double r193317 = y;
        double r193318 = r193316 * r193317;
        double r193319 = 3.0;
        double r193320 = x;
        double r193321 = r193319 * r193320;
        double r193322 = r193318 - r193321;
        double r193323 = z;
        double r193324 = r193320 - r193317;
        double r193325 = r193323 * r193324;
        double r193326 = 6.0;
        double r193327 = r193325 * r193326;
        double r193328 = r193322 + r193327;
        return r193328;
}

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

Derivation

  1. Initial program 0.4

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)\]
  2. Using strategy rm
  3. Applied sub-neg0.4

    \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}\]
  4. Applied distribute-rgt-in0.4

    \[\leadsto x + \color{blue}{\left(\frac{2}{3} \cdot \left(\left(y - x\right) \cdot 6\right) + \left(-z\right) \cdot \left(\left(y - x\right) \cdot 6\right)\right)}\]
  5. Applied associate-+r+0.4

    \[\leadsto \color{blue}{\left(x + \frac{2}{3} \cdot \left(\left(y - x\right) \cdot 6\right)\right) + \left(-z\right) \cdot \left(\left(y - x\right) \cdot 6\right)}\]
  6. Simplified0.4

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{2}{3} \cdot \left(y - x\right), 6, x\right)} + \left(-z\right) \cdot \left(\left(y - x\right) \cdot 6\right)\]
  7. Using strategy rm
  8. Applied div-inv0.4

    \[\leadsto \mathsf{fma}\left(\color{blue}{\left(2 \cdot \frac{1}{3}\right)} \cdot \left(y - x\right), 6, x\right) + \left(-z\right) \cdot \left(\left(y - x\right) \cdot 6\right)\]
  9. Applied associate-*l*0.4

    \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \left(\frac{1}{3} \cdot \left(y - x\right)\right)}, 6, x\right) + \left(-z\right) \cdot \left(\left(y - x\right) \cdot 6\right)\]
  10. Simplified0.3

    \[\leadsto \mathsf{fma}\left(2 \cdot \color{blue}{\frac{y - x}{3}}, 6, x\right) + \left(-z\right) \cdot \left(\left(y - x\right) \cdot 6\right)\]
  11. Taylor expanded around 0 0.3

    \[\leadsto \mathsf{fma}\left(2 \cdot \frac{y - x}{3}, 6, x\right) + \color{blue}{\left(6 \cdot \left(x \cdot z\right) - 6 \cdot \left(z \cdot y\right)\right)}\]
  12. Simplified0.3

    \[\leadsto \mathsf{fma}\left(2 \cdot \frac{y - x}{3}, 6, x\right) + \color{blue}{\left(z \cdot \left(x - y\right)\right) \cdot 6}\]
  13. Taylor expanded around 0 0.2

    \[\leadsto \color{blue}{\left(4 \cdot y - 3 \cdot x\right)} + \left(z \cdot \left(x - y\right)\right) \cdot 6\]
  14. Final simplification0.2

    \[\leadsto \left(4 \cdot y - 3 \cdot x\right) + \left(z \cdot \left(x - y\right)\right) \cdot 6\]

Reproduce

herbie shell --seed 2020018 +o rules:numerics
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D"
  :precision binary64
  (+ x (* (* (- y x) 6) (- (/ 2 3) z))))