Average Error: 2.9 → 1.6
Time: 20.8s
Precision: binary64
Cost: 772
\[x \cdot \left(1 - y \cdot z\right) \]
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -\infty:\\ \;\;\;\;-\left(z \cdot x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(-\left(y \cdot z\right) \cdot x\right) + x\\ \end{array} \]
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
 :precision binary64
 (if (<= (* y z) (- INFINITY)) (- (* (* z x) y)) (+ (- (* (* y z) x)) 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 * x) * y);
	} else {
		tmp = -((y * z) * x) + 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 * x) * y);
	} else {
		tmp = -((y * z) * x) + 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 * x) * y)
	else:
		tmp = -((y * z) * x) + 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(-Float64(Float64(z * x) * y));
	else
		tmp = Float64(Float64(-Float64(Float64(y * z) * x)) + 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 * x) * y);
	else
		tmp = -((y * z) * x) + 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[(N[(z * x), $MachinePrecision] * y), $MachinePrecision]), N[((-N[(N[(y * z), $MachinePrecision] * x), $MachinePrecision]) + x), $MachinePrecision]]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -\infty:\\
\;\;\;\;-\left(z \cdot x\right) \cdot y\\

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


\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

    1. Initial program 64.0

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

      \[\leadsto \color{blue}{\left(-\left(y \cdot z\right) \cdot x\right) + x} \]
    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.3

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

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

    1. Initial program 1.6

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

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

Alternatives

Alternative 1
Error4.7
Cost904
\[\begin{array}{l} t_0 := -\left(x \cdot y\right) \cdot z\\ \mathbf{if}\;y \cdot z \leq -1000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \cdot z \leq 10^{-7}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error1.6
Cost708
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -\infty:\\ \;\;\;\;-\left(z \cdot x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right)\\ \end{array} \]
Alternative 3
Error25.5
Cost64
\[x \]

Error

Reproduce

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