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

Percentage Accurate: 95.9% → 97.7%
Time: 8.3s
Alternatives: 12
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 12 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: 95.9% 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: 97.7% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
t_0 := z \cdot \left(y + -1\right)\\
\mathbf{if}\;1 + t\_0 \leq -5 \cdot 10^{+277}:\\
\;\;\;\;{\left(\frac{1}{z \cdot \left(x \cdot \left(y + -1\right)\right)}\right)}^{-1}\\

\mathbf{else}:\\
\;\;\;\;x + x \cdot t\_0\\


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

    1. Initial program 74.0%

      \[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*99.8%

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

        \[\leadsto \left(x \cdot z\right) \cdot \color{blue}{\frac{y \cdot y - 1 \cdot 1}{y + 1}} \]
      3. associate-*r/83.9%

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

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

        \[\leadsto \frac{\left(x \cdot z\right) \cdot \color{blue}{\mathsf{fma}\left(y, y, -1\right)}}{y + 1} \]
      6. metadata-eval83.9%

        \[\leadsto \frac{\left(x \cdot z\right) \cdot \mathsf{fma}\left(y, y, \color{blue}{-1}\right)}{y + 1} \]
    5. Applied egg-rr83.9%

      \[\leadsto \color{blue}{\frac{\left(x \cdot z\right) \cdot \mathsf{fma}\left(y, y, -1\right)}{y + 1}} \]
    6. Step-by-step derivation
      1. clear-num83.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{y + 1}{\left(x \cdot z\right) \cdot \mathsf{fma}\left(y, y, -1\right)}}} \]
      2. inv-pow83.9%

        \[\leadsto \color{blue}{{\left(\frac{y + 1}{\left(x \cdot z\right) \cdot \mathsf{fma}\left(y, y, -1\right)}\right)}^{-1}} \]
      3. clear-num83.8%

        \[\leadsto {\color{blue}{\left(\frac{1}{\frac{\left(x \cdot z\right) \cdot \mathsf{fma}\left(y, y, -1\right)}{y + 1}}\right)}}^{-1} \]
      4. associate-/l*83.8%

        \[\leadsto {\left(\frac{1}{\color{blue}{\left(x \cdot z\right) \cdot \frac{\mathsf{fma}\left(y, y, -1\right)}{y + 1}}}\right)}^{-1} \]
      5. *-commutative83.8%

        \[\leadsto {\left(\frac{1}{\color{blue}{\left(z \cdot x\right)} \cdot \frac{\mathsf{fma}\left(y, y, -1\right)}{y + 1}}\right)}^{-1} \]
      6. metadata-eval83.8%

        \[\leadsto {\left(\frac{1}{\left(z \cdot x\right) \cdot \frac{\mathsf{fma}\left(y, y, \color{blue}{-1}\right)}{y + 1}}\right)}^{-1} \]
      7. fma-neg83.8%

        \[\leadsto {\left(\frac{1}{\left(z \cdot x\right) \cdot \frac{\color{blue}{y \cdot y - 1}}{y + 1}}\right)}^{-1} \]
      8. metadata-eval83.8%

        \[\leadsto {\left(\frac{1}{\left(z \cdot x\right) \cdot \frac{y \cdot y - \color{blue}{1 \cdot 1}}{y + 1}}\right)}^{-1} \]
      9. flip--99.8%

        \[\leadsto {\left(\frac{1}{\left(z \cdot x\right) \cdot \color{blue}{\left(y - 1\right)}}\right)}^{-1} \]
      10. associate-*l*99.9%

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

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

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

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

    if -4.99999999999999982e277 < (-.f64 #s(literal 1 binary64) (*.f64 (-.f64 #s(literal 1 binary64) y) z))

    1. Initial program 98.7%

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

      \[\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}\;1 + z \cdot \left(y + -1\right) \leq -5 \cdot 10^{+277}:\\ \;\;\;\;{\left(\frac{1}{z \cdot \left(x \cdot \left(y + -1\right)\right)}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot \left(z \cdot \left(y + -1\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 97.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(y + -1\right)\\ \mathbf{if}\;1 + t\_0 \leq -\infty:\\ \;\;\;\;z \cdot \left(y \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (+ y -1.0))))
   (if (<= (+ 1.0 t_0) (- INFINITY)) (* z (* y x)) (+ x (* x t_0)))))
double code(double x, double y, double z) {
	double t_0 = z * (y + -1.0);
	double tmp;
	if ((1.0 + t_0) <= -((double) INFINITY)) {
		tmp = z * (y * x);
	} else {
		tmp = x + (x * t_0);
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	double t_0 = z * (y + -1.0);
	double tmp;
	if ((1.0 + t_0) <= -Double.POSITIVE_INFINITY) {
		tmp = z * (y * x);
	} else {
		tmp = x + (x * t_0);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (y + -1.0)
	tmp = 0
	if (1.0 + t_0) <= -math.inf:
		tmp = z * (y * x)
	else:
		tmp = x + (x * t_0)
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(y + -1.0))
	tmp = 0.0
	if (Float64(1.0 + t_0) <= Float64(-Inf))
		tmp = Float64(z * Float64(y * x));
	else
		tmp = Float64(x + Float64(x * t_0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (y + -1.0);
	tmp = 0.0;
	if ((1.0 + t_0) <= -Inf)
		tmp = z * (y * x);
	else
		tmp = x + (x * t_0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 + t$95$0), $MachinePrecision], (-Infinity)], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := z \cdot \left(y + -1\right)\\
\mathbf{if}\;1 + t\_0 \leq -\infty:\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\

\mathbf{else}:\\
\;\;\;\;x + x \cdot t\_0\\


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

    1. Initial program 64.3%

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

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

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

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

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

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

    if -inf.0 < (-.f64 #s(literal 1 binary64) (*.f64 (-.f64 #s(literal 1 binary64) y) z))

    1. Initial program 98.7%

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

      \[\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}\;1 + z \cdot \left(y + -1\right) \leq -\infty:\\ \;\;\;\;z \cdot \left(y \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot \left(z \cdot \left(y + -1\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 97.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + z \cdot \left(y + -1\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;z \cdot \left(y \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* z (+ y -1.0)))))
   (if (<= t_0 (- INFINITY)) (* z (* y x)) (* t_0 x))))
double code(double x, double y, double z) {
	double t_0 = 1.0 + (z * (y + -1.0));
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = z * (y * x);
	} else {
		tmp = t_0 * x;
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	double t_0 = 1.0 + (z * (y + -1.0));
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = z * (y * x);
	} else {
		tmp = t_0 * x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 + (z * (y + -1.0))
	tmp = 0
	if t_0 <= -math.inf:
		tmp = z * (y * x)
	else:
		tmp = t_0 * x
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 + Float64(z * Float64(y + -1.0)))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(z * Float64(y * x));
	else
		tmp = Float64(t_0 * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 + (z * (y + -1.0));
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = z * (y * x);
	else
		tmp = t_0 * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(z * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + z \cdot \left(y + -1\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot x\\


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

    1. Initial program 64.3%

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

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

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

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

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

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

    if -inf.0 < (-.f64 #s(literal 1 binary64) (*.f64 (-.f64 #s(literal 1 binary64) y) z))

    1. Initial program 98.7%

      \[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}\;1 + z \cdot \left(y + -1\right) \leq -\infty:\\ \;\;\;\;z \cdot \left(y \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 + z \cdot \left(y + -1\right)\right) \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 98.6% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.94999999999999996 or 6.80000000000000012e-6 < z

    1. Initial program 92.2%

      \[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.0%

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

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

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

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

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

    if -0.94999999999999996 < z < 6.80000000000000012e-6

    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 inf 98.9%

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

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

      \[\leadsto x \cdot \left(1 - \color{blue}{\left(-y\right)} \cdot z\right) \]
    6. Step-by-step derivation
      1. cancel-sign-sub98.9%

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

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

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

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

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

Alternative 5: 94.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+25} \lor \neg \left(y \leq 3.4 \cdot 10^{-7}\right):\\
\;\;\;\;x \cdot \left(1 + y \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.00000000000000018e25 or 3.39999999999999974e-7 < y

    1. Initial program 91.6%

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

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

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

      \[\leadsto x \cdot \left(1 - \color{blue}{\left(-y\right)} \cdot z\right) \]
    6. Step-by-step derivation
      1. cancel-sign-sub90.3%

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

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

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

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

    if -2.00000000000000018e25 < y < 3.39999999999999974e-7

    1. Initial program 100.0%

      \[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. Taylor expanded in y around 0 99.2%

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

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

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

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

      \[\leadsto x + \color{blue}{z \cdot \left(-x\right)} \]
    7. Step-by-step derivation
      1. distribute-rgt-neg-out99.2%

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

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

        \[\leadsto \color{blue}{x - x \cdot z} \]
    8. Applied egg-rr99.2%

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

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

Alternative 6: 85.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.1 \cdot 10^{+73} \lor \neg \left(y \leq 1.16 \cdot 10^{+29}\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 -4.1e+73) (not (<= y 1.16e+29))) (* y (* z x)) (* x (- 1.0 z))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -4.1e+73) || !(y <= 1.16e+29)) {
		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 <= (-4.1d+73)) .or. (.not. (y <= 1.16d+29))) 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 <= -4.1e+73) || !(y <= 1.16e+29)) {
		tmp = y * (z * x);
	} else {
		tmp = x * (1.0 - z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -4.1e+73) or not (y <= 1.16e+29):
		tmp = y * (z * x)
	else:
		tmp = x * (1.0 - z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -4.1e+73) || !(y <= 1.16e+29))
		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 <= -4.1e+73) || ~((y <= 1.16e+29)))
		tmp = y * (z * x);
	else
		tmp = x * (1.0 - z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.1e+73], N[Not[LessEqual[y, 1.16e+29]], $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 -4.1 \cdot 10^{+73} \lor \neg \left(y \leq 1.16 \cdot 10^{+29}\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 < -4.0999999999999998e73 or 1.16e29 < 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 65.9%

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

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

        \[\leadsto \left(x \cdot z\right) \cdot \color{blue}{\frac{y \cdot y - 1 \cdot 1}{y + 1}} \]
      3. associate-*r/49.5%

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

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

        \[\leadsto \frac{\left(x \cdot z\right) \cdot \color{blue}{\mathsf{fma}\left(y, y, -1\right)}}{y + 1} \]
      6. metadata-eval49.5%

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

      \[\leadsto \color{blue}{\frac{\left(x \cdot z\right) \cdot \mathsf{fma}\left(y, y, -1\right)}{y + 1}} \]
    6. Step-by-step derivation
      1. associate-/l*51.9%

        \[\leadsto \color{blue}{\left(x \cdot z\right) \cdot \frac{\mathsf{fma}\left(y, y, -1\right)}{y + 1}} \]
      2. metadata-eval51.9%

        \[\leadsto \left(x \cdot z\right) \cdot \frac{\mathsf{fma}\left(y, y, \color{blue}{-1}\right)}{y + 1} \]
      3. fma-neg51.9%

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

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

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

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

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

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

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

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

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

    if -4.0999999999999998e73 < y < 1.16e29

    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 95.9%

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

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

Alternative 7: 85.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.28 \cdot 10^{+79}:\\ \;\;\;\;z \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{+28}:\\ \;\;\;\;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 -1.28e+79)
   (* z (* y x))
   (if (<= y 4.5e+28) (- x (* z x)) (* y (* z x)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -1.28e+79) {
		tmp = z * (y * x);
	} else if (y <= 4.5e+28) {
		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 <= (-1.28d+79)) then
        tmp = z * (y * x)
    else if (y <= 4.5d+28) 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 <= -1.28e+79) {
		tmp = z * (y * x);
	} else if (y <= 4.5e+28) {
		tmp = x - (z * x);
	} else {
		tmp = y * (z * x);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -1.28e+79:
		tmp = z * (y * x)
	elif y <= 4.5e+28:
		tmp = x - (z * x)
	else:
		tmp = y * (z * x)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -1.28e+79)
		tmp = Float64(z * Float64(y * x));
	elseif (y <= 4.5e+28)
		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 <= -1.28e+79)
		tmp = z * (y * x);
	elseif (y <= 4.5e+28)
		tmp = x - (z * x);
	else
		tmp = y * (z * x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -1.28e+79], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e+28], N[(x - N[(z * x), $MachinePrecision]), $MachinePrecision], N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 4.5 \cdot 10^{+28}:\\
