Average Error: 0.4 → 0.2
Time: 6.5s
Precision: binary64
Cost: 960
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)\]
\[\left(y \cdot 4 - x \cdot 3\right) + -6 \cdot \left(\left(y - x\right) \cdot z\right)\]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\left(y \cdot 4 - x \cdot 3\right) + -6 \cdot \left(\left(y - x\right) \cdot z\right)
(FPCore (x y z)
 :precision binary64
 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
(FPCore (x y z)
 :precision binary64
 (+ (- (* y 4.0) (* x 3.0)) (* -6.0 (* (- y x) z))))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
double code(double x, double y, double z) {
	return ((y * 4.0) - (x * 3.0)) + (-6.0 * ((y - x) * z));
}

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

Alternatives

Alternative 1
Error0.2
Cost704
\[x + \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\]
Alternative 2
Error0.4
Cost704
\[x + \left(0.6666666666666666 - z\right) \cdot \left(\left(y - x\right) \cdot 6\right)\]
Alternative 3
Error1.8
Cost1090
\[\begin{array}{l} \mathbf{if}\;z \leq -0.5940513121496368:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 0.5867000245577191:\\ \;\;\;\;y \cdot 4 - x \cdot 3\\ \mathbf{else}:\\ \;\;\;\;\left(y - x\right) \cdot \left(-6 \cdot z\right)\\ \end{array}\]
Alternative 4
Error40.2
Cost448
\[-6 \cdot \left(\left(y - x\right) \cdot z\right)\]
Alternative 5
Error61.9
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.4

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

    \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)}\]
  3. Taylor expanded around 0 0.2

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

    \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(z \cdot -6\right) + \left(y \cdot 4 - x \cdot 3\right)}\]
  5. Using strategy rm
  6. Applied associate-*r*_binary64_102480.2

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

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

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

Reproduce

herbie shell --seed 2021044 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D"
  :precision binary64
  (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))