Average Error: 3.2 → 0.1
Time: 10.0s
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:\\ \;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+214}:\\ \;\;\;\;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) (- INFINITY))
   (* z (* y (- x)))
   (if (<= (* y z) 5e+214) (- 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) <= -((double) INFINITY)) {
		tmp = z * (y * -x);
	} else if ((y * z) <= 5e+214) {
		tmp = x - ((y * z) * x);
	} else {
		tmp = 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) {
		tmp = z * (y * -x);
	} else if ((y * z) <= 5e+214) {
		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) <= -math.inf:
		tmp = z * (y * -x)
	elif (y * z) <= 5e+214:
		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) <= Float64(-Inf))
		tmp = Float64(z * Float64(y * Float64(-x)));
	elseif (Float64(y * z) <= 5e+214)
		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) <= -Inf)
		tmp = z * (y * -x);
	elseif ((y * z) <= 5e+214)
		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], (-Infinity)], N[(z * N[(y * (-x)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 5e+214], 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 -\infty:\\
\;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\

\mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+214}:\\
\;\;\;\;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) < -inf.0

    1. Initial program 64.0

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Applied egg-rr64.0

      \[\leadsto \color{blue}{\sqrt[3]{{\left(x \cdot \left(1 - y \cdot z\right)\right)}^{3}}} \]
    3. Taylor expanded in y around inf 0.3

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

      \[\leadsto \color{blue}{z \cdot \left(-y \cdot x\right)} \]
      Proof
      (*.f64 z (neg.f64 (*.f64 y x))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 z (*.f64 y x)))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 z y) x))): 53 points increase in error, 51 points decrease in error
      (neg.f64 (*.f64 (Rewrite<= *-commutative_binary64 (*.f64 y z)) x)): 0 points increase in error, 0 points decrease in error
      (neg.f64 (Rewrite<= associate-*r*_binary64 (*.f64 y (*.f64 z x)))): 51 points increase in error, 52 points decrease in error
      (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (*.f64 y (*.f64 z x)))): 0 points increase in error, 0 points decrease in error

    if -inf.0 < (*.f64 y z) < 4.99999999999999953e214

    1. Initial program 0.1

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

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

    if 4.99999999999999953e214 < (*.f64 y z)

    1. Initial program 30.3

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

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

      \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(-x\right)} \]
      Proof
      (*.f64 (*.f64 y z) (neg.f64 x)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 (*.f64 y z) x))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (Rewrite<= associate-*r*_binary64 (*.f64 y (*.f64 z x)))): 51 points increase in error, 52 points decrease in error
      (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (*.f64 y (*.f64 z x)))): 0 points increase in error, 0 points decrease in error
    4. Taylor expanded in y around 0 1.1

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

      \[\leadsto \color{blue}{y \cdot \left(-z \cdot x\right)} \]
      Proof
      (*.f64 y (neg.f64 (*.f64 z x))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 y (*.f64 z x)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (*.f64 y (*.f64 z x)))): 0 points increase in error, 0 points decrease in error
  3. Recombined 3 regimes into one program.
  4. Final simplification0.1

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

Alternatives

Alternative 1
Error0.9
Cost2204
\[\begin{array}{l} t_0 := \left(y \cdot z\right) \cdot \left(-x\right)\\ t_1 := x - z \cdot \left(y \cdot x\right)\\ t_2 := z \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{if}\;y \cdot z \leq -\infty:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \cdot z \leq -2 \cdot 10^{+18}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \cdot z \leq -2 \cdot 10^{-16}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \cdot z \leq 4 \cdot 10^{-10}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \cdot z \leq 0.25:\\ \;\;\;\;x - y \cdot \left(z \cdot x\right)\\ \mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+15}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \cdot z \leq 10^{+271}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error0.9
Cost1944
\[\begin{array}{l} t_0 := \left(y \cdot z\right) \cdot \left(-x\right)\\ t_1 := x - y \cdot \left(z \cdot x\right)\\ \mathbf{if}\;y \cdot z \leq -\infty:\\ \;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{elif}\;y \cdot z \leq -4000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \cdot z \leq -1 \cdot 10^{-11}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \cdot z \leq 4 \cdot 10^{-10}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+15}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+214}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \]
Alternative 3
Error1.8
Cost1424
\[\begin{array}{l} t_0 := \left(y \cdot z\right) \cdot \left(-x\right)\\ \mathbf{if}\;y \cdot z \leq -\infty:\\ \;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{elif}\;y \cdot z \leq -1000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \cdot z \leq 0.5:\\ \;\;\;\;x\\ \mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+214}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \]
Alternative 4
Error0.2
Cost968
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -\infty:\\ \;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+214}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \]
Alternative 5
Error17.0
Cost648
\[\begin{array}{l} t_0 := z \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{if}\;z \leq -4.4458117478069495 \cdot 10^{-55}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{+37}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error25.1
Cost64
\[x \]

Error

Reproduce

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