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

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 0.2

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

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

Alternatives

Alternative 1
Error13.7
Cost978
\[\begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{-14} \lor \neg \left(z \leq -8.6 \cdot 10^{-78} \lor \neg \left(z \leq -2.6 \cdot 10^{-132}\right) \land z \leq 4.5 \cdot 10^{-36}\right):\\ \;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Error13.7
Cost978
\[\begin{array}{l} \mathbf{if}\;z \leq -7 \cdot 10^{-14} \lor \neg \left(z \leq -7 \cdot 10^{-78} \lor \neg \left(z \leq -2.4 \cdot 10^{-132}\right) \land z \leq 2.45 \cdot 10^{-37}\right):\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Error13.7
Cost976
\[\begin{array}{l} t_0 := z \cdot \left(\left(y - x\right) \cdot 6\right)\\ \mathbf{if}\;z \leq -2.2 \cdot 10^{-14}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-78}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-132}:\\ \;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-35}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error25.2
Cost849
\[\begin{array}{l} \mathbf{if}\;z \leq -300:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-84}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-132} \lor \neg \left(z \leq 2.8 \cdot 10^{-35}\right):\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error25.3
Cost849
\[\begin{array}{l} \mathbf{if}\;z \leq -300:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-78}:\\ \;\;\;\;x\\ \mathbf{elif}\;\neg \left(z \leq -2.6 \cdot 10^{-132}\right) \land z \leq 1.45 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(6 \cdot z\right)\\ \end{array} \]
Alternative 6
Error25.3
Cost849
\[\begin{array}{l} \mathbf{if}\;z \leq -300:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-78}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-132} \lor \neg \left(z \leq 9.2 \cdot 10^{-35}\right):\\ \;\;\;\;y \cdot \left(6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error25.3
Cost848
\[\begin{array}{l} \mathbf{if}\;z \leq -300:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-78}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-132}:\\ \;\;\;\;y \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \end{array} \]
Alternative 8
Error1.1
Cost844
\[\begin{array}{l} t_0 := z \cdot \left(\left(y - x\right) \cdot 6\right)\\ \mathbf{if}\;z \leq -300:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-7}:\\ \;\;\;\;x + y \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;z \leq 820:\\ \;\;\;\;x + z \cdot \left(x \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error1.1
Cost844
\[\begin{array}{l} t_0 := z \cdot \left(\left(y - x\right) \cdot 6\right)\\ \mathbf{if}\;z \leq -300:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 6.3 \cdot 10^{-7}:\\ \;\;\;\;x + z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq 820:\\ \;\;\;\;x + z \cdot \left(x \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 10
Error1.0
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -300 \lor \neg \left(z \leq 0.17\right):\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\ \end{array} \]
Alternative 11
Error1.0
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -300 \lor \neg \left(z \leq 0.17\right):\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(6 \cdot z\right)\\ \end{array} \]
Alternative 12
Error24.3
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -300 \lor \neg \left(z \leq 0.17\right):\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 13
Error35.2
Cost64
\[x \]

Error

Reproduce

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