?

Average Error: 0.4 → 0.2
Time: 13.8s
Precision: binary64
Cost: 1088

?

\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
\[\left(x \cdot -4 - \left(y - x\right) \cdot \left(6 \cdot z\right)\right) - \left(y \cdot -4 - x\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) (* 6.0 z))) (- (* y -4.0) x)))
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) * (6.0 * z))) - ((y * -4.0) - x);
}
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 * (-4.0d0)) - ((y - x) * (6.0d0 * z))) - ((y * (-4.0d0)) - x)
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 * -4.0) - ((y - x) * (6.0 * z))) - ((y * -4.0) - x);
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
def code(x, y, z):
	return ((x * -4.0) - ((y - x) * (6.0 * z))) - ((y * -4.0) - x)
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(Float64(Float64(x * -4.0) - Float64(Float64(y - x) * Float64(6.0 * z))) - Float64(Float64(y * -4.0) - x))
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 * -4.0) - ((y - x) * (6.0 * z))) - ((y * -4.0) - x);
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[(N[(N[(x * -4.0), $MachinePrecision] - N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(y * -4.0), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\left(x \cdot -4 - \left(y - x\right) \cdot \left(6 \cdot z\right)\right) - \left(y \cdot -4 - x\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. Simplified0.2

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

    [Start]0.4

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

    rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.4

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

    rational_best_oopsla_all_46_json_45_simplify-7 [=>]0.2

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

    rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.2

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

    rational_best_oopsla_all_46_json_45_simplify-13 [=>]0.2

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

    metadata-eval [=>]0.2

    \[ x + \left(y - x\right) \cdot \left(\color{blue}{0.6666666666666666} \cdot 6 - 6 \cdot z\right) \]

    metadata-eval [=>]0.2

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

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

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

Alternatives

Alternative 1
Error20.6
Cost1504
\[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \mathbf{if}\;z \leq -3.7 \cdot 10^{-6}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{-146}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-229}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-233}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{-85}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-62}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{-39}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error20.2
Cost1504
\[\begin{array}{l} t_0 := x \cdot \left(-3 - z \cdot -6\right)\\ t_1 := 6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \mathbf{if}\;z \leq -3.7 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.3 \cdot 10^{-147}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-228}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-233}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-86}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-64}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-39}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 360000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error20.2
Cost1504
\[\begin{array}{l} t_0 := x \cdot \left(-3 - z \cdot -6\right)\\ t_1 := z \cdot \left(-6 \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -3.7 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.3 \cdot 10^{-146}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -4.6 \cdot 10^{-231}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-233}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-85}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-62}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-40}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 22500000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error32.2
Cost1376
\[\begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -3.7 \cdot 10^{-6}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.85 \cdot 10^{-146}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{-228}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-233}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-84}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{-62}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-40}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.56:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error32.3
Cost1376
\[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot x\right)\\ \mathbf{if}\;z \leq -180000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-146}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -3.3 \cdot 10^{-229}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{-233}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 10^{-85}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-65}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-39}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 460000000:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error32.2
Cost1376
\[\begin{array}{l} \mathbf{if}\;z \leq -180000:\\ \;\;\;\;6 \cdot \left(z \cdot x\right)\\ \mathbf{elif}\;z \leq -3.9 \cdot 10^{-147}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -9.2 \cdot 10^{-229}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-232}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.52 \cdot 10^{-86}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 5.3 \cdot 10^{-64}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{-40}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 460000000:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]
Alternative 7
Error32.3
Cost1376
\[\begin{array}{l} t_0 := z \cdot \left(x \cdot 6\right)\\ \mathbf{if}\;z \leq -180000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2.3 \cdot 10^{-145}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-229}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-232}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-86}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{-62}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-39}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 460000000:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error17.7
Cost976
\[\begin{array}{l} t_0 := x \cdot \left(-3 - z \cdot -6\right)\\ t_1 := \left(4 + -6 \cdot z\right) \cdot y\\ \mathbf{if}\;y \leq -230000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -9.4 \cdot 10^{-27}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2.9 \cdot 10^{-111}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 500000000000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error2.0
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -0.6:\\ \;\;\;\;z \cdot \left(-6 \cdot \left(y - x\right)\right)\\ \mathbf{elif}\;z \leq 0.52:\\ \;\;\;\;x \cdot -3 + 4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(6 \cdot \left(x - y\right)\right)\\ \end{array} \]
Alternative 10
Error35.4
Cost720
\[\begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+118}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{-27}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;y \leq -3.25 \cdot 10^{-111}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq 1700000000000:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;4 \cdot y\\ \end{array} \]
Alternative 11
Error2.0
Cost712
\[\begin{array}{l} t_0 := z \cdot \left(-6 \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -0.6:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.56:\\ \;\;\;\;4 \cdot \left(y - x\right) + x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 12
Error2.0
Cost712
\[\begin{array}{l} t_0 := z \cdot \left(-6 \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -0.58:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.64:\\ \;\;\;\;x \cdot -3 + 4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 13
Error0.4
Cost704
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right) \]
Alternative 14
Error0.2
Cost704
\[x + \left(y - x\right) \cdot \left(4 - 6 \cdot z\right) \]
Alternative 15
Error43.5
Cost192
\[4 \cdot y \]
Alternative 16
Error62.3
Cost64
\[x \]

Error

Reproduce?

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