?

Average Accuracy: 99.4% → 99.7%
Time: 15.7s
Precision: binary64
Cost: 960.00

?

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

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. Taylor expanded in x around -inf 99.7%

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

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

Alternatives

Alternative 1
Accuracy49.0%
Cost1905.00
\[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot x\right)\\ t_1 := -6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -2.8 \cdot 10^{+136}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{+126}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -900000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -8.8 \cdot 10^{-79}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{-139}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.7 \cdot 10^{-306}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-177}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-144}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{-78}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.62:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 3.45 \cdot 10^{+124} \lor \neg \left(z \leq 2.9 \cdot 10^{+150}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Accuracy48.9%
Cost1904.00
\[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot x\right)\\ t_1 := -6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -3.7 \cdot 10^{+136}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{+128}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -900000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-74}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -3.2 \cdot 10^{-139}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-305}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{-179}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-143}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-77}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.56:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+125}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{+149}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Accuracy49.0%
Cost1904.00
\[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot x\right)\\ \mathbf{if}\;z \leq -1.1 \cdot 10^{+136}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{+126}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -900000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.1 \cdot 10^{-77}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -9.4 \cdot 10^{-141}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-303}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-170}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-143}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-77}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+124}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+150}:\\ \;\;\;\;\left(-6 \cdot z\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Accuracy49.0%
Cost1904.00
\[\begin{array}{l} t_0 := z \cdot \left(x \cdot 6\right)\\ \mathbf{if}\;z \leq -2.5 \cdot 10^{+136}:\\ \;\;\;\;6 \cdot \left(z \cdot x\right)\\ \mathbf{elif}\;z \leq -5.4 \cdot 10^{+125}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -900000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{-74}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -7 \cdot 10^{-139}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.3 \cdot 10^{-307}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{-179}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-143}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-79}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.62:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{+125}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{+149}:\\ \;\;\;\;\left(-6 \cdot z\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Accuracy67.3%
Cost1768.00
\[\begin{array}{l} t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ t_1 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -950000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.85 \cdot 10^{-74}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -9.8 \cdot 10^{-140}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-308}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-171}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{-144}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 9.6 \cdot 10^{-79}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{-12}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 12500:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 24000000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Accuracy67.3%
Cost1768.00
\[\begin{array}{l} t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ t_1 := z \cdot \left(-6 \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -900000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-78}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.2 \cdot 10^{-141}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.7 \cdot 10^{-304}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-177}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-144}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-77}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-12}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 280000:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 27000000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Accuracy67.2%
Cost1768.00
\[\begin{array}{l} t_0 := \left(-6 \cdot z + 4\right) \cdot y\\ t_1 := z \cdot \left(-6 \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -1000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -5.6 \cdot 10^{-74}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -4 \cdot 10^{-139}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-307}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-170}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-143}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 3.05 \cdot 10^{-77}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-13}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5200:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 32000000:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Accuracy66.6%
Cost1504.00
\[\begin{array}{l} t_0 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -2.4 \cdot 10^{-6}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{-78}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-140}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-304}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{-175}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-143}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-78}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.55:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Accuracy67.0%
Cost1504.00
\[\begin{array}{l} t_0 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -950000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -4.8 \cdot 10^{-78}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{elif}\;z \leq -9 \cdot 10^{-140}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-306}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 2.95 \cdot 10^{-173}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{-143}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-78}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.58:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 10
Accuracy48.9%
Cost1376.00
\[\begin{array}{l} t_0 := -6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -2.4 \cdot 10^{-6}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.2 \cdot 10^{-78}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -7 \cdot 10^{-140}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.32 \cdot 10^{-307}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 7 \cdot 10^{-181}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-143}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-77}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3850:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 11
Accuracy97.2%
Cost713.00
\[\begin{array}{l} \mathbf{if}\;z \leq -0.58 \lor \neg \left(z \leq 0.6\right):\\ \;\;\;\;z \cdot \left(-6 \cdot \left(y - x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;4 \cdot y + x \cdot -3\\ \end{array} \]
Alternative 12
Accuracy99.4%
Cost704.00
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right) \]
Alternative 13
Accuracy99.6%
Cost704.00
\[x + \left(4 - \frac{z}{0.16666666666666666}\right) \cdot \left(y - x\right) \]
Alternative 14
Accuracy46.7%
Cost456.00
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{-14}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;x \leq 1.16 \cdot 10^{+86}:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \]
Alternative 15
Accuracy32.9%
Cost192.00
\[4 \cdot y \]

Error

Reproduce?

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