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

Percentage Accurate: 95.9% → 97.9%
Time: 8.1s
Alternatives: 13
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 13 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.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(1 - y\right) \cdot z \leq -1 \cdot 10^{+308}:\\ \;\;\;\;z \cdot \left(y \cdot x\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+308) (* z (* y x)) (+ x (* x (* z (+ y -1.0))))))
double code(double x, double y, double z) {
	double tmp;
	if (((1.0 - y) * z) <= -1e+308) {
		tmp = z * (y * x);
	} 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+308)) then
        tmp = z * (y * x)
    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+308) {
		tmp = z * (y * x);
	} else {
		tmp = x + (x * (z * (y + -1.0)));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if ((1.0 - y) * z) <= -1e+308:
		tmp = z * (y * x)
	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+308)
		tmp = Float64(z * Float64(y * x));
	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+308)
		tmp = z * (y * x);
	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+308], N[(z * N[(y * x), $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^{+308}:\\
\;\;\;\;z \cdot \left(y \cdot x\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) < -1e308

    1. Initial program 60.4%

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

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

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

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

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

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

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

    1. Initial program 99.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(1 - y\right) \cdot z \leq -1 \cdot 10^{+308}:\\ \;\;\;\;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 2: 97.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(1 - y\right) \cdot z \leq -1 \cdot 10^{+308}:\\ \;\;\;\;z \cdot \left(y \cdot x\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+308)
   (* z (* y x))
   (* x (+ 1.0 (* z (+ y -1.0))))))
double code(double x, double y, double z) {
	double tmp;
	if (((1.0 - y) * z) <= -1e+308) {
		tmp = z * (y * x);
	} 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+308)) then
        tmp = z * (y * x)
    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+308) {
		tmp = z * (y * x);
	} else {
		tmp = x * (1.0 + (z * (y + -1.0)));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if ((1.0 - y) * z) <= -1e+308:
		tmp = z * (y * x)
	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+308)
		tmp = Float64(z * Float64(y * x));
	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+308)
		tmp = z * (y * x);
	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+308], N[(z * N[(y * x), $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^{+308}:\\
\;\;\;\;z \cdot \left(y \cdot x\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) < -1e308

    1. Initial program 60.4%

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

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

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

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

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

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

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

    1. Initial program 99.5%

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

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

Alternative 3: 98.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.35 \cdot 10^{+19} \lor \neg \left(z \leq 1\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 -1.35e+19) (not (<= z 1.0)))
   (* (+ y -1.0) (* z x))
   (* x (+ 1.0 (* y z)))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.35e+19) || !(z <= 1.0)) {
		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 <= (-1.35d+19)) .or. (.not. (z <= 1.0d0))) 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 <= -1.35e+19) || !(z <= 1.0)) {
		tmp = (y + -1.0) * (z * x);
	} else {
		tmp = x * (1.0 + (y * z));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -1.35e+19) or not (z <= 1.0):
		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 <= -1.35e+19) || !(z <= 1.0))
		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 <= -1.35e+19) || ~((z <= 1.0)))
		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, -1.35e+19], N[Not[LessEqual[z, 1.0]], $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 -1.35 \cdot 10^{+19} \lor \neg \left(z \leq 1\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 < -1.35e19 or 1 < z

    1. Initial program 93.4%

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

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

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

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

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

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

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

    if -1.35e19 < 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 y around inf 99.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.35 \cdot 10^{+19} \lor \neg \left(z \leq 1\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 4: 95.2% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 93.3%

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

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

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

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

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

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

    if -1 < y < 0.0115

    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.5%

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

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

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

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

      \[\leadsto x + \color{blue}{z \cdot \left(-x\right)} \]
    7. Taylor expanded in x around 0 99.5%

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot z\right)} \]
    8. Step-by-step derivation
      1. distribute-lft-in99.5%

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

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

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

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

        \[\leadsto \color{blue}{x - x \cdot z} \]
    9. Simplified99.5%

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

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

Alternative 5: 83.9% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 85.7%

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

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

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

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

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

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

    if -7.19999999999999952e29 < y < 1

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

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

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

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

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

      \[\leadsto x + \color{blue}{z \cdot \left(-x\right)} \]
    7. Taylor expanded in x around 0 98.2%

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot z\right)} \]
    8. Step-by-step derivation
      1. distribute-lft-in98.3%

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

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

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

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

        \[\leadsto \color{blue}{x - x \cdot z} \]
    9. Simplified98.3%

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

    if 1 < y

    1. Initial program 98.4%

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

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

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

