Average Error: 0.3 → 0.2
Time: 5.1s
Precision: binary64
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
\[x + \left(4 \cdot \left(y - x\right) + \left(x \cdot 6 - y \cdot 6\right) \cdot z\right) \]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
x + \left(4 \cdot \left(y - x\right) + \left(x \cdot 6 - y \cdot 6\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
 (+ x (+ (* 4.0 (- y x)) (* (- (* x 6.0) (* y 6.0)) 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 x + ((4.0 * (y - x)) + (((x * 6.0) - (y * 6.0)) * 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

Derivation

  1. Initial program 0.3

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

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

    \[\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)} \]
  4. Simplified0.2

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

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

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

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

Reproduce

herbie shell --seed 2022068 
(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))))