\;\;\;\;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 < -1.27999999999999998e79

    1. Initial program 88.7%

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

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

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

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

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

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

    if -1.27999999999999998e79 < y < 4.4999999999999997e28

    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. Taylor expanded in y around 0 96.0%

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

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

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

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

      \[\leadsto x + \color{blue}{z \cdot \left(-x\right)} \]
    7. Step-by-step derivation
      1. distribute-rgt-neg-out96.0%

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

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

        \[\leadsto \color{blue}{x - x \cdot z} \]
    8. Applied egg-rr96.0%

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

    if 4.4999999999999997e28 < y

    1. Initial program 91.7%

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

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

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

        \[\leadsto \left(x \cdot z\right) \cdot \color{blue}{\frac{y \cdot y - 1 \cdot 1}{y + 1}} \]
      3. associate-*r/49.7%

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

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

        \[\leadsto \frac{\left(x \cdot z\right) \cdot \color{blue}{\mathsf{fma}\left(y, y, -1\right)}}{y + 1} \]
      6. metadata-eval49.7%

        \[\leadsto \frac{\left(x \cdot z\right) \cdot \mathsf{fma}\left(y, y, \color{blue}{-1}\right)}{y + 1} \]
    5. Applied egg-rr49.7%

      \[\leadsto \color{blue}{\frac{\left(x \cdot z\right) \cdot \mathsf{fma}\left(y, y, -1\right)}{y + 1}} \]
    6. Step-by-step derivation
      1. associate-/l*52.3%

        \[\leadsto \color{blue}{\left(x \cdot z\right) \cdot \frac{\mathsf{fma}\left(y, y, -1\right)}{y + 1}} \]
      2. metadata-eval52.3%

        \[\leadsto \left(x \cdot z\right) \cdot \frac{\mathsf{fma}\left(y, y, \color{blue}{-1}\right)}{y + 1} \]
      3. fma-neg52.3%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 85.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{+73}:\\ \;\;\;\;z \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+28}:\\ \;\;\;\;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 -3.8e+73)
   (* z (* y x))
   (if (<= y 1.3e+28) (* x (- 1.0 z)) (* y (* z x)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.8e+73) {
		tmp = z * (y * x);
	} else if (y <= 1.3e+28) {
		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 <= (-3.8d+73)) then
        tmp = z * (y * x)
    else if (y <= 1.3d+28) 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 <= -3.8e+73) {
		tmp = z * (y * x);
	} else if (y <= 1.3e+28) {
		tmp = x * (1.0 - z);
	} else {
		tmp = y * (z * x);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -3.8e+73:
		tmp = z * (y * x)
	elif y <= 1.3e+28:
		tmp = x * (1.0 - z)
	else:
		tmp = y * (z * x)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -3.8e+73)
		tmp = Float64(z * Float64(y * x));
	elseif (y <= 1.3e+28)
		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 <= -3.8e+73)
		tmp = z * (y * x);
	elseif (y <= 1.3e+28)
		tmp = x * (1.0 - z);
	else
		tmp = y * (z * x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -3.8e+73], N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e+28], 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 -3.8 \cdot 10^{+73}:\\
