Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J

Percentage Accurate: 96.0% → 98.0%
Time: 8.9s
Alternatives: 11
Speedup: 0.5×

Specification

?
\[\begin{array}{l} \\ x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \end{array} \]
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z))))
double code(double x, double y, double z) {
	return x * (1.0 - ((1.0 - y) * z));
}
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 - ((1.0d0 - y) * z))
end function
public static double code(double x, double y, double z) {
	return x * (1.0 - ((1.0 - y) * z));
}
def code(x, y, z):
	return x * (1.0 - ((1.0 - y) * z))
function code(x, y, z)
	return Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z)))
end
function tmp = code(x, y, z)
	tmp = x * (1.0 - ((1.0 - y) * z));
end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 96.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \end{array} \]
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* (- 1.0 y) z))))
double code(double x, double y, double z) {
	return x * (1.0 - ((1.0 - y) * z));
}
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 - ((1.0d0 - y) * z))
end function
public static double code(double x, double y, double z) {
	return x * (1.0 - ((1.0 - y) * z));
}
def code(x, y, z):
	return x * (1.0 - ((1.0 - y) * z))
function code(x, y, z)
	return Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z)))
end
function tmp = code(x, y, z)
	tmp = x * (1.0 - ((1.0 - y) * z));
end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\end{array}

Alternative 1: 98.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(1 - y\right) \cdot z \leq -1 \cdot 10^{+215}:\\ \;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot \left(z \cdot \left(y + -1\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= (* (- 1.0 y) z) -1e+215)
   (* (* z x) (+ y -1.0))
   (+ x (* x (* z (+ y -1.0))))))
