Average Error: 0.3 → 0.3
Time: 6.8s
Precision: binary64
Cost: 576
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * z);
}
double code(double x, double y, double z) {
	return x + (((y - x) * 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) * 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) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * z);
}
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * z);
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * z)
def code(x, y, z):
	return x + (((y - x) * 6.0) * z)
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z))
end
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * z);
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * z);
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
x + \left(\left(y - x\right) \cdot 6\right) \cdot z

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.3
Target0.2
Herbie0.3
\[x - \left(6 \cdot z\right) \cdot \left(x - y\right) \]

Derivation

  1. Initial program 0.3

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
  2. Final simplification0.3

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

Alternatives

Alternative 1
Error12.2
Cost1240
\[\begin{array}{l} t_0 := 6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -9.2 \cdot 10^{-8}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-42}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-57}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 7 \cdot 10^{-96}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{-68}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-16}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error12.3
Cost1240
\[\begin{array}{l} t_0 := x \cdot \left(1 + z \cdot -6\right)\\ t_1 := 6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -0.155:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -4.7 \cdot 10^{-42}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{-55}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-95}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-68}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-17}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error23.4
Cost1112
\[\begin{array}{l} t_0 := 6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -9.2 \cdot 10^{-8}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-42}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{-55}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.12 \cdot 10^{-97}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-68}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-13}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error23.4
Cost1112
\[\begin{array}{l} t_0 := 6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -6.5 \cdot 10^{-7}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{-42}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -2.7 \cdot 10^{-55}:\\ \;\;\;\;y \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-95}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-68}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-14}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error23.5
Cost1112
\[\begin{array}{l} t_0 := z \cdot \left(y \cdot 6\right)\\ \mathbf{if}\;z \leq -1.05 \cdot 10^{-7}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-42}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-57}:\\ \;\;\;\;y \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-95}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-67}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-12}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error1.1
Cost712
\[\begin{array}{l} t_0 := 6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -0.38:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.00078:\\ \;\;\;\;x + y \cdot \frac{z}{0.16666666666666666}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error1.2
Cost712
\[\begin{array}{l} t_0 := 6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -235000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.00078:\\ \;\;\;\;x + z \cdot \left(y \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error24.0
Cost584
\[\begin{array}{l} t_0 := -6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -0.38:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.00078:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error34.5
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022331 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
  :precision binary64

  :herbie-target
  (- x (* (* 6.0 z) (- x y)))

  (+ x (* (* (- y x) 6.0) z)))