\;\;\;\;z \cdot \left(y \cdot x\right)\\

\mathbf{elif}\;y \leq 1.3 \cdot 10^{+28}:\\
\;\;\;\;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 < -3.80000000000000022e73

    1. Initial program 88.7%

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

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

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

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

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

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

    if -3.80000000000000022e73 < y < 1.3000000000000001e28

    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 95.9%

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

    if 1.3000000000000001e28 < y

    1. Initial program 91.7%

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

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

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

        \[\leadsto \left(x \cdot z\right) \cdot \color{blue}{\frac{y \cdot y - 1 \cdot 1}{y + 1}} \]
      3. associate-*r/49.7%

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

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

        \[\leadsto \frac{\left(x \cdot z\right) \cdot \color{blue}{\mathsf{fma}\left(y, y, -1\right)}}{y + 1} \]
      6. metadata-eval49.7%

        \[\leadsto \frac{\left(x \cdot z\right) \cdot \mathsf{fma}\left(y, y, \color{blue}{-1}\right)}{y + 1} \]
    5. Applied egg-rr49.7%

      \[\leadsto \color{blue}{\frac{\left(x \cdot z\right) \cdot \mathsf{fma}\left(y, y, -1\right)}{y + 1}} \]
    6. Step-by-step derivation
      1. associate-/l*52.3%

        \[\leadsto \color{blue}{\left(x \cdot z\right) \cdot \frac{\mathsf{fma}\left(y, y, -1\right)}{y + 1}} \]
      2. metadata-eval52.3%

        \[\leadsto \left(x \cdot z\right) \cdot \frac{\mathsf{fma}\left(y, y, \color{blue}{-1}\right)}{y + 1} \]
      3. fma-neg52.3%

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

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

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

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

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

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

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

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

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

