?

Average Error: 0.33% → 0.26%
Time: 8.3s
Precision: binary64
Cost: 576

?

\[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
\[x + \left(y - x\right) \cdot \left(6 \cdot z\right) \]
(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(y - x) * Float64(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[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
x + \left(y - x\right) \cdot \left(6 \cdot z\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation?

  1. Initial program 0.33

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

    \[\leadsto \color{blue}{x + \left(y - x\right) \cdot \left(6 \cdot z\right)} \]
    Proof

    [Start]0.33

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

    associate-*l* [=>]0.26

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

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

Alternatives

Alternative 1
Error37.56%
Cost848
\[\begin{array}{l} t_0 := 6 \cdot \left(y \cdot z\right)\\ t_1 := -6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -5.4 \cdot 10^{+70}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -0.00115:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 10^{-27}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 9.1 \cdot 10^{+105}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error37.59%
Cost848
\[\begin{array}{l} t_0 := y \cdot \left(6 \cdot z\right)\\ t_1 := -6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -1.85 \cdot 10^{+72}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -0.00115:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-26}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 3 \cdot 10^{+105}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error19.62%
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{-8} \lor \neg \left(z \leq 9.8 \cdot 10^{-29}\right):\\ \;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error1.73%
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 0.17\right):\\ \;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\ \end{array} \]
Alternative 5
Error19.61%
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -1.12 \cdot 10^{-8}:\\ \;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{-29}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\ \end{array} \]
Alternative 6
Error37.3%
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -0.00115 \lor \neg \left(z \leq 0.0125\right):\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error0.33%
Cost576
\[x + z \cdot \left(\left(y - x\right) \cdot 6\right) \]
Alternative 8
Error53.75%
Cost64
\[x \]

Error

Reproduce?

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