Average Error: 3.2 → 1.6
Time: 4.5s
Precision: binary64
Cost: 708
\[ \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^{+291}:\\ \;\;\;\;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+291) (- 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+291) {
		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+291) 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+291) {
		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+291:
		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+291)
		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+291)
		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+291], 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^{+291}:\\
\;\;\;\;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 2 regimes
  2. if (*.f64 y z) < 5.0000000000000001e291

    1. Initial program 1.6

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

      \[\leadsto \color{blue}{x + x \cdot \left(y \cdot \left(-z\right)\right)} \]
    3. Applied egg-rr1.6

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

    if 5.0000000000000001e291 < (*.f64 y z)

    1. Initial program 51.9

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

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

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

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

Alternatives

Alternative 1
Error17.5
Cost648
\[\begin{array}{l} t_0 := y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{if}\;z \leq -6.896432240800852 \cdot 10^{-8}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{+126}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error25.3
Cost64
\[x \]

Error

Reproduce

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