Alternative 9: 65.0% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 92.0%

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

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

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

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

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

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

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

    if -1 < 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 74.9%

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

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

Alternative 10: 66.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.3 \cdot 10^{+212}:\\
\;\;\;\;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 < 2.2999999999999998e212

    1. Initial program 96.0%

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

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

    if 2.2999999999999998e212 < y

    1. Initial program 94.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(-x\right)} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt1.5%

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

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

        \[\leadsto z \cdot \sqrt{\color{blue}{x \cdot x}} \]
      4. sqrt-unprod27.5%

        \[\leadsto z \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \]
      5. add-sqr-sqrt35.0%

        \[\leadsto z \cdot \color{blue}{x} \]
      6. pow135.0%

        \[\leadsto \color{blue}{{\left(z \cdot x\right)}^{1}} \]
    8. Applied egg-rr35.0%

      \[\leadsto \color{blue}{{\left(z \cdot x\right)}^{1}} \]
    9. Step-by-step derivation
      1. unpow135.0%

        \[\leadsto \color{blue}{z \cdot x} \]
      2. *-commutative35.0%

        \[\leadsto \color{blue}{x \cdot z} \]
    10. Simplified35.0%

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

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

Alternative 11: 40.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+91}:\\
\;\;\;\;z \cdot x\\

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


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

    1. Initial program 86.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(-x\right)} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt32.4%

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

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

        \[\leadsto z \cdot \sqrt{\color{blue}{x \cdot x}} \]
      4. sqrt-unprod6.5%

        \[\leadsto z \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \]
      5. add-sqr-sqrt13.4%

        \[\leadsto z \cdot \color{blue}{x} \]
      6. pow113.4%

        \[\leadsto \color{blue}{{\left(z \cdot x\right)}^{1}} \]
    8. Applied egg-rr13.4%

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

        \[\leadsto \color{blue}{z \cdot x} \]
      2. *-commutative13.4%

        \[\leadsto \color{blue}{x \cdot z} \]
    10. Simplified13.4%

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

    if -4.3000000000000001e91 < z

    1. Initial program 98.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+91}:\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 39.3% 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.9%

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

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

Developer Target 1: 99.7% 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 2024145 
(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))))