Average Error: 0.4 → 0.4
Time: 16.4s
Precision: binary64
Cost: 704
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - 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 (* (* (- y x) 6.0) (- 0.6666666666666666 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 + (((y - x) * 6.0) * (0.6666666666666666 - z));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (((y - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (((y - x) * 6.0d0) * (0.6666666666666666d0 - z))
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * (0.6666666666666666 - z));
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
def code(x, y, z):
	return x + (((y - x) * 6.0) * (0.6666666666666666 - z))
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z)))
end
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(0.6666666666666666 - z)))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * (0.6666666666666666 - z));
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)

Error

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. Applied egg-rr8.4

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

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

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

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

Alternatives

Alternative 1
Error21.5
Cost1504
\[\begin{array}{l} t_0 := z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{if}\;z \leq -0.21646441929426122:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.220918446385096 \cdot 10^{-193}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.203537762319986 \cdot 10^{-227}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.571058905948992 \cdot 10^{-245}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -7.060328153265561 \cdot 10^{-267}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.2335378577374399 \cdot 10^{-212}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.720625698418691 \cdot 10^{-128}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.03069251571248673:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error33.3
Cost1376
\[\begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -0.21646441929426122:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.220918446385096 \cdot 10^{-193}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.203537762319986 \cdot 10^{-227}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.571058905948992 \cdot 10^{-245}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -7.060328153265561 \cdot 10^{-267}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.2335378577374399 \cdot 10^{-212}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.720625698418691 \cdot 10^{-128}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.9206757236594787:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error33.3
Cost1376
\[\begin{array}{l} \mathbf{if}\;z \leq -0.21646441929426122:\\ \;\;\;\;x \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;z \leq -3.220918446385096 \cdot 10^{-193}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.203537762319986 \cdot 10^{-227}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.571058905948992 \cdot 10^{-245}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -7.060328153265561 \cdot 10^{-267}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.2335378577374399 \cdot 10^{-212}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.720625698418691 \cdot 10^{-128}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.9206757236594787:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
Alternative 4
Error1.9
Cost840
\[\begin{array}{l} t_0 := x + \left(y - x\right) \cdot \left(z \cdot -6\right)\\ \mathbf{if}\;z \leq -1.6983593488052935:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.03069251571248673:\\ \;\;\;\;y \cdot 4 + x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error16.7
Cost712
\[\begin{array}{l} t_0 := x \cdot \left(6 \cdot z + -3\right)\\ \mathbf{if}\;x \leq -7.912141565496784 \cdot 10^{-28}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.646204571715827 \cdot 10^{-46}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error1.9
Cost712
\[\begin{array}{l} t_0 := z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{if}\;z \leq -1.6983593488052935:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.03069251571248673:\\ \;\;\;\;y \cdot 4 + x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error1.9
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -1.6983593488052935:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq 0.03069251571248673:\\ \;\;\;\;y \cdot 4 + x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]
Alternative 8
Error35.6
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -2.5702712000000035 \cdot 10^{-72}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;x \leq 2.789027233030791 \cdot 10^{-174}:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \]
Alternative 9
Error43.2
Cost192
\[y \cdot 4 \]
Alternative 10
Error62.3
Cost64
\[x \]

Error

Reproduce

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