?

Average Error: 0.4 → 0.3
Time: 35.0s
Precision: binary64
Cost: 704

?

\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
\[x + \left(y - x\right) \cdot \left(4 + -6 \cdot 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) (+ 4.0 (* -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 x + ((y - x) * (4.0 + (-6.0 * 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) * (4.0d0 + ((-6.0d0) * 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) * (4.0 + (-6.0 * 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) * (4.0 + (-6.0 * 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(4.0 + Float64(-6.0 * 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) * (4.0 + (-6.0 * 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[(4.0 + N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
x + \left(y - x\right) \cdot \left(4 + -6 \cdot 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. 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 x + \color{blue}{\left(4 \cdot \left(y - x\right) + -6 \cdot \left(z \cdot \left(y - x\right)\right)\right)} \]
  4. Simplified0.3

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

    [Start]0.2

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

    rational.json-simplify-1 [=>]0.2

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

    rational.json-simplify-43 [=>]0.2

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

    rational.json-simplify-43 [=>]0.2

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

    rational.json-simplify-51 [=>]0.3

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

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

Alternatives

Alternative 1
Error32.0
Cost1508
\[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot x\right)\\ \mathbf{if}\;z \leq -0.98:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-68}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-207}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{-280}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-235}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-227}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-167}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-101}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error32.0
Cost1508
\[\begin{array}{l} \mathbf{if}\;z \leq -0.98:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{-68}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-207}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-279}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-236}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-227}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{-164}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-100}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(z \cdot x\right)\\ \end{array} \]
Alternative 3
Error32.0
Cost1504
\[\begin{array}{l} t_0 := x \cdot \left(-3 + 6 \cdot z\right)\\ t_1 := x + y \cdot \left(z \cdot -6\right)\\ \mathbf{if}\;z \leq -4.7 \cdot 10^{+21}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1 \cdot 10^{-68}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-207}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-280}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{-236}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-225}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-165}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+90}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error32.0
Cost1504
\[\begin{array}{l} t_0 := x \cdot \left(-3 + 6 \cdot z\right)\\ \mathbf{if}\;z \leq -4.4 \cdot 10^{+22}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot -6\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-68}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-207}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-280}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-238}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-228}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{-165}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{+89}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(z \cdot -6\right)\\ \end{array} \]
Alternative 5
Error13.0
Cost844
\[\begin{array}{l} \mathbf{if}\;z \leq -0.96:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot -6\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-9}:\\ \;\;\;\;4 \cdot y + x \cdot -3\\ \mathbf{elif}\;z \leq 9.2 \cdot 10^{+86}:\\ \;\;\;\;x \cdot \left(-3 + 6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(z \cdot -6\right)\\ \end{array} \]
Alternative 6
Error1.7
Cost840
\[\begin{array}{l} t_0 := x + -6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -0.66:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;4 \cdot y + x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error1.8
Cost840
\[\begin{array}{l} t_0 := \frac{\left(y - x\right) \cdot \left(z \cdot -12\right)}{2}\\ \mathbf{if}\;z \leq -0.58:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.64:\\ \;\;\;\;4 \cdot y + x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error22.6
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -61000:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq 2100000000000:\\ \;\;\;\;x \cdot \left(-3 + 6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;4 \cdot y\\ \end{array} \]
Alternative 9
Error0.4
Cost704
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right) \]
Alternative 10
Error33.9
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1 \cdot 10^{+64}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;x \leq 9.6 \cdot 10^{-20}:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \]
Alternative 11
Error43.2
Cost192
\[4 \cdot y \]
Alternative 12
Error62.4
Cost64
\[x \]

Error

Reproduce?

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