?

Average Error: 0.4 → 0.2
Time: 1.7min
Precision: binary64
Cost: 1024

?

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

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

Alternatives

Alternative 1
Error20.3
Cost1240
\[\begin{array}{l} t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ t_1 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -2750000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-45}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.76 \cdot 10^{-91}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-159}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{-41}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq 132000000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error20.3
Cost1240
\[\begin{array}{l} t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{if}\;z \leq -7600000:\\ \;\;\;\;\left(z \cdot -6\right) \cdot \left(y - x\right)\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{-45}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{-91}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq -1.04 \cdot 10^{-165}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.08 \cdot 10^{-41}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq 280000000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]
Alternative 3
Error20.3
Cost1240
\[\begin{array}{l} t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{if}\;z \leq -2750000:\\ \;\;\;\;\left(z \cdot -6\right) \cdot \left(y - x\right)\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{-44}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{-91}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq -4.25 \cdot 10^{-159}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-41}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq 140000000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\left(\left(y - x\right) \cdot -6\right) \cdot z\\ \end{array} \]
Alternative 4
Error20.2
Cost1240
\[\begin{array}{l} t_0 := \left(4 + -6 \cdot z\right) \cdot y\\ \mathbf{if}\;z \leq -2950000:\\ \;\;\;\;\left(z \cdot -6\right) \cdot \left(y - x\right)\\ \mathbf{elif}\;z \leq -1.08 \cdot 10^{-44}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{elif}\;z \leq -1.52 \cdot 10^{-91}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-157}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{-38}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq 225000000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\left(\left(y - x\right) \cdot -6\right) \cdot z\\ \end{array} \]
Alternative 5
Error19.8
Cost1240
\[\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 -1.16 \cdot 10^{+85}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -47000000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -3 \cdot 10^{-66}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.36 \cdot 10^{-153}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 0.96:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error20.6
Cost1108
\[\begin{array}{l} t_0 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -0.042:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -5.6 \cdot 10^{-45}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{-91}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq -2 \cdot 10^{-159}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;-3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error32.1
Cost980
\[\begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -0.66:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -9 \cdot 10^{-45}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -1.08 \cdot 10^{-91}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{-157}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.55:\\ \;\;\;\;-3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error32.1
Cost980
\[\begin{array}{l} \mathbf{if}\;z \leq -0.66:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.9 \cdot 10^{-44}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-91}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq -1.16 \cdot 10^{-164}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 132000000:\\ \;\;\;\;-3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(z \cdot x\right)\\ \end{array} \]
Alternative 9
Error32.1
Cost980
\[\begin{array}{l} \mathbf{if}\;z \leq -0.66:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{-44}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -1.9 \cdot 10^{-91}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{-159}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 132000000:\\ \;\;\;\;-3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]
Alternative 10
Error32.1
Cost980
\[\begin{array}{l} \mathbf{if}\;z \leq -0.66:\\ \;\;\;\;\left(-6 \cdot z\right) \cdot y\\ \mathbf{elif}\;z \leq -9.8 \cdot 10^{-45}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{-91}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq -1.02 \cdot 10^{-158}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 132000000:\\ \;\;\;\;-3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]
Alternative 11
Error32.1
Cost980
\[\begin{array}{l} \mathbf{if}\;z \leq -0.66:\\ \;\;\;\;\left(-6 \cdot z\right) \cdot y\\ \mathbf{elif}\;z \leq -2 \cdot 10^{-44}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -1.08 \cdot 10^{-91}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{-164}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 132000000:\\ \;\;\;\;-3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(6 \cdot x\right) \cdot z\\ \end{array} \]
Alternative 12
Error0.3
Cost960
\[x + \frac{\left(4 \cdot \left(y - x\right)\right) \cdot \left(\left(-0.6666666666666666 + z\right) \cdot -0.6666666666666666\right)}{0.4444444444444444} \]
Alternative 13
Error0.2
Cost960
\[4 \cdot \left(y - x\right) + \left(-6 \cdot \left(z \cdot \left(y - x\right)\right) + x\right) \]
Alternative 14
Error0.4
Cost832
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
Alternative 15
Error35.1
Cost720
\[\begin{array}{l} \mathbf{if}\;y \leq -3.4 \cdot 10^{+127}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq -5.645 \cdot 10^{-11}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;y \leq -3.7 \cdot 10^{-68}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq 0.46:\\ \;\;\;\;-3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;4 \cdot y\\ \end{array} \]
Alternative 16
Error1.9
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -0.6:\\ \;\;\;\;\left(z \cdot -6\right) \cdot \left(y - x\right)\\ \mathbf{elif}\;z \leq 0.55:\\ \;\;\;\;-3 \cdot x + 4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(\left(y - x\right) \cdot -6\right) \cdot z\\ \end{array} \]
Alternative 17
Error0.4
Cost704
\[x + \left(\left(0.6666666666666666 - z\right) \cdot \left(y - x\right)\right) \cdot 6 \]
Alternative 18
Error43.1
Cost192
\[-3 \cdot x \]

Error

Reproduce?

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