?

Average Accuracy: 96.0% → 99.8%
Time: 5.9s
Precision: binary64
Cost: 969

?

\[ \begin{array}{c}[y, z] = \mathsf{sort}([y, z])\\ \end{array} \]
\[x \cdot \left(1 - y \cdot z\right) \]
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -\infty \lor \neg \left(y \cdot z \leq 2 \cdot 10^{+186}\right):\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x - \left(y \cdot z\right) \cdot x\\ \end{array} \]
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
 :precision binary64
 (if (or (<= (* y z) (- INFINITY)) (not (<= (* y z) 2e+186)))
   (* y (* z (- x)))
   (- x (* (* y z) x))))
double code(double x, double y, double z) {
	return x * (1.0 - (y * z));
}
double code(double x, double y, double z) {
	double tmp;
	if (((y * z) <= -((double) INFINITY)) || !((y * z) <= 2e+186)) {
		tmp = y * (z * -x);
	} else {
		tmp = x - ((y * z) * x);
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	return x * (1.0 - (y * z));
}
public static double code(double x, double y, double z) {
	double tmp;
	if (((y * z) <= -Double.POSITIVE_INFINITY) || !((y * z) <= 2e+186)) {
		tmp = y * (z * -x);
	} else {
		tmp = x - ((y * z) * x);
	}
	return tmp;
}
def code(x, y, z):
	return x * (1.0 - (y * z))
def code(x, y, z):
	tmp = 0
	if ((y * z) <= -math.inf) or not ((y * z) <= 2e+186):
		tmp = y * (z * -x)
	else:
		tmp = x - ((y * z) * x)
	return tmp
function code(x, y, z)
	return Float64(x * Float64(1.0 - Float64(y * z)))
end
function code(x, y, z)
	tmp = 0.0
	if ((Float64(y * z) <= Float64(-Inf)) || !(Float64(y * z) <= 2e+186))
		tmp = Float64(y * Float64(z * Float64(-x)));
	else
		tmp = Float64(x - Float64(Float64(y * z) * x));
	end
	return tmp
end
function tmp = code(x, y, z)
	tmp = x * (1.0 - (y * z));
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (((y * z) <= -Inf) || ~(((y * z) <= 2e+186)))
		tmp = y * (z * -x);
	else
		tmp = x - ((y * z) * x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := If[Or[LessEqual[N[(y * z), $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[(y * z), $MachinePrecision], 2e+186]], $MachinePrecision]], N[(y * N[(z * (-x)), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -\infty \lor \neg \left(y \cdot z \leq 2 \cdot 10^{+186}\right):\\
\;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x - \left(y \cdot z\right) \cdot x\\


\end{array}

Error?

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 2 regimes
  2. if (*.f64 y z) < -inf.0 or 1.99999999999999996e186 < (*.f64 y z)

    1. Initial program 76.6%

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Taylor expanded in y around inf 99.8%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(z \cdot x\right)\right)} \]
    3. Simplified99.8%

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

      [Start]99.8

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

      mul-1-neg [=>]99.8

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

      distribute-rgt-neg-in [=>]99.8

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

      distribute-lft-neg-out [<=]99.8

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

      *-commutative [=>]99.8

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

    if -inf.0 < (*.f64 y z) < 1.99999999999999996e186

    1. Initial program 99.9%

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Applied egg-rr99.9%

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

      [Start]99.9

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

      sub-neg [=>]99.9

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

      distribute-rgt-in [=>]99.9

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

      *-un-lft-identity [<=]99.9

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

      distribute-rgt-neg-in [=>]99.9

      \[ x + \color{blue}{\left(y \cdot \left(-z\right)\right)} \cdot x \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \leq -\infty \lor \neg \left(y \cdot z \leq 2 \cdot 10^{+186}\right):\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x - \left(y \cdot z\right) \cdot x\\ \end{array} \]

Alternatives

Alternative 1
Accuracy99.8%
Cost969
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -\infty \lor \neg \left(y \cdot z \leq 2 \cdot 10^{+186}\right):\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right)\\ \end{array} \]
Alternative 2
Accuracy73.3%
Cost649
\[\begin{array}{l} \mathbf{if}\;z \leq -1.32 \cdot 10^{-81} \lor \neg \left(z \leq 1.6 \cdot 10^{+16}\right):\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Accuracy75.3%
Cost649
\[\begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{-86} \lor \neg \left(z \leq 3700000000000\right):\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Accuracy75.2%
Cost648
\[\begin{array}{l} \mathbf{if}\;z \leq -1.35 \cdot 10^{-76}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+14}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\ \end{array} \]
Alternative 5
Accuracy51.8%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023160 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
  :precision binary64
  (* x (- 1.0 (* y z))))