?

Average Error: 0.4 → 0.2
Time: 19.7s
Precision: binary64
Cost: 960

?

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

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

    [Start]0.2

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

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

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

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

Alternatives

Alternative 1
Error36.3
Cost1512
\[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot x\right)\\ t_1 := -6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;y \leq -4.6 \cdot 10^{+151}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq -5 \cdot 10^{+59}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.6 \cdot 10^{-32}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;y \leq -1.6 \cdot 10^{-48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{-117}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq -1.9 \cdot 10^{-139}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;y \leq -2.9 \cdot 10^{-161}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -3.3 \cdot 10^{-277}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;y \leq 6.6 \cdot 10^{-252}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{-80}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;4 \cdot y\\ \end{array} \]
Alternative 2
Error36.3
Cost1512
\[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot x\right)\\ \mathbf{if}\;y \leq -1.5 \cdot 10^{+151}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq -3.4 \cdot 10^{+59}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;y \leq -1.2 \cdot 10^{-30}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;y \leq -3.3 \cdot 10^{-48}:\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \mathbf{elif}\;y \leq -1.9 \cdot 10^{-117}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq -4.1 \cdot 10^{-144}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;y \leq -2.9 \cdot 10^{-161}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{-277}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{-252}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.25 \cdot 10^{-79}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;4 \cdot y\\ \end{array} \]
Alternative 3
Error36.4
Cost1512
\[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot x\right)\\ \mathbf{if}\;y \leq -1.5 \cdot 10^{+151}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq -7.3 \cdot 10^{+59}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;y \leq -2.2 \cdot 10^{-32}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;y \leq -3 \cdot 10^{-51}:\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{-118}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq -2 \cdot 10^{-144}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;y \leq -2.4 \cdot 10^{-161}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -3.5 \cdot 10^{-277}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;y \leq 2.02 \cdot 10^{-249}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-83}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;4 \cdot y\\ \end{array} \]
Alternative 4
Error21.1
Cost1372
\[\begin{array}{l} t_0 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -0.018:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{-220}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-286}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{-258}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-226}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-132}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.58:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error21.0
Cost1372
\[\begin{array}{l} \mathbf{if}\;z \leq -0.0082:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-220}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-286}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-259}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-228}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-132}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.62:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]
Alternative 6
Error20.8
Cost1372
\[\begin{array}{l} \mathbf{if}\;z \leq -0.0062:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-220}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-287}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-258}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-226}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-132}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 175000:\\ \;\;\;\;\left(4 + -6 \cdot z\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]
Alternative 7
Error32.1
Cost1244
\[\begin{array}{l} t_0 := -6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -24000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -6 \cdot 10^{-221}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{-286}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 2.55 \cdot 10^{-259}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-222}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-132}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.0088:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error18.2
Cost976
\[\begin{array}{l} t_0 := \left(6 \cdot z - 3\right) \cdot x\\ t_1 := \left(4 + -6 \cdot z\right) \cdot y\\ \mathbf{if}\;y \leq -2 \cdot 10^{+50}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -0.052:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.6 \cdot 10^{-118}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{-82}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error34.6
Cost720
\[\begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{+50}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-7}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-119}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-82}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;4 \cdot y\\ \end{array} \]
Alternative 10
Error1.9
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -0.56:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq 0.55:\\ \;\;\;\;4 \cdot y + x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]
Alternative 11
Error0.4
Cost704
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right) \]
Alternative 12
Error0.2
Cost704
\[x + \left(y - x\right) \cdot \left(4 + -6 \cdot z\right) \]
Alternative 13
Error43.6
Cost192
\[4 \cdot y \]
Alternative 14
Error62.3
Cost64
\[x \]

Error

Reproduce?

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