?

Average Accuracy: 95.0% → 99.7%
Time: 9.5s
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 -5 \cdot 10^{+209}:\\ \;\;\;\;z \cdot \left(-y \cdot x\right)\\ \mathbf{elif}\;y \cdot z \leq 4 \cdot 10^{+246}:\\ \;\;\;\;x - \left(y \cdot z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \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) -5e+209)
   (* z (- (* y x)))
   (if (<= (* y z) 4e+246) (- x (* (* y z) 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) <= -5e+209) {
		tmp = z * -(y * x);
	} else if ((y * z) <= 4e+246) {
		tmp = x - ((y * z) * x);
	} else {
		tmp = y * (z * -x);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x * (1.0d0 - (y * 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
    real(8) :: tmp
    if ((y * z) <= (-5d+209)) then
        tmp = z * -(y * x)
    else if ((y * z) <= 4d+246) then
        tmp = x - ((y * z) * x)
    else
        tmp = y * (z * -x)
    end if
    code = tmp
end function
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) <= -5e+209) {
		tmp = z * -(y * x);
	} else if ((y * z) <= 4e+246) {
		tmp = x - ((y * z) * x);
	} else {
		tmp = 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) <= -5e+209:
		tmp = z * -(y * x)
	elif (y * z) <= 4e+246:
		tmp = x - ((y * z) * x)
	else:
		tmp = 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) <= -5e+209)
		tmp = Float64(z * Float64(-Float64(y * x)));
	elseif (Float64(y * z) <= 4e+246)
		tmp = Float64(x - Float64(Float64(y * z) * x));
	else
		tmp = Float64(y * Float64(z * 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) <= -5e+209)
		tmp = z * -(y * x);
	elseif ((y * z) <= 4e+246)
		tmp = x - ((y * z) * x);
	else
		tmp = 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[LessEqual[N[(y * z), $MachinePrecision], -5e+209], N[(z * (-N[(y * x), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 4e+246], N[(x - N[(N[(y * z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(y * N[(z * (-x)), $MachinePrecision]), $MachinePrecision]]]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -5 \cdot 10^{+209}:\\
\;\;\;\;z \cdot \left(-y \cdot x\right)\\

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

\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \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) < -4.99999999999999964e209

    1. Initial program 54.2%

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

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

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

      [Start]54.2

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

      *-commutative [=>]54.2

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

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

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

      associate-*r* [<=]98.2

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

      *-lft-identity [=>]98.2

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

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

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

      [Start]98.2

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

      associate-*r* [=>]98.2

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

      neg-mul-1 [<=]98.2

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

      *-commutative [=>]98.2

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

      associate-*l* [<=]98.2

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

      *-commutative [=>]98.2

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

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

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

    if -4.99999999999999964e209 < (*.f64 y z) < 4.00000000000000027e246

    1. Initial program 99.8%

      \[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.8

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

      sub-neg [=>]99.8

      \[ 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 \]

    if 4.00000000000000027e246 < (*.f64 y z)

    1. Initial program 43.2%

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

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

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

      [Start]99.3

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

      mul-1-neg [=>]99.3

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

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

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

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

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

      *-commutative [=>]99.3

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

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

Alternatives

Alternative 1
Accuracy70.6%
Cost1179
\[\begin{array}{l} \mathbf{if}\;y \leq -1.08 \cdot 10^{+169} \lor \neg \left(y \leq -4.2 \cdot 10^{+108} \lor \neg \left(y \leq -3.1 \cdot 10^{+80}\right) \land \left(y \leq 8.8 \cdot 10^{-141} \lor \neg \left(y \leq 2.4 \cdot 10^{-123}\right) \land y \leq 5.2 \cdot 10^{-71}\right)\right):\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Accuracy72.8%
Cost1176
\[\begin{array}{l} t_0 := y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{if}\;y \leq -7.4 \cdot 10^{+168}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -3 \cdot 10^{+108}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{+77}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 8.8 \cdot 10^{-141}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-123}:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-x\right)\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-71}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Accuracy72.1%
Cost1176
\[\begin{array}{l} t_0 := z \cdot \left(-y \cdot x\right)\\ \mathbf{if}\;y \leq -7.4 \cdot 10^{+168}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2.05 \cdot 10^{+108}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{+77}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 8.8 \cdot 10^{-141}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-123}:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-x\right)\\ \mathbf{elif}\;y \leq 5.1 \cdot 10^{-51}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Accuracy99.7%
Cost968
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -5 \cdot 10^{+209}:\\ \;\;\;\;z \cdot \left(-y \cdot x\right)\\ \mathbf{elif}\;y \cdot z \leq 4 \cdot 10^{+246}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \]
Alternative 5
Accuracy60.0%
Cost64
\[x \]

Error

Reproduce?

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