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

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.3
Target0.2
Herbie0.2
\[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. Applied egg-rr0.3

    \[\leadsto x + \color{blue}{\frac{6}{\frac{1}{y - x}}} \cdot z \]
  3. Applied egg-rr0.2

    \[\leadsto x + \color{blue}{\frac{z}{\frac{0.16666666666666666}{y - x}}} \]
  4. Final simplification0.2

    \[\leadsto x + \frac{z}{\frac{0.16666666666666666}{y - x}} \]

Alternatives

Alternative 1
Error25.7
Cost981
\[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -3.7 \cdot 10^{-78}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-119}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 10^{+109} \lor \neg \left(z \leq 8.6 \cdot 10^{+243}\right) \land z \leq 6.2 \cdot 10^{+273}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \end{array} \]
Alternative 2
Error12.2
Cost845
\[\begin{array}{l} \mathbf{if}\;z \leq 1.6 \cdot 10^{+106} \lor \neg \left(z \leq 4.6 \cdot 10^{+246}\right) \land z \leq 5.7 \cdot 10^{+293}:\\ \;\;\;\;x + y \cdot \left(z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \end{array} \]
Alternative 3
Error12.2
Cost717
\[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq 1.6 \cdot 10^{+109}:\\ \;\;\;\;x + t_0\\ \mathbf{elif}\;z \leq 3.35 \cdot 10^{+243} \lor \neg \left(z \leq 2.5 \cdot 10^{+269}\right):\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error7.8
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -5.4 \cdot 10^{-140}:\\ \;\;\;\;x + 6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-149}:\\ \;\;\;\;x + z \cdot \left(x \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(z \cdot 6\right)\\ \end{array} \]
Alternative 5
Error7.8
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -7.8 \cdot 10^{-140}:\\ \;\;\;\;x + 6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-153}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(z \cdot 6\right)\\ \end{array} \]
Alternative 6
Error24.1
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 620\right):\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error0.3
Cost576
\[x + z \cdot \left(\left(y - x\right) \cdot 6\right) \]
Alternative 8
Error0.2
Cost576
\[x + \left(y - x\right) \cdot \left(z \cdot 6\right) \]
Alternative 9
Error34.9
Cost64
\[x \]

Error

Reproduce

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