?

Average Accuracy: 94.4% → 99.7%
Time: 4.8s
Precision: binary64
Cost: 968

?

\[ \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:\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{elif}\;y \cdot z \leq 10^{+187}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\ \end{array} \]
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
 :precision binary64
 (if (<= (* y z) (- INFINITY))
   (* y (* z (- x)))
   (if (<= (* y z) 1e+187) (* x (- 1.0 (* y z))) (* z (* y (- 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)) {
		tmp = y * (z * -x);
	} else if ((y * z) <= 1e+187) {
		tmp = x * (1.0 - (y * z));
	} else {
		tmp = z * (y * -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) {
		tmp = y * (z * -x);
	} else if ((y * z) <= 1e+187) {
		tmp = x * (1.0 - (y * z));
	} else {
		tmp = z * (y * -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:
		tmp = y * (z * -x)
	elif (y * z) <= 1e+187:
		tmp = x * (1.0 - (y * z))
	else:
		tmp = z * (y * -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))
		tmp = Float64(y * Float64(z * Float64(-x)));
	elseif (Float64(y * z) <= 1e+187)
		tmp = Float64(x * Float64(1.0 - Float64(y * z)));
	else
		tmp = Float64(z * Float64(y * Float64(-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)
		tmp = y * (z * -x);
	elseif ((y * z) <= 1e+187)
		tmp = x * (1.0 - (y * z));
	else
		tmp = z * (y * -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[LessEqual[N[(y * z), $MachinePrecision], (-Infinity)], N[(y * N[(z * (-x)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 1e+187], N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * (-x)), $MachinePrecision]), $MachinePrecision]]]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -\infty:\\
\;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\

\mathbf{elif}\;y \cdot z \leq 10^{+187}:\\
\;\;\;\;x \cdot \left(1 - y \cdot z\right)\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

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

    1. Initial program 0.0%

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

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

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

      [Start]99.6

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

      mul-1-neg [=>]99.6

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

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

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

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

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

      *-commutative [=>]99.6

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

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

    1. Initial program 99.8%

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

    if 9.99999999999999907e186 < (*.f64 y z)

    1. Initial program 60.0%

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

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

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

      [Start]60.0

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

      *-commutative [=>]60.0

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

      distribute-rgt-out-- [<=]60.0

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

      associate-*r* [<=]97.3

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

      *-lft-identity [=>]97.3

      \[ \color{blue}{x} - y \cdot \left(z \cdot x\right) \]
    4. Taylor expanded in y around inf 97.3%

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

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

      [Start]97.3

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

      associate-*r* [=>]97.3

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

      neg-mul-1 [<=]97.3

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

      *-commutative [=>]97.3

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

      associate-*l* [<=]98.3

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

      *-commutative [=>]98.3

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

      distribute-lft-neg-out [=>]98.3

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

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

Alternatives

Alternative 1
Accuracy70.1%
Cost914
\[\begin{array}{l} \mathbf{if}\;y \leq -3.4 \cdot 10^{+176} \lor \neg \left(y \leq -2.25 \cdot 10^{+144} \lor \neg \left(y \leq -9.8 \cdot 10^{+118}\right) \land y \leq 3 \cdot 10^{-80}\right):\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Accuracy72.7%
Cost914
\[\begin{array}{l} \mathbf{if}\;y \leq -3.4 \cdot 10^{+176} \lor \neg \left(y \leq -1.05 \cdot 10^{+142}\right) \land \left(y \leq -1.22 \cdot 10^{+121} \lor \neg \left(y \leq 4.3 \cdot 10^{-73}\right)\right):\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Accuracy72.5%
Cost912
\[\begin{array}{l} t_0 := z \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{if}\;y \leq -3.4 \cdot 10^{+176}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2.6 \cdot 10^{+142}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -6.8 \cdot 10^{+119}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{-75}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Accuracy60.5%
Cost64
\[x \]

Error

Reproduce?

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