double code(double x, double y, double z) {
	double tmp;
	if (((1.0 - y) * z) <= -1e+215) {
		tmp = (z * x) * (y + -1.0);
	} else {
		tmp = x + (x * (z * (y + -1.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
    real(8) :: tmp
    if (((1.0d0 - y) * z) <= (-1d+215)) then
        tmp = (z * x) * (y + (-1.0d0))
    else
        tmp = x + (x * (z * (y + (-1.0d0))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (((1.0 - y) * z) <= -1e+215) {
		tmp = (z * x) * (y + -1.0);
	} else {
		tmp = x + (x * (z * (y + -1.0)));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if ((1.0 - y) * z) <= -1e+215:
		tmp = (z * x) * (y + -1.0)
	else:
		tmp = x + (x * (z * (y + -1.0)))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (Float64(Float64(1.0 - y) * z) <= -1e+215)
		tmp = Float64(Float64(z * x) * Float64(y + -1.0));
	else
		tmp = Float64(x + Float64(x * Float64(z * Float64(y + -1.0))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (((1.0 - y) * z) <= -1e+215)
		tmp = (z * x) * (y + -1.0);
	else
		tmp = x + (x * (z * (y + -1.0)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], -1e+215], N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(z * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left(1 - y\right) \cdot z \leq -1 \cdot 10^{+215}:\\
\;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (-.f64 #s(literal 1 binary64) y) z) < -9.99999999999999907e214

    1. Initial program 78.3%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 78.3%

      \[\leadsto \color{blue}{x \cdot \left(z \cdot \left(y - 1\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*99.9%

        \[\leadsto \color{blue}{\left(x \cdot z\right) \cdot \left(y - 1\right)} \]
      2. *-commutative99.9%

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

        \[\leadsto \left(z \cdot x\right) \cdot \color{blue}{\left(y + \left(-1\right)\right)} \]
      4. metadata-eval99.9%

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

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

    if -9.99999999999999907e214 < (*.f64 (-.f64 #s(literal 1 binary64) y) z)

    1. Initial program 98.6%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 98.6%

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

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

Alternative 2: 98.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(1 - y\right) \cdot z \leq -1 \cdot 10^{+215}:\\ \;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 + z \cdot \left(y + -1\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= (* (- 1.0 y) z) -1e+215)
   (* (* z x) (+ y -1.0))
   (* x (+ 1.0 (* z (+ y -1.0))))))
double code(double x, double y, double z) {
	double tmp;
	if (((1.0 - y) * z) <= -1e+215) {
		tmp = (z * x) * (y + -1.0);
	} else {
		tmp = x * (1.0 + (z * (y + -1.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
    real(8) :: tmp
    if (((1.0d0 - y) * z) <= (-1d+215)) then
        tmp = (z * x) * (y + (-1.0d0))
    else
        tmp = x * (1.0d0 + (z * (y + (-1.0d0))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (((1.0 - y) * z) <= -1e+215) {
		tmp = (z * x) * (y + -1.0);
	} else {
		tmp = x * (1.0 + (z * (y + -1.0)));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if ((1.0 - y) * z) <= -1e+215:
		tmp = (z * x) * (y + -1.0)
	else:
		tmp = x * (1.0 + (z * (y + -1.0)))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (Float64(Float64(1.0 - y) * z) <= -1e+215)
		tmp = Float64(Float64(z * x) * Float64(y + -1.0));
	else
		tmp = Float64(x * Float64(1.0 + Float64(z * Float64(y + -1.0))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (((1.0 - y) * z) <= -1e+215)
		tmp = (z * x) * (y + -1.0);
	else
		tmp = x * (1.0 + (z * (y + -1.0)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], -1e+215], N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(z * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left(1 - y\right) \cdot z \leq -1 \cdot 10^{+215}:\\
\;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (-.f64 #s(literal 1 binary64) y) z) < -9.99999999999999907e214

    1. Initial program 78.3%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 78.3%

      \[\leadsto \color{blue}{x \cdot \left(z \cdot \left(y - 1\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*99.9%

        \[\leadsto \color{blue}{\left(x \cdot z\right) \cdot \left(y - 1\right)} \]
      2. *-commutative99.9%

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

        \[\leadsto \left(z \cdot x\right) \cdot \color{blue}{\left(y + \left(-1\right)\right)} \]
      4. metadata-eval99.9%

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

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

    if -9.99999999999999907e214 < (*.f64 (-.f64 #s(literal 1 binary64) y) z)

    1. Initial program 98.6%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification98.8%

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

Alternative 3: 98.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -240 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot \left(y \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -240.0) (not (<= z 1.0)))
   (* (* z x) (+ y -1.0))
   (+ x (* x (* y z)))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -240.0) || !(z <= 1.0)) {
		tmp = (z * x) * (y + -1.0);
	} else {
		tmp = x + (x * (y * z));
	}
	return tmp;
}
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 ((z <= (-240.0d0)) .or. (.not. (z <= 1.0d0))) then
        tmp = (z * x) * (y + (-1.0d0))
    else
        tmp = x + (x * (y * z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -240.0) || !(z <= 1.0)) {
		tmp = (z * x) * (y + -1.0);
	} else {
		tmp = x + (x * (y * z));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -240.0) or not (z <= 1.0):
		tmp = (z * x) * (y + -1.0)
	else:
		tmp = x + (x * (y * z))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -240.0) || !(z <= 1.0))
		tmp = Float64(Float64(z * x) * Float64(y + -1.0));
	else
		tmp = Float64(x + Float64(x * Float64(y * z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -240.0) || ~((z <= 1.0)))
		tmp = (z * x) * (y + -1.0);
	else
		tmp = x + (x * (y * z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -240.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -240 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -240 or 1 < z

    1. Initial program 91.3%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 90.2%

      \[\leadsto \color{blue}{x \cdot \left(z \cdot \left(y - 1\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*98.7%

        \[\leadsto \color{blue}{\left(x \cdot z\right) \cdot \left(y - 1\right)} \]
      2. *-commutative98.7%

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

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

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

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

    if -240 < z < 1

    1. Initial program 99.9%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 99.9%

      \[\leadsto \color{blue}{x + x \cdot \left(z \cdot \left(y - 1\right)\right)} \]
    4. Taylor expanded in y around inf 97.3%

      \[\leadsto x + x \cdot \color{blue}{\left(y \cdot z\right)} \]
    5. Step-by-step derivation
      1. *-commutative97.3%

        \[\leadsto x + x \cdot \color{blue}{\left(z \cdot y\right)} \]
    6. Simplified97.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -240 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot \left(y \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 85.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6.1 \cdot 10^{+85}:\\ \;\;\;\;z \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;y \leq 15600000000000:\\ \;\;\;\;x - z \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -6.1e+85)
   (* z (* y x))
   (if (<= y 15600000000000.0) (- x (* z x)) (* (* z x) (+ y -1.0)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -6.1e+85) {
		tmp = z * (y * x);
	} else if (y <= 15600000000000.0) {
		tmp = x - (z * x);
	} else {
		tmp = (z * x) * (y + -1.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
    real(8) :: tmp
    if (y <= (-6.1d+85)) then
        tmp = z * (y * x)
    else if (y <= 15600000000000.0d0) then
        tmp = x - (z * x)
    else
        tmp = (z * x) * (y + (-1.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -6.1e+85) {
		tmp = z * (y * x);
	} else if (y <= 15600000000000.0) {
		tmp = x - (z * x);
	} else {
		tmp = (z * x) * (y + -1.0);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -6.1e+85:
		tmp = z * (y * x)
	elif y <= 15600000000000.0:
		tmp = x - (z * x)
	else:
		tmp = (z * x) * (y + -1.0)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -6.1e+85)
		tmp = Float64(z * Float64(y * x));
	elseif (y <= 15600000000000.0)
		tmp = Float64(x - Float64(z * x));
	else
		tmp = Float64(Float64(z * x) * Float64(y + -1.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -6.1e+85)
		tmp = z * (y * x);
	elseif (y <= 15600000000000.0)
		tmp = x - (z * x);
	else
		tmp = (z * x) * (y + -1.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -6.1e+85], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 15600000000000.0], N[(x - N[(z * x), $MachinePrecision]), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.1 \cdot 10^{+85}:\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\

\mathbf{elif}\;y \leq 15600000000000:\\
\;\;\;\;x - z \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.09999999999999981e85

    1. Initial program 89.6%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 81.5%

      \[\leadsto \color{blue}{x \cdot \left(y \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutative81.5%

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot x} \]
      2. *-commutative81.5%

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot x \]
      3. associate-*l*87.6%

        \[\leadsto \color{blue}{z \cdot \left(y \cdot x\right)} \]
    5. Simplified87.6%

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

    if -6.09999999999999981e85 < y < 1.56e13

    1. Initial program 99.9%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 100.0%

      \[\leadsto \color{blue}{x + x \cdot \left(z \cdot \left(y - 1\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*100.0%

        \[\leadsto x + \color{blue}{\left(x \cdot z\right) \cdot \left(y - 1\right)} \]
      2. *-commutative100.0%

        \[\leadsto x + \color{blue}{\left(z \cdot x\right)} \cdot \left(y - 1\right) \]
      3. sub-neg100.0%

        \[\leadsto x + \left(z \cdot x\right) \cdot \color{blue}{\left(y + \left(-1\right)\right)} \]
      4. metadata-eval100.0%

        \[\leadsto x + \left(z \cdot x\right) \cdot \left(y + \color{blue}{-1}\right) \]
      5. distribute-lft-in94.2%

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

        \[\leadsto x + \color{blue}{\frac{\left(\left(z \cdot x\right) \cdot y\right) \cdot \left(\left(z \cdot x\right) \cdot y\right) - \left(\left(z \cdot x\right) \cdot -1\right) \cdot \left(\left(z \cdot x\right) \cdot -1\right)}{\left(z \cdot x\right) \cdot y - \left(z \cdot x\right) \cdot -1}} \]
    5. Applied egg-rr63.3%

      \[\leadsto x + \color{blue}{\frac{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}{x \cdot \left(z \cdot y\right) - \left(-x \cdot z\right)}} \]
    6. Taylor expanded in y around 0 94.7%

      \[\leadsto \color{blue}{x - x \cdot z} \]

    if 1.56e13 < y

    1. Initial program 90.6%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 74.0%

      \[\leadsto \color{blue}{x \cdot \left(z \cdot \left(y - 1\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*82.2%

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

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

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

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

      \[\leadsto \color{blue}{\left(z \cdot x\right) \cdot \left(y + -1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.1 \cdot 10^{+85}:\\ \;\;\;\;z \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;y \leq 15600000000000:\\ \;\;\;\;x - z \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot x\right) \cdot \left(y + -1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 84.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6.1 \cdot 10^{+85} \lor \neg \left(y \leq 3800000000000\right):\\ \;\;\;\;y \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -6.1e+85) (not (<= y 3800000000000.0)))
   (* y (* z x))
   (* x (- 1.0 z))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -6.1e+85) || !(y <= 3800000000000.0)) {
		tmp = y * (z * x);
	} else {
		tmp = x * (1.0 - z);
	}
	return tmp;
}
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 <= (-6.1d+85)) .or. (.not. (y <= 3800000000000.0d0))) then
        tmp = y * (z * x)
    else
        tmp = x * (1.0d0 - z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -6.1e+85) || !(y <= 3800000000000.0)) {
		tmp = y * (z * x);
	} else {
		tmp = x * (1.0 - z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -6.1e+85) or not (y <= 3800000000000.0):
		tmp = y * (z * x)
	else:
		tmp = x * (1.0 - z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -6.1e+85) || !(y <= 3800000000000.0))
		tmp = Float64(y * Float64(z * x));
	else
		tmp = Float64(x * Float64(1.0 - z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -6.1e+85) || ~((y <= 3800000000000.0)))
		tmp = y * (z * x);
	else
		tmp = x * (1.0 - z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.1e+85], N[Not[LessEqual[y, 3800000000000.0]], $MachinePrecision]], N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.1 \cdot 10^{+85} \lor \neg \left(y \leq 3800000000000\right):\\
\;\;\;\;y \cdot \left(z \cdot x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.09999999999999981e85 or 3.8e12 < y

    1. Initial program 90.2%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 77.0%

      \[\leadsto \color{blue}{x \cdot \left(z \cdot \left(y - 1\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*80.2%

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

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

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

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

      \[\leadsto \color{blue}{\left(z \cdot x\right) \cdot \left(y + -1\right)} \]
    6. Step-by-step derivation
      1. add-sqr-sqrt39.0%

        \[\leadsto \color{blue}{\left(\sqrt{z \cdot x} \cdot \sqrt{z \cdot x}\right)} \cdot \left(y + -1\right) \]
      2. pow239.0%

        \[\leadsto \color{blue}{{\left(\sqrt{z \cdot x}\right)}^{2}} \cdot \left(y + -1\right) \]
      3. *-commutative39.0%

        \[\leadsto {\left(\sqrt{\color{blue}{x \cdot z}}\right)}^{2} \cdot \left(y + -1\right) \]
    7. Applied egg-rr39.0%

      \[\leadsto \color{blue}{{\left(\sqrt{x \cdot z}\right)}^{2}} \cdot \left(y + -1\right) \]
    8. Step-by-step derivation
      1. unpow239.0%

        \[\leadsto \color{blue}{\left(\sqrt{x \cdot z} \cdot \sqrt{x \cdot z}\right)} \cdot \left(y + -1\right) \]
      2. add-sqr-sqrt80.2%

        \[\leadsto \color{blue}{\left(x \cdot z\right)} \cdot \left(y + -1\right) \]
      3. distribute-rgt-in67.4%

        \[\leadsto \color{blue}{y \cdot \left(x \cdot z\right) + -1 \cdot \left(x \cdot z\right)} \]
      4. neg-mul-167.4%

        \[\leadsto y \cdot \left(x \cdot z\right) + \color{blue}{\left(-x \cdot z\right)} \]
      5. unsub-neg67.4%

        \[\leadsto \color{blue}{y \cdot \left(x \cdot z\right) - x \cdot z} \]
      6. *-commutative67.4%

        \[\leadsto y \cdot \color{blue}{\left(z \cdot x\right)} - x \cdot z \]
      7. associate-*r*64.2%

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot x} - x \cdot z \]
      8. *-commutative64.2%

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot x - x \cdot z \]
      9. *-commutative64.2%

        \[\leadsto \color{blue}{x \cdot \left(z \cdot y\right)} - x \cdot z \]
      10. flip--25.8%

        \[\leadsto \color{blue}{\frac{\left(x \cdot \left(z \cdot y\right)\right) \cdot \left(x \cdot \left(z \cdot y\right)\right) - \left(x \cdot z\right) \cdot \left(x \cdot z\right)}{x \cdot \left(z \cdot y\right) + x \cdot z}} \]
      11. unpow225.8%

        \[\leadsto \frac{\color{blue}{{\left(x \cdot \left(z \cdot y\right)\right)}^{2}} - \left(x \cdot z\right) \cdot \left(x \cdot z\right)}{x \cdot \left(z \cdot y\right) + x \cdot z} \]
      12. sqr-neg25.8%

        \[\leadsto \frac{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \color{blue}{\left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}}{x \cdot \left(z \cdot y\right) + x \cdot z} \]
      13. cancel-sign-sub25.8%

        \[\leadsto \frac{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}{\color{blue}{x \cdot \left(z \cdot y\right) - \left(-x\right) \cdot z}} \]
      14. distribute-lft-neg-in25.8%

        \[\leadsto \frac{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}{x \cdot \left(z \cdot y\right) - \color{blue}{\left(-x \cdot z\right)}} \]
      15. clear-num25.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{x \cdot \left(z \cdot y\right) - \left(-x \cdot z\right)}{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}}} \]
    9. Applied egg-rr77.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{x \cdot \left(z \cdot \left(y + -1\right)\right)}}} \]
    10. Taylor expanded in y around inf 77.0%

      \[\leadsto \color{blue}{x \cdot \left(y \cdot z\right)} \]
    11. Step-by-step derivation
      1. associate-*r*82.7%

        \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot z} \]
      2. *-commutative82.7%

        \[\leadsto \color{blue}{\left(y \cdot x\right)} \cdot z \]
      3. associate-*r*80.2%

        \[\leadsto \color{blue}{y \cdot \left(x \cdot z\right)} \]
    12. Simplified80.2%

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

    if -6.09999999999999981e85 < y < 3.8e12

    1. Initial program 99.9%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 94.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.1 \cdot 10^{+85} \lor \neg \left(y \leq 3800000000000\right):\\ \;\;\;\;y \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 85.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{+89}:\\ \;\;\;\;z \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;y \leq 33500000000000:\\ \;\;\;\;x - z \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot x\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -3.1e+89)
   (* z (* y x))
   (if (<= y 33500000000000.0) (- x (* z x)) (* y (* z x)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.1e+89) {
		tmp = z * (y * x);
	} else if (y <= 33500000000000.0) {
		tmp = x - (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
    real(8) :: tmp
    if (y <= (-3.1d+89)) then
        tmp = z * (y * x)
    else if (y <= 33500000000000.0d0) then
        tmp = x - (z * x)
    else
        tmp = y * (z * x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.1e+89) {
		tmp = z * (y * x);
	} else if (y <= 33500000000000.0) {
		tmp = x - (z * x);
	} else {
		tmp = y * (z * x);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -3.1e+89:
		tmp = z * (y * x)
	elif y <= 33500000000000.0:
		tmp = x - (z * x)
	else:
		tmp = y * (z * x)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -3.1e+89)
		tmp = Float64(z * Float64(y * x));
	elseif (y <= 33500000000000.0)
		tmp = Float64(x - Float64(z * x));
	else
		tmp = Float64(y * Float64(z * x));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -3.1e+89)
		tmp = z * (y * x);
	elseif (y <= 33500000000000.0)
		tmp = x - (z * x);
	else
		tmp = y * (z * x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -3.1e+89], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 33500000000000.0], N[(x - N[(z * x), $MachinePrecision]), $MachinePrecision], N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{+89}:\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\

\mathbf{elif}\;y \leq 33500000000000:\\
\;\;\;\;x - z \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.1e89

    1. Initial program 89.6%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 81.5%

      \[\leadsto \color{blue}{x \cdot \left(y \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutative81.5%

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot x} \]
      2. *-commutative81.5%

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot x \]
      3. associate-*l*87.6%

        \[\leadsto \color{blue}{z \cdot \left(y \cdot x\right)} \]
    5. Simplified87.6%

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

    if -3.1e89 < y < 3.35e13

    1. Initial program 99.9%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 100.0%

      \[\leadsto \color{blue}{x + x \cdot \left(z \cdot \left(y - 1\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*100.0%

        \[\leadsto x + \color{blue}{\left(x \cdot z\right) \cdot \left(y - 1\right)} \]
      2. *-commutative100.0%

        \[\leadsto x + \color{blue}{\left(z \cdot x\right)} \cdot \left(y - 1\right) \]
      3. sub-neg100.0%

        \[\leadsto x + \left(z \cdot x\right) \cdot \color{blue}{\left(y + \left(-1\right)\right)} \]
      4. metadata-eval100.0%

        \[\leadsto x + \left(z \cdot x\right) \cdot \left(y + \color{blue}{-1}\right) \]
      5. distribute-lft-in94.2%

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

        \[\leadsto x + \color{blue}{\frac{\left(\left(z \cdot x\right) \cdot y\right) \cdot \left(\left(z \cdot x\right) \cdot y\right) - \left(\left(z \cdot x\right) \cdot -1\right) \cdot \left(\left(z \cdot x\right) \cdot -1\right)}{\left(z \cdot x\right) \cdot y - \left(z \cdot x\right) \cdot -1}} \]
    5. Applied egg-rr63.3%

      \[\leadsto x + \color{blue}{\frac{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}{x \cdot \left(z \cdot y\right) - \left(-x \cdot z\right)}} \]
    6. Taylor expanded in y around 0 94.7%

      \[\leadsto \color{blue}{x - x \cdot z} \]

    if 3.35e13 < y

    1. Initial program 90.6%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 74.0%

      \[\leadsto \color{blue}{x \cdot \left(z \cdot \left(y - 1\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*82.2%

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

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

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

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

      \[\leadsto \color{blue}{\left(z \cdot x\right) \cdot \left(y + -1\right)} \]
    6. Step-by-step derivation
      1. add-sqr-sqrt39.1%

        \[\leadsto \color{blue}{\left(\sqrt{z \cdot x} \cdot \sqrt{z \cdot x}\right)} \cdot \left(y + -1\right) \]
      2. pow239.1%

        \[\leadsto \color{blue}{{\left(\sqrt{z \cdot x}\right)}^{2}} \cdot \left(y + -1\right) \]
      3. *-commutative39.1%

        \[\leadsto {\left(\sqrt{\color{blue}{x \cdot z}}\right)}^{2} \cdot \left(y + -1\right) \]
    7. Applied egg-rr39.1%

      \[\leadsto \color{blue}{{\left(\sqrt{x \cdot z}\right)}^{2}} \cdot \left(y + -1\right) \]
    8. Step-by-step derivation
      1. unpow239.1%

        \[\leadsto \color{blue}{\left(\sqrt{x \cdot z} \cdot \sqrt{x \cdot z}\right)} \cdot \left(y + -1\right) \]
      2. add-sqr-sqrt82.2%

        \[\leadsto \color{blue}{\left(x \cdot z\right)} \cdot \left(y + -1\right) \]
      3. distribute-rgt-in60.8%

        \[\leadsto \color{blue}{y \cdot \left(x \cdot z\right) + -1 \cdot \left(x \cdot z\right)} \]
      4. neg-mul-160.8%

        \[\leadsto y \cdot \left(x \cdot z\right) + \color{blue}{\left(-x \cdot z\right)} \]
      5. unsub-neg60.8%

        \[\leadsto \color{blue}{y \cdot \left(x \cdot z\right) - x \cdot z} \]
      6. *-commutative60.8%

        \[\leadsto y \cdot \color{blue}{\left(z \cdot x\right)} - x \cdot z \]
      7. associate-*r*52.6%

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot x} - x \cdot z \]
      8. *-commutative52.6%

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot x - x \cdot z \]
      9. *-commutative52.6%

        \[\leadsto \color{blue}{x \cdot \left(z \cdot y\right)} - x \cdot z \]
      10. flip--20.8%

        \[\leadsto \color{blue}{\frac{\left(x \cdot \left(z \cdot y\right)\right) \cdot \left(x \cdot \left(z \cdot y\right)\right) - \left(x \cdot z\right) \cdot \left(x \cdot z\right)}{x \cdot \left(z \cdot y\right) + x \cdot z}} \]
      11. unpow220.8%

        \[\leadsto \frac{\color{blue}{{\left(x \cdot \left(z \cdot y\right)\right)}^{2}} - \left(x \cdot z\right) \cdot \left(x \cdot z\right)}{x \cdot \left(z \cdot y\right) + x \cdot z} \]
      12. sqr-neg20.8%

        \[\leadsto \frac{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \color{blue}{\left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}}{x \cdot \left(z \cdot y\right) + x \cdot z} \]
      13. cancel-sign-sub20.8%

        \[\leadsto \frac{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}{\color{blue}{x \cdot \left(z \cdot y\right) - \left(-x\right) \cdot z}} \]
      14. distribute-lft-neg-in20.8%

        \[\leadsto \frac{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}{x \cdot \left(z \cdot y\right) - \color{blue}{\left(-x \cdot z\right)}} \]
      15. clear-num20.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{x \cdot \left(z \cdot y\right) - \left(-x \cdot z\right)}{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}}} \]
    9. Applied egg-rr73.9%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{x \cdot \left(z \cdot \left(y + -1\right)\right)}}} \]
    10. Taylor expanded in y around inf 74.0%

      \[\leadsto \color{blue}{x \cdot \left(y \cdot z\right)} \]
    11. Step-by-step derivation
      1. associate-*r*79.5%

        \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot z} \]
      2. *-commutative79.5%

        \[\leadsto \color{blue}{\left(y \cdot x\right)} \cdot z \]
      3. associate-*r*82.2%

        \[\leadsto \color{blue}{y \cdot \left(x \cdot z\right)} \]
    12. Simplified82.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{+89}:\\ \;\;\;\;z \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;y \leq 33500000000000:\\ \;\;\;\;x - z \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 85.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{+86}:\\ \;\;\;\;z \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;y \leq 13200000000000:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot x\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -5e+86)
   (* z (* y x))
   (if (<= y 13200000000000.0) (* x (- 1.0 z)) (* y (* z x)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -5e+86) {
		tmp = z * (y * x);
	} else if (y <= 13200000000000.0) {
		tmp = x * (1.0 - z);
	} 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
    real(8) :: tmp
    if (y <= (-5d+86)) then
        tmp = z * (y * x)
    else if (y <= 13200000000000.0d0) then
        tmp = x * (1.0d0 - z)
    else
        tmp = y * (z * x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -5e+86) {
		tmp = z * (y * x);
	} else if (y <= 13200000000000.0) {
		tmp = x * (1.0 - z);
	} else {
		tmp = y * (z * x);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -5e+86:
		tmp = z * (y * x)
	elif y <= 13200000000000.0:
		tmp = x * (1.0 - z)
	else:
		tmp = y * (z * x)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -5e+86)
		tmp = Float64(z * Float64(y * x));
	elseif (y <= 13200000000000.0)
		tmp = Float64(x * Float64(1.0 - z));
	else
		tmp = Float64(y * Float64(z * x));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -5e+86)
		tmp = z * (y * x);
	elseif (y <= 13200000000000.0)
		tmp = x * (1.0 - z);
	else
		tmp = y * (z * x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -5e+86], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 13200000000000.0], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+86}:\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\

\mathbf{elif}\;y \leq 13200000000000:\\
\;\;\;\;x \cdot \left(1 - z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.9999999999999998e86

    1. Initial program 89.6%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 81.5%

      \[\leadsto \color{blue}{x \cdot \left(y \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutative81.5%

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot x} \]
      2. *-commutative81.5%

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot x \]
      3. associate-*l*87.6%

        \[\leadsto \color{blue}{z \cdot \left(y \cdot x\right)} \]
    5. Simplified87.6%

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

    if -4.9999999999999998e86 < y < 1.32e13

    1. Initial program 99.9%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 94.7%

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

    if 1.32e13 < y

    1. Initial program 90.6%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 74.0%

      \[\leadsto \color{blue}{x \cdot \left(z \cdot \left(y - 1\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*82.2%

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

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

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

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

      \[\leadsto \color{blue}{\left(z \cdot x\right) \cdot \left(y + -1\right)} \]
    6. Step-by-step derivation
      1. add-sqr-sqrt39.1%

        \[\leadsto \color{blue}{\left(\sqrt{z \cdot x} \cdot \sqrt{z \cdot x}\right)} \cdot \left(y + -1\right) \]
      2. pow239.1%

        \[\leadsto \color{blue}{{\left(\sqrt{z \cdot x}\right)}^{2}} \cdot \left(y + -1\right) \]
      3. *-commutative39.1%

        \[\leadsto {\left(\sqrt{\color{blue}{x \cdot z}}\right)}^{2} \cdot \left(y + -1\right) \]
    7. Applied egg-rr39.1%

      \[\leadsto \color{blue}{{\left(\sqrt{x \cdot z}\right)}^{2}} \cdot \left(y + -1\right) \]
    8. Step-by-step derivation
      1. unpow239.1%

        \[\leadsto \color{blue}{\left(\sqrt{x \cdot z} \cdot \sqrt{x \cdot z}\right)} \cdot \left(y + -1\right) \]
      2. add-sqr-sqrt82.2%

        \[\leadsto \color{blue}{\left(x \cdot z\right)} \cdot \left(y + -1\right) \]
      3. distribute-rgt-in60.8%

        \[\leadsto \color{blue}{y \cdot \left(x \cdot z\right) + -1 \cdot \left(x \cdot z\right)} \]
      4. neg-mul-160.8%

        \[\leadsto y \cdot \left(x \cdot z\right) + \color{blue}{\left(-x \cdot z\right)} \]
      5. unsub-neg60.8%

        \[\leadsto \color{blue}{y \cdot \left(x \cdot z\right) - x \cdot z} \]
      6. *-commutative60.8%

        \[\leadsto y \cdot \color{blue}{\left(z \cdot x\right)} - x \cdot z \]
      7. associate-*r*52.6%

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot x} - x \cdot z \]
      8. *-commutative52.6%

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot x - x \cdot z \]
      9. *-commutative52.6%

        \[\leadsto \color{blue}{x \cdot \left(z \cdot y\right)} - x \cdot z \]
      10. flip--20.8%

        \[\leadsto \color{blue}{\frac{\left(x \cdot \left(z \cdot y\right)\right) \cdot \left(x \cdot \left(z \cdot y\right)\right) - \left(x \cdot z\right) \cdot \left(x \cdot z\right)}{x \cdot \left(z \cdot y\right) + x \cdot z}} \]
      11. unpow220.8%

        \[\leadsto \frac{\color{blue}{{\left(x \cdot \left(z \cdot y\right)\right)}^{2}} - \left(x \cdot z\right) \cdot \left(x \cdot z\right)}{x \cdot \left(z \cdot y\right) + x \cdot z} \]
      12. sqr-neg20.8%

        \[\leadsto \frac{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \color{blue}{\left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}}{x \cdot \left(z \cdot y\right) + x \cdot z} \]
      13. cancel-sign-sub20.8%

        \[\leadsto \frac{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}{\color{blue}{x \cdot \left(z \cdot y\right) - \left(-x\right) \cdot z}} \]
      14. distribute-lft-neg-in20.8%

        \[\leadsto \frac{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}{x \cdot \left(z \cdot y\right) - \color{blue}{\left(-x \cdot z\right)}} \]
      15. clear-num20.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{x \cdot \left(z \cdot y\right) - \left(-x \cdot z\right)}{{\left(x \cdot \left(z \cdot y\right)\right)}^{2} - \left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}}} \]
    9. Applied egg-rr73.9%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{x \cdot \left(z \cdot \left(y + -1\right)\right)}}} \]
    10. Taylor expanded in y around inf 74.0%

      \[\leadsto \color{blue}{x \cdot \left(y \cdot z\right)} \]
    11. Step-by-step derivation
      1. associate-*r*79.5%

        \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot z} \]
      2. *-commutative79.5%

        \[\leadsto \color{blue}{\left(y \cdot x\right)} \cdot z \]
      3. associate-*r*82.2%

        \[\leadsto \color{blue}{y \cdot \left(x \cdot z\right)} \]
    12. Simplified82.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{+86}:\\ \;\;\;\;z \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;y \leq 13200000000000:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 64.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.00016 \lor \neg \left(z \leq 0.98\right):\\ \;\;\;\;z \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -0.00016) (not (<= z 0.98))) (* z (- x)) x))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -0.00016) || !(z <= 0.98)) {
		tmp = z * -x;
	} else {
		tmp = 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
    real(8) :: tmp
    if ((z <= (-0.00016d0)) .or. (.not. (z <= 0.98d0))) then
        tmp = z * -x
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -0.00016) || !(z <= 0.98)) {
		tmp = z * -x;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -0.00016) or not (z <= 0.98):
		tmp = z * -x
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -0.00016) || !(z <= 0.98))
		tmp = Float64(z * Float64(-x));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -0.00016) || ~((z <= 0.98)))
		tmp = z * -x;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.00016], N[Not[LessEqual[z, 0.98]], $MachinePrecision]], N[(z * (-x)), $MachinePrecision], x]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00016 \lor \neg \left(z \leq 0.98\right):\\
\;\;\;\;z \cdot \left(-x\right)\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.60000000000000013e-4 or 0.97999999999999998 < z

    1. Initial program 91.5%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 54.1%

      \[\leadsto x \cdot \left(1 - \color{blue}{z}\right) \]
    4. Taylor expanded in z around inf 52.9%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot z\right)} \]
    5. Step-by-step derivation
      1. neg-mul-152.9%

        \[\leadsto \color{blue}{-x \cdot z} \]
      2. distribute-rgt-neg-in52.9%

        \[\leadsto \color{blue}{x \cdot \left(-z\right)} \]
    6. Simplified52.9%

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

    if -1.60000000000000013e-4 < z < 0.97999999999999998

    1. Initial program 99.9%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 64.5%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification58.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.00016 \lor \neg \left(z \leq 0.98\right):\\ \;\;\;\;z \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 40.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.3 \cdot 10^{+71} \lor \neg \left(z \leq 8.2 \cdot 10^{+14}\right):\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -3.3e+71) (not (<= z 8.2e+14))) (* z x) x))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -3.3e+71) || !(z <= 8.2e+14)) {
		tmp = z * x;
	} else {
		tmp = 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
    real(8) :: tmp
    if ((z <= (-3.3d+71)) .or. (.not. (z <= 8.2d+14))) then
        tmp = z * x
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -3.3e+71) || !(z <= 8.2e+14)) {
		tmp = z * x;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -3.3e+71) or not (z <= 8.2e+14):
		tmp = z * x
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -3.3e+71) || !(z <= 8.2e+14))
		tmp = Float64(z * x);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -3.3e+71) || ~((z <= 8.2e+14)))
		tmp = z * x;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.3e+71], N[Not[LessEqual[z, 8.2e+14]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+71} \lor \neg \left(z \leq 8.2 \cdot 10^{+14}\right):\\
\;\;\;\;z \cdot x\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.2999999999999998e71 or 8.2e14 < z

    1. Initial program 89.4%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 51.5%

      \[\leadsto x \cdot \left(1 - \color{blue}{z}\right) \]
    4. Step-by-step derivation
      1. sub-neg51.5%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-z\right)\right)} \]
      2. distribute-rgt-in51.5%

        \[\leadsto \color{blue}{1 \cdot x + \left(-z\right) \cdot x} \]
      3. *-un-lft-identity51.5%

        \[\leadsto \color{blue}{x} + \left(-z\right) \cdot x \]
      4. distribute-lft-neg-in51.5%

        \[\leadsto x + \color{blue}{\left(-z \cdot x\right)} \]
      5. distribute-rgt-neg-out51.5%

        \[\leadsto x + \color{blue}{z \cdot \left(-x\right)} \]
      6. +-commutative51.5%

        \[\leadsto \color{blue}{z \cdot \left(-x\right) + x} \]
      7. *-commutative51.5%

        \[\leadsto \color{blue}{\left(-x\right) \cdot z} + x \]
      8. distribute-lft-neg-in51.5%

        \[\leadsto \color{blue}{\left(-x \cdot z\right)} + x \]
      9. pow151.5%

        \[\leadsto \color{blue}{{\left(-x \cdot z\right)}^{1}} + x \]
      10. metadata-eval51.5%

        \[\leadsto {\left(-x \cdot z\right)}^{\color{blue}{\left(\frac{2}{2}\right)}} + x \]
      11. sqrt-pow133.8%

        \[\leadsto \color{blue}{\sqrt{{\left(-x \cdot z\right)}^{2}}} + x \]
      12. pow233.8%

        \[\leadsto \sqrt{\color{blue}{\left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}} + x \]
      13. sqr-neg33.8%

        \[\leadsto \sqrt{\color{blue}{\left(x \cdot z\right) \cdot \left(x \cdot z\right)}} + x \]
      14. sqrt-prod8.3%

        \[\leadsto \color{blue}{\sqrt{x \cdot z} \cdot \sqrt{x \cdot z}} + x \]
      15. add-sqr-sqrt16.5%

        \[\leadsto \color{blue}{x \cdot z} + x \]
    5. Applied egg-rr16.5%

      \[\leadsto \color{blue}{x \cdot z + x} \]
    6. Taylor expanded in z around inf 16.5%

      \[\leadsto \color{blue}{x \cdot z} \]

    if -3.2999999999999998e71 < z < 8.2e14

    1. Initial program 99.9%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 54.0%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification38.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.3 \cdot 10^{+71} \lor \neg \left(z \leq 8.2 \cdot 10^{+14}\right):\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 65.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3.3 \cdot 10^{+102}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 3.3e+102) (* x (- 1.0 z)) (* z x)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 3.3e+102) {
		tmp = x * (1.0 - z);
	} else {
		tmp = 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
    real(8) :: tmp
    if (y <= 3.3d+102) then
        tmp = x * (1.0d0 - z)
    else
        tmp = z * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 3.3e+102) {
		tmp = x * (1.0 - z);
	} else {
		tmp = z * x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 3.3e+102:
		tmp = x * (1.0 - z)
	else:
		tmp = z * x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 3.3e+102)
		tmp = Float64(x * Float64(1.0 - z));
	else
		tmp = Float64(z * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 3.3e+102)
		tmp = x * (1.0 - z);
	else
		tmp = z * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 3.3e+102], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(z * x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.3 \cdot 10^{+102}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\

\mathbf{else}:\\
\;\;\;\;z \cdot x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3.29999999999999999e102

    1. Initial program 97.5%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 73.6%

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

    if 3.29999999999999999e102 < y

    1. Initial program 88.5%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 13.3%

      \[\leadsto x \cdot \left(1 - \color{blue}{z}\right) \]
    4. Step-by-step derivation
      1. sub-neg13.3%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-z\right)\right)} \]
      2. distribute-rgt-in13.3%

        \[\leadsto \color{blue}{1 \cdot x + \left(-z\right) \cdot x} \]
      3. *-un-lft-identity13.3%

        \[\leadsto \color{blue}{x} + \left(-z\right) \cdot x \]
      4. distribute-lft-neg-in13.3%

        \[\leadsto x + \color{blue}{\left(-z \cdot x\right)} \]
      5. distribute-rgt-neg-out13.3%

        \[\leadsto x + \color{blue}{z \cdot \left(-x\right)} \]
      6. +-commutative13.3%

        \[\leadsto \color{blue}{z \cdot \left(-x\right) + x} \]
      7. *-commutative13.3%

        \[\leadsto \color{blue}{\left(-x\right) \cdot z} + x \]
      8. distribute-lft-neg-in13.3%

        \[\leadsto \color{blue}{\left(-x \cdot z\right)} + x \]
      9. pow113.3%

        \[\leadsto \color{blue}{{\left(-x \cdot z\right)}^{1}} + x \]
      10. metadata-eval13.3%

        \[\leadsto {\left(-x \cdot z\right)}^{\color{blue}{\left(\frac{2}{2}\right)}} + x \]
      11. sqrt-pow133.0%

        \[\leadsto \color{blue}{\sqrt{{\left(-x \cdot z\right)}^{2}}} + x \]
      12. pow233.0%

        \[\leadsto \sqrt{\color{blue}{\left(-x \cdot z\right) \cdot \left(-x \cdot z\right)}} + x \]
      13. sqr-neg33.0%

        \[\leadsto \sqrt{\color{blue}{\left(x \cdot z\right) \cdot \left(x \cdot z\right)}} + x \]
      14. sqrt-prod24.5%

        \[\leadsto \color{blue}{\sqrt{x \cdot z} \cdot \sqrt{x \cdot z}} + x \]
      15. add-sqr-sqrt39.2%

        \[\leadsto \color{blue}{x \cdot z} + x \]
    5. Applied egg-rr39.2%

      \[\leadsto \color{blue}{x \cdot z + x} \]
    6. Taylor expanded in z around inf 28.0%

      \[\leadsto \color{blue}{x \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification63.5%

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

Alternative 11: 38.4% accurate, 9.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
	return x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x
end function
public static double code(double x, double y, double z) {
	return x;
}
def code(x, y, z):
	return x
function code(x, y, z)
	return x
end
function tmp = code(x, y, z)
	tmp = x;
end
code[x_, y_, z_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 95.5%

    \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
  2. Add Preprocessing
  3. Taylor expanded in z around 0 32.7%

    \[\leadsto \color{blue}{x} \]
  4. Add Preprocessing

Developer Target 1: 99.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\\ t_1 := x + \left(1 - y\right) \cdot \left(\left(-z\right) \cdot x\right)\\ \mathbf{if}\;t\_0 < -1.618195973607049 \cdot 10^{+50}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 < 3.892237649663903 \cdot 10^{+134}:\\ \;\;\;\;\left(x \cdot y\right) \cdot z - \left(x \cdot z - x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (- 1.0 (* (- 1.0 y) z))))
        (t_1 (+ x (* (- 1.0 y) (* (- z) x)))))
   (if (< t_0 -1.618195973607049e+50)
     t_1
     (if (< t_0 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) t_1))))
