?

Average Error: 0.2 → 0.2
Time: 8.8s
Precision: binary64
Cost: 576

?

\[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
\[x + 6 \cdot \left(z \cdot \left(y - x\right)\right) \]
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
(FPCore (x y z) :precision binary64 (+ x (* 6.0 (* z (- 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 + (6.0 * (z * (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 + (6.0d0 * (z * (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 + (6.0 * (z * (y - x)));
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * z)
def code(x, y, z):
	return x + (6.0 * (z * (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(6.0 * Float64(z * 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 + (6.0 * (z * (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[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
x + 6 \cdot \left(z \cdot \left(y - x\right)\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. Taylor expanded in z around 0 0.2

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

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

Alternatives

Alternative 1
Error7.7
Cost712
\[\begin{array}{l} t_0 := x + 6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;y \leq -5 \cdot 10^{-146}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-26}:\\ \;\;\;\;x + -6 \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error7.7
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{-146}:\\ \;\;\;\;x + 6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-26}:\\ \;\;\;\;x + -6 \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(z \cdot 6\right)\\ \end{array} \]
Alternative 3
Error7.8
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -8 \cdot 10^{-146}:\\ \;\;\;\;x + 6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;y \leq 2.35 \cdot 10^{-26}:\\ \;\;\;\;x + -6 \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(6 \cdot y\right) \cdot z\\ \end{array} \]
Alternative 4
Error24.2
Cost584
\[\begin{array}{l} t_0 := -6 \cdot \left(z \cdot x\right)\\ \mathbf{if}\;z \leq -0.17:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.165:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error23.4
Cost448
\[\left(1 + -6 \cdot z\right) \cdot x \]
Alternative 6
Error23.4
Cost448
\[x + -6 \cdot \left(z \cdot x\right) \]
Alternative 7
Error34.5
Cost64
\[x \]

Error

Reproduce?

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