?

Average Accuracy: 99.4% → 99.7%
Time: 16.1s
Precision: binary64
Cost: 960

?

\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
\[\left(x + \left(y - x\right) \cdot \left(z \cdot -6\right)\right) + \left(y - x\right) \cdot 4 \]
(FPCore (x y z)
 :precision binary64
 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
(FPCore (x y z)
 :precision binary64
 (+ (+ x (* (- y x) (* z -6.0))) (* (- y x) 4.0)))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
double code(double x, double y, double z) {
	return (x + ((y - x) * (z * -6.0))) + ((y - x) * 4.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) * ((2.0d0 / 3.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) * (z * (-6.0d0)))) + ((y - x) * 4.0d0)
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
public static double code(double x, double y, double z) {
	return (x + ((y - x) * (z * -6.0))) + ((y - x) * 4.0);
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
def code(x, y, z):
	return (x + ((y - x) * (z * -6.0))) + ((y - x) * 4.0)
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z)))
end
function code(x, y, z)
	return Float64(Float64(x + Float64(Float64(y - x) * Float64(z * -6.0))) + Float64(Float64(y - x) * 4.0))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
end
function tmp = code(x, y, z)
	tmp = (x + ((y - x) * (z * -6.0))) + ((y - x) * 4.0);
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(x + N[(N[(y - x), $MachinePrecision] * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\left(x + \left(y - x\right) \cdot \left(z \cdot -6\right)\right) + \left(y - x\right) \cdot 4

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 99.4%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Simplified99.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)} \]
    Proof

    [Start]99.4

    \[ x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]

    +-commutative [=>]99.4

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

    associate-*l* [=>]99.6

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

    fma-def [=>]99.6

    \[ \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]

    sub-neg [=>]99.6

    \[ \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]

    distribute-lft-in [=>]99.7

    \[ \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \frac{2}{3} + 6 \cdot \left(-z\right)}, x\right) \]

    +-commutative [=>]99.7

    \[ \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]

    neg-mul-1 [=>]99.7

    \[ \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(-1 \cdot z\right)} + 6 \cdot \frac{2}{3}, x\right) \]

    associate-*r* [=>]99.7

    \[ \mathsf{fma}\left(y - x, \color{blue}{\left(6 \cdot -1\right) \cdot z} + 6 \cdot \frac{2}{3}, x\right) \]

    *-commutative [=>]99.7

    \[ \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(6 \cdot -1\right)} + 6 \cdot \frac{2}{3}, x\right) \]

    fma-def [=>]99.7

    \[ \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, 6 \cdot -1, 6 \cdot \frac{2}{3}\right)}, x\right) \]

    metadata-eval [=>]99.7

    \[ \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, \color{blue}{-6}, 6 \cdot \frac{2}{3}\right), x\right) \]

    metadata-eval [=>]99.7

    \[ \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]

    metadata-eval [=>]99.7

    \[ \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, \color{blue}{4}\right), x\right) \]
  3. Applied egg-rr99.7%

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

    [Start]99.7

    \[ \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right) \]

    fma-udef [=>]99.6

    \[ \color{blue}{\left(y - x\right) \cdot \mathsf{fma}\left(z, -6, 4\right) + x} \]

    +-commutative [=>]99.6

    \[ \color{blue}{x + \left(y - x\right) \cdot \mathsf{fma}\left(z, -6, 4\right)} \]

    fma-udef [=>]99.6

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

    distribute-lft-in [=>]99.7

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

    associate-+r+ [=>]99.7

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

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

Alternatives

Alternative 1
Accuracy49.5%
Cost1376
\[\begin{array}{l} t_0 := z \cdot \left(y \cdot -6\right)\\ \mathbf{if}\;z \leq -0.65:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2.45 \cdot 10^{-177}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-136}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-105}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-72}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.52:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{+155}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{+230}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
Alternative 2
Accuracy49.6%
Cost1376
\[\begin{array}{l} \mathbf{if}\;z \leq -0.65:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-177}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-136}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.7 \cdot 10^{-105}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3 \cdot 10^{-69}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.55:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+155}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{+223}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
Alternative 3
Accuracy67.0%
Cost1240
\[\begin{array}{l} t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -0.01:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{-179}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-136}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-105}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 9 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Accuracy67.0%
Cost1240
\[\begin{array}{l} t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -0.011:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{-179}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-136}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-106}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-72}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.6:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Accuracy66.9%
Cost1240
\[\begin{array}{l} \mathbf{if}\;z \leq -0.0048:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-178}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-136}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{-104}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 7 \cdot 10^{-69}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]
Alternative 6
Accuracy48.6%
Cost1112
\[\begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -44:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-177}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-136}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.3 \cdot 10^{-104}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Accuracy48.7%
Cost1112
\[\begin{array}{l} \mathbf{if}\;z \leq -40:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq -2.45 \cdot 10^{-177}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-136}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{-106}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-72}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
Alternative 8
Accuracy72.4%
Cost978
\[\begin{array}{l} \mathbf{if}\;y \leq -3.7 \cdot 10^{+120} \lor \neg \left(y \leq -4 \cdot 10^{+89}\right) \land \left(y \leq -1500000000 \lor \neg \left(y \leq 5.1 \cdot 10^{-53}\right)\right):\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
Alternative 9
Accuracy99.4%
Cost832
\[x + \frac{6 \cdot \left(0.6666666666666666 - z\right)}{\frac{1}{y - x}} \]
Alternative 10
Accuracy96.9%
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -0.56:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x + \left(y - x\right) \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]
Alternative 11
Accuracy99.4%
Cost704
\[x + \left(0.6666666666666666 - z\right) \cdot \left(\left(y - x\right) \cdot 6\right) \]
Alternative 12
Accuracy47.1%
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{-44}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;x \leq 3300:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \]
Alternative 13
Accuracy32.6%
Cost192
\[x \cdot -3 \]

Error

Reproduce?

herbie shell --seed 2023137 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D"
  :precision binary64
  (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))