?

Average Accuracy: 99.6% → 99.7%
Time: 7.7s
Precision: binary64
Cost: 832

?

\[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
\[x + \left(-6 \cdot \left(x \cdot z\right) + 6 \cdot \left(z \cdot y\right)\right) \]
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
(FPCore (x y z) :precision binary64 (+ x (+ (* -6.0 (* x z)) (* 6.0 (* z y)))))
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 + ((-6.0 * (x * z)) + (6.0 * (z * y)));
}
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 + (((-6.0d0) * (x * z)) + (6.0d0 * (z * y)))
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 + ((-6.0 * (x * z)) + (6.0 * (z * y)));
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * z)
def code(x, y, z):
	return x + ((-6.0 * (x * z)) + (6.0 * (z * y)))
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(-6.0 * Float64(x * z)) + Float64(6.0 * Float64(z * y))))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * z);
end
function tmp = code(x, y, z)
	tmp = x + ((-6.0 * (x * z)) + (6.0 * (z * y)));
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[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
x + \left(-6 \cdot \left(x \cdot z\right) + 6 \cdot \left(z \cdot y\right)\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original99.6%
Target99.7%
Herbie99.7%
\[x - \left(6 \cdot z\right) \cdot \left(x - y\right) \]

Derivation?

  1. Initial program 99.6%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
  2. Taylor expanded in y around 0 99.7%

    \[\leadsto x + \color{blue}{\left(-6 \cdot \left(z \cdot x\right) + 6 \cdot \left(y \cdot z\right)\right)} \]
  3. Final simplification99.7%

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

Alternatives

Alternative 1
Accuracy87.8%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{-11} \lor \neg \left(y \leq 5.7 \cdot 10^{-61}\right):\\ \;\;\;\;x + 6 \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \end{array} \]
Alternative 2
Accuracy61.2%
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -33000000000 \lor \neg \left(z \leq 1.4 \cdot 10^{-19}\right):\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Accuracy99.6%
Cost576
\[x + z \cdot \left(6 \cdot \left(y - x\right)\right) \]
Alternative 4
Accuracy99.7%
Cost576
\[x + \left(y - x\right) \cdot \left(z \cdot 6\right) \]
Alternative 5
Accuracy63.0%
Cost448
\[x \cdot \left(-6 \cdot z + 1\right) \]
Alternative 6
Accuracy63.1%
Cost448
\[x + -6 \cdot \left(x \cdot z\right) \]
Alternative 7
Accuracy45.1%
Cost64
\[x \]

Error

Reproduce?

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