Average Error: 0.4 → 0.2
Time: 14.6s
Precision: binary64
Cost: 960
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
\[4 \cdot \left(y - x\right) + \left(x + -6 \cdot \left(\left(y - x\right) \cdot z\right)\right) \]
(FPCore (x y z)
 :precision binary64
 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
(FPCore (x y z)
 :precision binary64
 (+ (* 4.0 (- y x)) (+ x (* -6.0 (* (- y x) 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 (4.0 * (y - x)) + (x + (-6.0 * ((y - x) * 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 = (4.0d0 * (y - x)) + (x + ((-6.0d0) * ((y - x) * 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 (4.0 * (y - x)) + (x + (-6.0 * ((y - x) * z)));
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
def code(x, y, z):
	return (4.0 * (y - x)) + (x + (-6.0 * ((y - x) * 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(Float64(4.0 * Float64(y - x)) + Float64(x + Float64(-6.0 * Float64(Float64(y - x) * 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 = (4.0 * (y - x)) + (x + (-6.0 * ((y - x) * 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[(N[(4.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] + N[(x + N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
4 \cdot \left(y - x\right) + \left(x + -6 \cdot \left(\left(y - x\right) \cdot z\right)\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.4

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

    [Start]0.4

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

    metadata-eval [=>]0.4

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

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

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

Alternatives

Alternative 1
Error32.6
Cost1245
\[\begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ t_1 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -1.1 \cdot 10^{+31}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -4.8 \cdot 10^{+14}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -0.0138:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{-128}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+33} \lor \neg \left(z \leq 5.6 \cdot 10^{+118}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error32.5
Cost1245
\[\begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ t_1 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -6.5 \cdot 10^{+30}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{+14}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -0.0138:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-134}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{+32} \lor \neg \left(z \leq 4.4 \cdot 10^{+119}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{z}{0.16666666666666666}\\ \end{array} \]
Alternative 3
Error32.7
Cost1245
\[\begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -1.05 \cdot 10^{+32}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -49000000000000:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -0.0138:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-131}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{+33} \lor \neg \left(z \leq 5 \cdot 10^{+119}\right):\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{z}{0.16666666666666666}\\ \end{array} \]
Alternative 4
Error32.6
Cost1245
\[\begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -5.2 \cdot 10^{+32}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -21000000000000:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -0.0138:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-137}:\\ \;\;\;\;\frac{1}{\frac{-0.3333333333333333}{x}}\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 9.6 \cdot 10^{+32} \lor \neg \left(z \leq 6.2 \cdot 10^{+118}\right):\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{z}{0.16666666666666666}\\ \end{array} \]
Alternative 5
Error32.6
Cost1244
\[\begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ t_1 := z \cdot \left(y \cdot -6\right)\\ \mathbf{if}\;z \leq -1.3 \cdot 10^{+31}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{+14}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -0.0138:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2.05 \cdot 10^{-128}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 7 \cdot 10^{+32}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{+118}:\\ \;\;\;\;x \cdot \frac{z}{0.16666666666666666}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error17.8
Cost978
\[\begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-76} \lor \neg \left(y \leq 2.5 \cdot 10^{-121} \lor \neg \left(y \leq 8 \cdot 10^{-59}\right) \land y \leq 9 \cdot 10^{-8}\right):\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
Alternative 7
Error17.8
Cost978
\[\begin{array}{l} \mathbf{if}\;y \leq -1.7 \cdot 10^{-78} \lor \neg \left(y \leq 3.4 \cdot 10^{-119}\right) \land \left(y \leq 6.7 \cdot 10^{-59} \lor \neg \left(y \leq 3.5 \cdot 10^{-6}\right)\right):\\ \;\;\;\;y \cdot \left(4 + -6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
Alternative 8
Error21.5
Cost844
\[\begin{array}{l} t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -0.00165:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-131}:\\ \;\;\;\;\frac{1}{\frac{-0.3333333333333333}{x}}\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error0.3
Cost832
\[x + \frac{\left(y - x\right) \cdot 6}{\frac{1}{0.6666666666666666 - z}} \]
Alternative 10
Error32.2
Cost716
\[\begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -0.00036:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{-135}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 11
Error21.1
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -5000000 \lor \neg \left(z \leq 2600000000000\right):\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \end{array} \]
Alternative 12
Error1.8
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -0.62:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq 0.58:\\ \;\;\;\;4 \cdot y + x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;\left(y - x\right) \cdot \left(-6 \cdot z\right)\\ \end{array} \]
Alternative 13
Error1.8
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -0.56:\\ \;\;\;\;z \cdot \left(x \cdot 6 + y \cdot -6\right)\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;4 \cdot y + x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;\left(y - x\right) \cdot \left(-6 \cdot z\right)\\ \end{array} \]
Alternative 14
Error0.4
Cost704
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right) \]
Alternative 15
Error33.8
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-76}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq 1.95 \cdot 10^{-8}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;4 \cdot y\\ \end{array} \]
Alternative 16
Error43.1
Cost192
\[4 \cdot y \]

Error

Reproduce

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