Alternative 6: 85.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+34} \lor \neg \left(y \leq 55\right):\\
\;\;\;\;z \cdot \left(y \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 < -5.19999999999999995e34 or 55 < y

    1. Initial program 92.7%

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

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

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

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

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

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

    if -5.19999999999999995e34 < y < 55

    1. Initial program 100.0%

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

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

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

Alternative 7: 83.8% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 85.7%

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

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

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

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

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

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

    if -1.9000000000000002e32 < y < 180

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

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

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

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

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

      \[\leadsto x + \color{blue}{z \cdot \left(-x\right)} \]
    7. Taylor expanded in x around 0 98.2%

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot z\right)} \]
    8. Step-by-step derivation
      1. distribute-lft-in98.3%

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

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

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

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

        \[\leadsto \color{blue}{x - x \cdot z} \]
    9. Simplified98.3%

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

    if 180 < y

    1. Initial program 98.4%

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

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

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

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

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

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

Alternative 8: 83.7% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 85.7%

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

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

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

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

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

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

    if -6.59999999999999953e33 < y < 190

    1. Initial program 100.0%

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

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

    if 190 < y

    1. Initial program 98.4%

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

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

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

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

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

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

Alternative 9: 85.5% accurate, 0.6× speedup?

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

\mathbf{elif}\;y \leq 190:\\
\;\;\;\;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 < -1.05e30

    1. Initial program 85.7%

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

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

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

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

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

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

    if -1.05e30 < y < 190

    1. Initial program 100.0%

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

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

    if 190 < y

    1. Initial program 98.4%

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

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

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

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

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

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

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

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

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

Alternative 10: 65.6% 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 93.5%

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 99.8%

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

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

    \[\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 11: 41.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+70} \lor \neg \left(z \leq 52000000\right):\\
\;\;\;\;z \cdot x\\

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


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

    1. Initial program 93.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(z \cdot x\right) \cdot \left(y + -1\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-in78.5%

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

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

        \[\leadsto z \cdot \left(x \cdot y\right) + \color{blue}{\left(x \cdot z\right)} \cdot -1 \]
      4. add-cube-cbrt83.3%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, \left(x \cdot z\right) \cdot -1\right)} \]
      8. associate-*l*84.1%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, \color{blue}{x \cdot \left(z \cdot -1\right)}\right) \]
      9. *-commutative84.1%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, \color{blue}{\left(z \cdot -1\right) \cdot x}\right) \]
      10. associate-*r*84.1%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, \color{blue}{z \cdot \left(-1 \cdot x\right)}\right) \]
      11. neg-mul-184.1%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot \color{blue}{\left(-x\right)}\right) \]
      12. add-sqr-sqrt32.1%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)}\right) \]
      13. sqrt-unprod55.7%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}\right) \]
      14. sqr-neg55.7%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot \sqrt{\color{blue}{x \cdot x}}\right) \]
      15. sqrt-unprod29.4%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}\right) \]
      16. add-sqr-sqrt46.6%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot \color{blue}{x}\right) \]
    7. Applied egg-rr46.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot x\right)} \]
    8. Taylor expanded in y around 0 14.1%

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

    if -2.29999999999999994e70 < z < 5.2e7

    1. Initial program 99.2%

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

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

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

Alternative 12: 66.9% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.45 \cdot 10^{+165}:\\
\;\;\;\;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 < 1.45000000000000003e165

    1. Initial program 96.2%

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

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

    if 1.45000000000000003e165 < y

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, \left(x \cdot z\right) \cdot -1\right)} \]
      8. associate-*l*63.0%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, \color{blue}{x \cdot \left(z \cdot -1\right)}\right) \]
      9. *-commutative63.0%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, \color{blue}{\left(z \cdot -1\right) \cdot x}\right) \]
      10. associate-*r*63.0%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, \color{blue}{z \cdot \left(-1 \cdot x\right)}\right) \]
      11. neg-mul-163.0%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot \color{blue}{\left(-x\right)}\right) \]
      12. add-sqr-sqrt40.3%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)}\right) \]
      13. sqrt-unprod81.5%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}\right) \]
      14. sqr-neg81.5%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot \sqrt{\color{blue}{x \cdot x}}\right) \]
      15. sqrt-unprod41.2%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}\right) \]
      16. add-sqr-sqrt88.9%

        \[\leadsto \mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot \color{blue}{x}\right) \]
    7. Applied egg-rr88.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot {\left(\sqrt[3]{x \cdot y}\right)}^{2}, \sqrt[3]{x \cdot y}, z \cdot x\right)} \]
    8. Taylor expanded in y around 0 29.3%

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

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

Alternative 13: 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 96.6%

    \[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 2024158 
(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))))