Average Error: 3.2 → 0.2
Time: 3.3s
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 -1 \cdot 10^{+266}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{elif}\;y \cdot z \leq 2 \cdot 10^{+177}:\\ \;\;\;\;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) -1e+266)
   (* y (* z (- x)))
   (if (<= (* y z) 2e+177) (* 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) <= -1e+266) {
		tmp = y * (z * -x);
	} else if ((y * z) <= 2e+177) {
		tmp = x * (1.0 - (y * z));
	} else {
		tmp = z * (y * -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) <= (-1d+266)) then
        tmp = y * (z * -x)
    else if ((y * z) <= 2d+177) then
        tmp = x * (1.0d0 - (y * z))
    else
        tmp = z * (y * -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) <= -1e+266) {
		tmp = y * (z * -x);
	} else if ((y * z) <= 2e+177) {
		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) <= -1e+266:
		tmp = y * (z * -x)
	elif (y * z) <= 2e+177:
		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) <= -1e+266)
		tmp = Float64(y * Float64(z * Float64(-x)));
	elseif (Float64(y * z) <= 2e+177)
		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) <= -1e+266)
		tmp = y * (z * -x);
	elseif ((y * z) <= 2e+177)
		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], -1e+266], N[(y * N[(z * (-x)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 2e+177], 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 -1 \cdot 10^{+266}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\

\mathbf{elif}\;y \cdot z \leq 2 \cdot 10^{+177}:\\
\;\;\;\;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) < -1e266

    1. Initial program 44.5

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

    if -1e266 < (*.f64 y z) < 2e177

    1. Initial program 0.1

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

    if 2e177 < (*.f64 y z)

    1. Initial program 21.2

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

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

      \[\leadsto {\left(\sqrt[3]{\color{blue}{-1 \cdot \left(y \cdot \left(z \cdot x\right)\right)}}\right)}^{3} \]
    4. Simplified2.0

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

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

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

Alternatives

Alternative 1
Error5.1
Cost712
\[\begin{array}{l} t_0 := x - y \cdot \left(z \cdot x\right)\\ \mathbf{if}\;y \leq -3.484440860789416 \cdot 10^{-221}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.4046233181426112 \cdot 10^{-112}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error16.7
Cost648
\[\begin{array}{l} t_0 := z \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{if}\;y \leq -3 \cdot 10^{+68}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.9102569696398738 \cdot 10^{-112}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error25.3
Cost64
\[x \]

Error

Reproduce

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