double code(double x, double y, double z) {
	double t_0 = x * (1.0 - ((1.0 - y) * z));
	double t_1 = x + ((1.0 - y) * (-z * x));
	double tmp;
	if (t_0 < -1.618195973607049e+50) {
		tmp = t_1;
	} else if (t_0 < 3.892237649663903e+134) {
		tmp = ((x * y) * z) - ((x * z) - x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
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) :: t_1
    real(8) :: tmp
    t_0 = x * (1.0d0 - ((1.0d0 - y) * z))
    t_1 = x + ((1.0d0 - y) * (-z * x))
    if (t_0 < (-1.618195973607049d+50)) then
        tmp = t_1
    else if (t_0 < 3.892237649663903d+134) then
        tmp = ((x * y) * z) - ((x * z) - x)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (1.0 - ((1.0 - y) * z));
	double t_1 = x + ((1.0 - y) * (-z * x));
	double tmp;
	if (t_0 < -1.618195973607049e+50) {
		tmp = t_1;
	} else if (t_0 < 3.892237649663903e+134) {
		tmp = ((x * y) * z) - ((x * z) - x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (1.0 - ((1.0 - y) * z))
	t_1 = x + ((1.0 - y) * (-z * x))
	tmp = 0
	if t_0 < -1.618195973607049e+50:
		tmp = t_1
	elif t_0 < 3.892237649663903e+134:
		tmp = ((x * y) * z) - ((x * z) - x)
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z)))
	t_1 = Float64(x + Float64(Float64(1.0 - y) * Float64(Float64(-z) * x)))
	tmp = 0.0
	if (t_0 < -1.618195973607049e+50)
		tmp = t_1;
	elseif (t_0 < 3.892237649663903e+134)
		tmp = Float64(Float64(Float64(x * y) * z) - Float64(Float64(x * z) - x));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (1.0 - ((1.0 - y) * z));
	t_1 = x + ((1.0 - y) * (-z * x));
	tmp = 0.0;
	if (t_0 < -1.618195973607049e+50)
		tmp = t_1;
	elseif (t_0 < 3.892237649663903e+134)
		tmp = ((x * y) * z) - ((x * z) - x);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(N[(1.0 - y), $MachinePrecision] * N[((-z) * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$0, -1.618195973607049e+50], t$95$1, If[Less[t$95$0, 3.892237649663903e+134], N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] - N[(N[(x * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\\
t_1 := x + \left(1 - y\right) \cdot \left(\left(-z\right) \cdot x\right)\\
\mathbf{if}\;t\_0 < -1.618195973607049 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 < 3.892237649663903 \cdot 10^{+134}:\\
\;\;\;\;\left(x \cdot y\right) \cdot z - \left(x \cdot z - x\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024146 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< (* x (- 1 (* (- 1 y) z))) -161819597360704900000000000000000000000000000000000) (+ x (* (- 1 y) (* (- z) x))) (if (< (* x (- 1 (* (- 1 y) z))) 389223764966390300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1 y) (* (- z) x))))))

  (* x (- 1.0 (* (- 1.0 y) z))))