Average Error: 0.4 → 0.2
Time: 11.6min
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) + \left(\left(y - x\right) \cdot -6\right) \cdot z\]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\left(y \cdot 4 - x \cdot 3\right) + \left(\left(y - x\right) \cdot -6\right) \cdot z
(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)) (* (* (- y x) -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 ((y * 4.0) - (x * 3.0)) + (((y - x) * -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

Alternatives

Alternative 1
Error0.2
Cost704
\[x + \left(y - x\right) \cdot \left(4 - z \cdot 6\right)\]
Alternative 2
Error0.4
Cost704
\[x + 6 \cdot \left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right)\right)\]
Alternative 3
Error0.4
Cost704
\[x + \left(0.6666666666666666 - z\right) \cdot \left(\left(y - x\right) \cdot 6\right)\]
Alternative 4
Error1.8
Cost1090
\[\begin{array}{l} \mathbf{if}\;z \leq -0.6617380995883639:\\ \;\;\;\;x + \left(\left(y - x\right) \cdot -6\right) \cdot z\\ \mathbf{elif}\;z \leq 0.5781135423820416:\\ \;\;\;\;y \cdot 4 - x \cdot 3\\ \mathbf{else}:\\ \;\;\;\;\left(y - x\right) \cdot \left(-6 \cdot z\right)\\ \end{array}\]
Alternative 5
Error1.8
Cost1090
\[\begin{array}{l} \mathbf{if}\;z \leq -0.5614723910915681:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 0.5781135423820416:\\ \;\;\;\;y \cdot 4 - x \cdot 3\\ \mathbf{else}:\\ \;\;\;\;\left(y - x\right) \cdot \left(-6 \cdot z\right)\\ \end{array}\]
Alternative 6
Error20.3
Cost2695
\[\begin{array}{l} \mathbf{if}\;z \leq -1.0828083935718329 \cdot 10^{-07}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -5.446531970662387 \cdot 10^{-48}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -4.671310924749331 \cdot 10^{-115}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -6.555100999375592 \cdot 10^{-193}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -5.7471583799886725 \cdot 10^{-254}:\\ \;\;\;\;x \cdot \left(z \cdot 6 + -3\right)\\ \mathbf{elif}\;z \leq 6.849124482767209 \cdot 10^{-102}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 19.457482665026856:\\ \;\;\;\;x \cdot \left(z \cdot 6 + -3\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y - x\right) \cdot \left(-6 \cdot z\right)\\ \end{array}\]
Alternative 7
Error20.3
Cost2695
\[\begin{array}{l} \mathbf{if}\;z \leq -1.0828083935718329 \cdot 10^{-07}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -1.8872563064995598 \cdot 10^{-48}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -4.178277989252238 \cdot 10^{-113}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -8.646031249717085 \cdot 10^{-193}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -8.167864008949096 \cdot 10^{-252}:\\ \;\;\;\;x \cdot \left(z \cdot 6 + -3\right)\\ \mathbf{elif}\;z \leq 5.9262544907659085 \cdot 10^{-102}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 19.457482665026856:\\ \;\;\;\;x \cdot \left(z \cdot 6 + -3\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array}\]
Alternative 8
Error20.5
Cost2695
\[\begin{array}{l} \mathbf{if}\;z \leq -1.0828083935718329 \cdot 10^{-07}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -2.426125580152609 \cdot 10^{-48}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.519457736207247 \cdot 10^{-118}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -4.94669311449752 \cdot 10^{-193}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -3.860770922513212 \cdot 10^{-253}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.721297174862834 \cdot 10^{-106}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.49493003646601996:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array}\]
Alternative 9
Error32.0
Cost2567
\[\begin{array}{l} \mathbf{if}\;z \leq -1.0828083935718329 \cdot 10^{-07}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -5.62032163658667 \cdot 10^{-47}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -3.632746662456877 \cdot 10^{-117}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.0454914565254245 \cdot 10^{-192}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -6.011515358352692 \cdot 10^{-251}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.409795255460514 \cdot 10^{-105}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 20.17851352049041:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array}\]
Alternative 10
Error34.3
Cost785
\[\begin{array}{l} \mathbf{if}\;y \leq -5.4238416061398306 \cdot 10^{+35} \lor \neg \left(y \leq -5.495717977092104 \cdot 10^{-118} \lor \neg \left(y \leq -5.083000400705727 \cdot 10^{-128}\right) \land y \leq 4.462371963252473 \cdot 10^{-13}\right):\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array}\]
Alternative 11
Error43.4
Cost192
\[x \cdot -3\]
Alternative 12
Error61.9
Cost64
\[1\]
Alternative 13
Error62.4
Cost64
\[x\]

Error

Time

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 *-un-lft-identity_binary64_106490.4

    \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - \color{blue}{1 \cdot z}\right)\]
  4. Applied cancel-sign-sub-inv_binary64_106150.4

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

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

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

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

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

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

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

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

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

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

Reproduce

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