Average Error: 0.4 → 0.2
Time: 12.4s
Precision: binary64
Cost: 704
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
\[x + \frac{y - x}{\frac{-0.16666666666666666}{-0.6666666666666666 + z}} \]
(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) (/ -0.16666666666666666 (+ -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) / (-0.16666666666666666 / (-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) / ((-0.16666666666666666d0) / ((-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) / (-0.16666666666666666 / (-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) / (-0.16666666666666666 / (-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(y - x) / Float64(-0.16666666666666666 / 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) / (-0.16666666666666666 / (-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[(y - x), $MachinePrecision] / N[(-0.16666666666666666 / N[(-0.6666666666666666 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
x + \frac{y - x}{\frac{-0.16666666666666666}{-0.6666666666666666 + z}}

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. Simplified0.4

    \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    Proof
    (+.f64 x (*.f64 (*.f64 (-.f64 y x) 6) (-.f64 2/3 z))): 0 points increase in error, 0 points decrease in error
    (+.f64 x (*.f64 (*.f64 (-.f64 y x) 6) (-.f64 (Rewrite<= metadata-eval (/.f64 2 3)) z))): 0 points increase in error, 2 points decrease in error
  3. Applied egg-rr0.3

    \[\leadsto x + \color{blue}{\frac{\left(y - x\right) \cdot 6}{\frac{1}{0.6666666666666666 - z}}} \]
  4. Applied egg-rr0.3

    \[\leadsto x + \color{blue}{\frac{y - x}{-0.16666666666666666} \cdot \left(-0.6666666666666666 + z\right)} \]
  5. Applied egg-rr0.2

    \[\leadsto x + \color{blue}{\frac{y - x}{\frac{-0.16666666666666666}{-0.6666666666666666 + z}}} \]
  6. Final simplification0.2

    \[\leadsto x + \frac{y - x}{\frac{-0.16666666666666666}{-0.6666666666666666 + z}} \]

Alternatives

Alternative 1
Error33.0
Cost849
\[\begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -3.7 \cdot 10^{+58}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{+26}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -0.66 \lor \neg \left(z \leq 0.66\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]
Alternative 2
Error33.0
Cost849
\[\begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -3.7 \cdot 10^{+58}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3 \cdot 10^{+24}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -0.66 \lor \neg \left(z \leq 0.66\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]
Alternative 3
Error33.0
Cost849
\[\begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -4.2 \cdot 10^{+58}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.85 \cdot 10^{+28}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq -0.66 \lor \neg \left(z \leq 0.66\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]
Alternative 4
Error33.0
Cost848
\[\begin{array}{l} t_0 := z \cdot \left(y \cdot -6\right)\\ \mathbf{if}\;z \leq -3.7 \cdot 10^{+58}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.7 \cdot 10^{+26}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq -0.66:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error21.3
Cost844
\[\begin{array}{l} t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -700:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-287}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error21.3
Cost844
\[\begin{array}{l} \mathbf{if}\;z \leq -700:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq 1.42 \cdot 10^{-286}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 0.62:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]
Alternative 7
Error21.5
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -0.19 \lor \neg \left(z \leq 0.66\right):\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]
Alternative 8
Error17.1
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{+15} \lor \neg \left(x \leq 2.9 \cdot 10^{-28}\right):\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \end{array} \]
Alternative 9
Error1.9
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -0.52:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq 0.55:\\ \;\;\;\;x \cdot -3 + y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]
Alternative 10
Error0.4
Cost704
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right) \]
Alternative 11
Error0.3
Cost704
\[x + \left(-0.6666666666666666 + z\right) \cdot \frac{y - x}{-0.16666666666666666} \]
Alternative 12
Error32.8
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -0.66 \lor \neg \left(z \leq 0.66\right):\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]
Alternative 13
Error34.2
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1 \cdot 10^{+127}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;x \leq 4.9 \cdot 10^{-20}:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \]
Alternative 14
Error43.2
Cost192
\[y \cdot 4 \]

Error

Reproduce

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