Average Error: 3.3 → 0.1
Time: 2.5s
Precision: binary64
\[ \begin{array}{c}[y, z] = \mathsf{sort}([y, z])\\ \end{array} \]
\[x \cdot \left(1 - y \cdot z\right) \]
\[\begin{array}{l} t_0 := x - y \cdot \left(z \cdot x\right)\\ \mathbf{if}\;y \cdot z \leq -5 \cdot 10^{+272}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \cdot z \leq 4 \cdot 10^{+228}:\\ \;\;\;\;x - \left(y \cdot z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- x (* y (* z x)))))
   (if (<= (* y z) -5e+272)
     t_0
     (if (<= (* y z) 4e+228) (- x (* (* y z) x)) t_0))))
double code(double x, double y, double z) {
	return x * (1.0 - (y * z));
}
double code(double x, double y, double z) {
	double t_0 = x - (y * (z * x));
	double tmp;
	if ((y * z) <= -5e+272) {
		tmp = t_0;
	} else if ((y * z) <= 4e+228) {
		tmp = x - ((y * z) * x);
	} else {
		tmp = t_0;
	}
	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) :: t_0
    real(8) :: tmp
    t_0 = x - (y * (z * x))
    if ((y * z) <= (-5d+272)) then
        tmp = t_0
    else if ((y * z) <= 4d+228) then
        tmp = x - ((y * z) * x)
    else
        tmp = t_0
    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 t_0 = x - (y * (z * x));
	double tmp;
	if ((y * z) <= -5e+272) {
		tmp = t_0;
	} else if ((y * z) <= 4e+228) {
		tmp = x - ((y * z) * x);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	return x * (1.0 - (y * z))
def code(x, y, z):
	t_0 = x - (y * (z * x))
	tmp = 0
	if (y * z) <= -5e+272:
		tmp = t_0
	elif (y * z) <= 4e+228:
		tmp = x - ((y * z) * x)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	return Float64(x * Float64(1.0 - Float64(y * z)))
end
function code(x, y, z)
	t_0 = Float64(x - Float64(y * Float64(z * x)))
	tmp = 0.0
	if (Float64(y * z) <= -5e+272)
		tmp = t_0;
	elseif (Float64(y * z) <= 4e+228)
		tmp = Float64(x - Float64(Float64(y * z) * x));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp = code(x, y, z)
	tmp = x * (1.0 - (y * z));
end
function tmp_2 = code(x, y, z)
	t_0 = x - (y * (z * x));
	tmp = 0.0;
	if ((y * z) <= -5e+272)
		tmp = t_0;
	elseif ((y * z) <= 4e+228)
		tmp = x - ((y * z) * x);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(x - N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * z), $MachinePrecision], -5e+272], t$95$0, If[LessEqual[N[(y * z), $MachinePrecision], 4e+228], N[(x - N[(N[(y * z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
t_0 := x - y \cdot \left(z \cdot x\right)\\
\mathbf{if}\;y \cdot z \leq -5 \cdot 10^{+272}:\\
\;\;\;\;t_0\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\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) < -4.99999999999999973e272 or 3.9999999999999997e228 < (*.f64 y z)

    1. Initial program 38.8

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(z \cdot x\right)\right) + x} \]
    3. Taylor expanded in x around 0 38.8

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, y \cdot \left(-x\right), x\right)} \]
    5. Taylor expanded in z around 0 0.7

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

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

    if -4.99999999999999973e272 < (*.f64 y z) < 3.9999999999999997e228

    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} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

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

Reproduce

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