?

Average Accuracy: 94.4% → 99.6%
Time: 6.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 5 \cdot 10^{+187}\right):\\ \;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right)\\ \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) 5e+187)))
   (* z (* y (- x)))
   (* x (- 1.0 (* y z)))))
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) <= 5e+187)) {
		tmp = z * (y * -x);
	} else {
		tmp = x * (1.0 - (y * z));
	}
	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) <= 5e+187)) {
		tmp = z * (y * -x);
	} else {
		tmp = x * (1.0 - (y * z));
	}
	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) <= 5e+187):
		tmp = z * (y * -x)
	else:
		tmp = x * (1.0 - (y * z))
	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) <= 5e+187))
		tmp = Float64(z * Float64(y * Float64(-x)));
	else
		tmp = Float64(x * Float64(1.0 - Float64(y * z)));
	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) <= 5e+187)))
		tmp = z * (y * -x);
	else
		tmp = x * (1.0 - (y * z));
	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], 5e+187]], $MachinePrecision]], N[(z * N[(y * (-x)), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $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 5 \cdot 10^{+187}\right):\\
\;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\

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


\end{array}

Error?

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 5.0000000000000001e187 < (*.f64 y z)

    1. Initial program 45.2%

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

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

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

      [Start]98.1

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

      mul-1-neg [=>]98.1

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

      associate-*r* [=>]45.2

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

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

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

      *-commutative [=>]45.2

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

      associate-*l* [=>]97.1

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

    if -inf.0 < (*.f64 y z) < 5.0000000000000001e187

    1. Initial program 99.8%

      \[x \cdot \left(1 - y \cdot z\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.6%

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

Alternatives

Alternative 1
Accuracy72.3%
Cost1176
\[\begin{array}{l} t_0 := y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{if}\;y \leq -1.05 \cdot 10^{+126}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2.6 \cdot 10^{+78}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -8.5 \cdot 10^{+48}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.16 \cdot 10^{+20}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -0.027:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-x\right)\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{-96}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Accuracy72.2%
Cost1176
\[\begin{array}{l} t_0 := z \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{if}\;y \leq -5.8 \cdot 10^{+127}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{elif}\;y \leq -3.7 \cdot 10^{+78}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -2 \cdot 10^{+48}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -5.6 \cdot 10^{+19}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -0.135:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-x\right)\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{-108}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Accuracy70.1%
Cost914
\[\begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{+130} \lor \neg \left(y \leq -2.05 \cdot 10^{+21}\right) \land \left(y \leq -0.94 \lor \neg \left(y \leq 5.8 \cdot 10^{-108}\right)\right):\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Accuracy59.8%
Cost64
\[x \]

Error

Reproduce?

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