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

Percentage Accurate: 96.1% → 99.8%
Time: 8.7s
Alternatives: 12
Speedup: 0.6×

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: 96.1% 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: 99.8% accurate, 0.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;x\_m \leq 3 \cdot 10^{-26}:\\ \;\;\;\;z \cdot \left(\frac{x\_m}{z} + x\_m \cdot \left(y + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \left(1 + z \cdot \left(y + -1\right)\right)\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (<= x_m 3e-26)
    (* z (+ (/ x_m z) (* x_m (+ y -1.0))))
    (* x_m (+ 1.0 (* z (+ y -1.0)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (x_m <= 3e-26) {
		tmp = z * ((x_m / z) + (x_m * (y + -1.0)));
	} else {
		tmp = x_m * (1.0 + (z * (y + -1.0)));
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x_m <= 3d-26) then
        tmp = z * ((x_m / z) + (x_m * (y + (-1.0d0))))
    else
        tmp = x_m * (1.0d0 + (z * (y + (-1.0d0))))
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (x_m <= 3e-26) {
		tmp = z * ((x_m / z) + (x_m * (y + -1.0)));
	} else {
		tmp = x_m * (1.0 + (z * (y + -1.0)));
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if x_m <= 3e-26:
		tmp = z * ((x_m / z) + (x_m * (y + -1.0)))
	else:
		tmp = x_m * (1.0 + (z * (y + -1.0)))
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if (x_m <= 3e-26)
		tmp = Float64(z * Float64(Float64(x_m / z) + Float64(x_m * Float64(y + -1.0))));
	else
		tmp = Float64(x_m * Float64(1.0 + Float64(z * Float64(y + -1.0))));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if (x_m <= 3e-26)
		tmp = z * ((x_m / z) + (x_m * (y + -1.0)));
	else
		tmp = x_m * (1.0 + (z * (y + -1.0)));
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[x$95$m, 3e-26], N[(z * N[(N[(x$95$m / z), $MachinePrecision] + N[(x$95$m * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(1.0 + N[(z * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 3.00000000000000012e-26

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

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

    if 3.00000000000000012e-26 < x

    1. Initial program 99.9%

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

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

Alternative 2: 64.4% accurate, 0.3× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_0 := x\_m \cdot \left(z \cdot y\right)\\ t_1 := x\_m \cdot \left(-z\right)\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -2.8 \cdot 10^{+16}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{-30}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-16}:\\ \;\;\;\;x\_m\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+100} \lor \neg \left(z \leq 7.5 \cdot 10^{+258}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (let* ((t_0 (* x_m (* z y))) (t_1 (* x_m (- z))))
   (*
    x_s
    (if (<= z -2.8e+16)
      t_1
      (if (<= z -6.6e-30)
        t_0
        (if (<= z 2.8e-16)
          x_m
          (if (or (<= z 5.5e+100) (not (<= z 7.5e+258))) t_0 t_1)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double t_0 = x_m * (z * y);
	double t_1 = x_m * -z;
	double tmp;
	if (z <= -2.8e+16) {
		tmp = t_1;
	} else if (z <= -6.6e-30) {
		tmp = t_0;
	} else if (z <= 2.8e-16) {
		tmp = x_m;
	} else if ((z <= 5.5e+100) || !(z <= 7.5e+258)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x_m * (z * y)
    t_1 = x_m * -z
    if (z <= (-2.8d+16)) then
        tmp = t_1
    else if (z <= (-6.6d-30)) then
        tmp = t_0
    else if (z <= 2.8d-16) then
        tmp = x_m
    else if ((z <= 5.5d+100) .or. (.not. (z <= 7.5d+258))) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double t_0 = x_m * (z * y);
	double t_1 = x_m * -z;
	double tmp;
	if (z <= -2.8e+16) {
		tmp = t_1;
	} else if (z <= -6.6e-30) {
		tmp = t_0;
	} else if (z <= 2.8e-16) {
		tmp = x_m;
	} else if ((z <= 5.5e+100) || !(z <= 7.5e+258)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	t_0 = x_m * (z * y)
	t_1 = x_m * -z
	tmp = 0
	if z <= -2.8e+16:
		tmp = t_1
	elif z <= -6.6e-30:
		tmp = t_0
	elif z <= 2.8e-16:
		tmp = x_m
	elif (z <= 5.5e+100) or not (z <= 7.5e+258):
		tmp = t_0
	else:
		tmp = t_1
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	t_0 = Float64(x_m * Float64(z * y))
	t_1 = Float64(x_m * Float64(-z))
	tmp = 0.0
	if (z <= -2.8e+16)
		tmp = t_1;
	elseif (z <= -6.6e-30)
		tmp = t_0;
	elseif (z <= 2.8e-16)
		tmp = x_m;
	elseif ((z <= 5.5e+100) || !(z <= 7.5e+258))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	t_0 = x_m * (z * y);
	t_1 = x_m * -z;
	tmp = 0.0;
	if (z <= -2.8e+16)
		tmp = t_1;
	elseif (z <= -6.6e-30)
		tmp = t_0;
	elseif (z <= 2.8e-16)
		tmp = x_m;
	elseif ((z <= 5.5e+100) || ~((z <= 7.5e+258)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := Block[{t$95$0 = N[(x$95$m * N[(z * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$95$m * (-z)), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -2.8e+16], t$95$1, If[LessEqual[z, -6.6e-30], t$95$0, If[LessEqual[z, 2.8e-16], x$95$m, If[Or[LessEqual[z, 5.5e+100], N[Not[LessEqual[z, 7.5e+258]], $MachinePrecision]], t$95$0, t$95$1]]]]), $MachinePrecision]]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
\begin{array}{l}
t_0 := x\_m \cdot \left(z \cdot y\right)\\
t_1 := x\_m \cdot \left(-z\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -6.6 \cdot 10^{-30}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 2.8 \cdot 10^{-16}:\\
\;\;\;\;x\_m\\

\mathbf{elif}\;z \leq 5.5 \cdot 10^{+100} \lor \neg \left(z \leq 7.5 \cdot 10^{+258}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.8e16 or 5.5000000000000002e100 < z < 7.50000000000000032e258

    1. Initial program 88.5%

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

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

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

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

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

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

    if -2.8e16 < z < -6.6000000000000006e-30 or 2.8000000000000001e-16 < z < 5.5000000000000002e100 or 7.50000000000000032e258 < z

    1. Initial program 97.8%

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

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

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

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

    if -6.6000000000000006e-30 < z < 2.8000000000000001e-16

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.8 \cdot 10^{+16}:\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{-30}:\\ \;\;\;\;x \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-16}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+100} \lor \neg \left(z \leq 7.5 \cdot 10^{+258}\right):\\ \;\;\;\;x \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 98.8% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -370000 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;z \cdot \left(x\_m \cdot \left(y + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \left(1 + z \cdot y\right)\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= z -370000.0) (not (<= z 1.0)))
    (* z (* x_m (+ y -1.0)))
    (* x_m (+ 1.0 (* z y))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((z <= -370000.0) || !(z <= 1.0)) {
		tmp = z * (x_m * (y + -1.0));
	} else {
		tmp = x_m * (1.0 + (z * y));
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-370000.0d0)) .or. (.not. (z <= 1.0d0))) then
        tmp = z * (x_m * (y + (-1.0d0)))
    else
        tmp = x_m * (1.0d0 + (z * y))
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((z <= -370000.0) || !(z <= 1.0)) {
		tmp = z * (x_m * (y + -1.0));
	} else {
		tmp = x_m * (1.0 + (z * y));
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if (z <= -370000.0) or not (z <= 1.0):
		tmp = z * (x_m * (y + -1.0))
	else:
		tmp = x_m * (1.0 + (z * y))
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if ((z <= -370000.0) || !(z <= 1.0))
		tmp = Float64(z * Float64(x_m * Float64(y + -1.0)));
	else
		tmp = Float64(x_m * Float64(1.0 + Float64(z * y)));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if ((z <= -370000.0) || ~((z <= 1.0)))
		tmp = z * (x_m * (y + -1.0));
	else
		tmp = x_m * (1.0 + (z * y));
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[z, -370000.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(z * N[(x$95$m * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(1.0 + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

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

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


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

    1. Initial program 90.8%

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

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

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

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

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

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

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

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

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

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

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

    if -3.7e5 < z < 1

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 86.4% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1.55 \cdot 10^{-30} \lor \neg \left(z \leq 9 \cdot 10^{-6}\right):\\ \;\;\;\;z \cdot \left(x\_m \cdot \left(y + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \left(1 - z\right)\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= z -1.55e-30) (not (<= z 9e-6)))
    (* z (* x_m (+ y -1.0)))
    (* x_m (- 1.0 z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((z <= -1.55e-30) || !(z <= 9e-6)) {
		tmp = z * (x_m * (y + -1.0));
	} else {
		tmp = x_m * (1.0 - z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-1.55d-30)) .or. (.not. (z <= 9d-6))) then
        tmp = z * (x_m * (y + (-1.0d0)))
    else
        tmp = x_m * (1.0d0 - z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((z <= -1.55e-30) || !(z <= 9e-6)) {
		tmp = z * (x_m * (y + -1.0));
	} else {
		tmp = x_m * (1.0 - z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if (z <= -1.55e-30) or not (z <= 9e-6):
		tmp = z * (x_m * (y + -1.0))
	else:
		tmp = x_m * (1.0 - z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if ((z <= -1.55e-30) || !(z <= 9e-6))
		tmp = Float64(z * Float64(x_m * Float64(y + -1.0)));
	else
		tmp = Float64(x_m * Float64(1.0 - z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if ((z <= -1.55e-30) || ~((z <= 9e-6)))
		tmp = z * (x_m * (y + -1.0));
	else
		tmp = x_m * (1.0 - z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[z, -1.55e-30], N[Not[LessEqual[z, 9e-6]], $MachinePrecision]], N[(z * N[(x$95$m * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{-30} \lor \neg \left(z \leq 9 \cdot 10^{-6}\right):\\
\;\;\;\;z \cdot \left(x\_m \cdot \left(y + -1\right)\right)\\

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


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

    1. Initial program 91.4%

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

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

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

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

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

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

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

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

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

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

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

    if -1.54999999999999995e-30 < z < 9.00000000000000023e-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 0 83.3%

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

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

Alternative 5: 82.7% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1.55 \cdot 10^{-28} \lor \neg \left(z \leq 0.0112\right):\\ \;\;\;\;x\_m \cdot \left(z \cdot \left(y + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \left(1 - z\right)\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= z -1.55e-28) (not (<= z 0.0112)))
    (* x_m (* z (+ y -1.0)))
    (* x_m (- 1.0 z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((z <= -1.55e-28) || !(z <= 0.0112)) {
		tmp = x_m * (z * (y + -1.0));
	} else {
		tmp = x_m * (1.0 - z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-1.55d-28)) .or. (.not. (z <= 0.0112d0))) then
        tmp = x_m * (z * (y + (-1.0d0)))
    else
        tmp = x_m * (1.0d0 - z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((z <= -1.55e-28) || !(z <= 0.0112)) {
		tmp = x_m * (z * (y + -1.0));
	} else {
		tmp = x_m * (1.0 - z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if (z <= -1.55e-28) or not (z <= 0.0112):
		tmp = x_m * (z * (y + -1.0))
	else:
		tmp = x_m * (1.0 - z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if ((z <= -1.55e-28) || !(z <= 0.0112))
		tmp = Float64(x_m * Float64(z * Float64(y + -1.0)));
	else
		tmp = Float64(x_m * Float64(1.0 - z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if ((z <= -1.55e-28) || ~((z <= 0.0112)))
		tmp = x_m * (z * (y + -1.0));
	else
		tmp = x_m * (1.0 - z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[z, -1.55e-28], N[Not[LessEqual[z, 0.0112]], $MachinePrecision]], N[(x$95$m * N[(z * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{-28} \lor \neg \left(z \leq 0.0112\right):\\
\;\;\;\;x\_m \cdot \left(z \cdot \left(y + -1\right)\right)\\

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


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

    1. Initial program 91.4%

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

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

    if -1.54999999999999996e-28 < z < 0.0111999999999999999

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

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

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

Alternative 6: 83.9% accurate, 0.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{+85} \lor \neg \left(y \leq 5.4 \cdot 10^{+107}\right):\\ \;\;\;\;y \cdot \left(x\_m \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \left(1 - z\right)\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= y -1e+85) (not (<= y 5.4e+107)))
    (* y (* x_m z))
    (* x_m (- 1.0 z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((y <= -1e+85) || !(y <= 5.4e+107)) {
		tmp = y * (x_m * z);
	} else {
		tmp = x_m * (1.0 - z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y <= (-1d+85)) .or. (.not. (y <= 5.4d+107))) then
        tmp = y * (x_m * z)
    else
        tmp = x_m * (1.0d0 - z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((y <= -1e+85) || !(y <= 5.4e+107)) {
		tmp = y * (x_m * z);
	} else {
		tmp = x_m * (1.0 - z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if (y <= -1e+85) or not (y <= 5.4e+107):
		tmp = y * (x_m * z)
	else:
		tmp = x_m * (1.0 - z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if ((y <= -1e+85) || !(y <= 5.4e+107))
		tmp = Float64(y * Float64(x_m * z));
	else
		tmp = Float64(x_m * Float64(1.0 - z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if ((y <= -1e+85) || ~((y <= 5.4e+107)))
		tmp = y * (x_m * z);
	else
		tmp = x_m * (1.0 - z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[y, -1e+85], N[Not[LessEqual[y, 5.4e+107]], $MachinePrecision]], N[(y * N[(x$95$m * z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+85} \lor \neg \left(y \leq 5.4 \cdot 10^{+107}\right):\\
\;\;\;\;y \cdot \left(x\_m \cdot z\right)\\

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


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

    1. Initial program 89.3%

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

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

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

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

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

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

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

    if -1e85 < y < 5.4000000000000003e107

    1. Initial program 98.2%

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

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

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

Alternative 7: 82.2% accurate, 0.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+85} \lor \neg \left(y \leq 2.5 \cdot 10^{+109}\right):\\ \;\;\;\;x\_m \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \left(1 - z\right)\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= y -1.4e+85) (not (<= y 2.5e+109)))
    (* x_m (* z y))
    (* x_m (- 1.0 z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((y <= -1.4e+85) || !(y <= 2.5e+109)) {
		tmp = x_m * (z * y);
	} else {
		tmp = x_m * (1.0 - z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y <= (-1.4d+85)) .or. (.not. (y <= 2.5d+109))) then
        tmp = x_m * (z * y)
    else
        tmp = x_m * (1.0d0 - z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((y <= -1.4e+85) || !(y <= 2.5e+109)) {
		tmp = x_m * (z * y);
	} else {
		tmp = x_m * (1.0 - z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if (y <= -1.4e+85) or not (y <= 2.5e+109):
		tmp = x_m * (z * y)
	else:
		tmp = x_m * (1.0 - z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if ((y <= -1.4e+85) || !(y <= 2.5e+109))
		tmp = Float64(x_m * Float64(z * y));
	else
		tmp = Float64(x_m * Float64(1.0 - z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if ((y <= -1.4e+85) || ~((y <= 2.5e+109)))
		tmp = x_m * (z * y);
	else
		tmp = x_m * (1.0 - z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[y, -1.4e+85], N[Not[LessEqual[y, 2.5e+109]], $MachinePrecision]], N[(x$95$m * N[(z * y), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+85} \lor \neg \left(y \leq 2.5 \cdot 10^{+109}\right):\\
\;\;\;\;x\_m \cdot \left(z \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.4e85 or 2.5000000000000001e109 < y

    1. Initial program 89.3%

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

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

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

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

    if -1.4e85 < y < 2.5000000000000001e109

    1. Initial program 98.2%

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

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

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

Alternative 8: 83.8% accurate, 0.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -1.46 \cdot 10^{+85}:\\ \;\;\;\;z \cdot \left(x\_m \cdot y\right)\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+106}:\\ \;\;\;\;x\_m \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x\_m \cdot z\right)\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (<= y -1.46e+85)
    (* z (* x_m y))
    (if (<= y 5e+106) (* x_m (- 1.0 z)) (* y (* x_m z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (y <= -1.46e+85) {
		tmp = z * (x_m * y);
	} else if (y <= 5e+106) {
		tmp = x_m * (1.0 - z);
	} else {
		tmp = y * (x_m * z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-1.46d+85)) then
        tmp = z * (x_m * y)
    else if (y <= 5d+106) then
        tmp = x_m * (1.0d0 - z)
    else
        tmp = y * (x_m * z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (y <= -1.46e+85) {
		tmp = z * (x_m * y);
	} else if (y <= 5e+106) {
		tmp = x_m * (1.0 - z);
	} else {
		tmp = y * (x_m * z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if y <= -1.46e+85:
		tmp = z * (x_m * y)
	elif y <= 5e+106:
		tmp = x_m * (1.0 - z)
	else:
		tmp = y * (x_m * z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if (y <= -1.46e+85)
		tmp = Float64(z * Float64(x_m * y));
	elseif (y <= 5e+106)
		tmp = Float64(x_m * Float64(1.0 - z));
	else
		tmp = Float64(y * Float64(x_m * z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if (y <= -1.46e+85)
		tmp = z * (x_m * y);
	elseif (y <= 5e+106)
		tmp = x_m * (1.0 - z);
	else
		tmp = y * (x_m * z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[y, -1.46e+85], N[(z * N[(x$95$m * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+106], N[(x$95$m * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x$95$m * z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

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

\mathbf{elif}\;y \leq 5 \cdot 10^{+106}:\\
\;\;\;\;x\_m \cdot \left(1 - z\right)\\

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


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

    1. Initial program 90.3%

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

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

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

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

    if -1.46e85 < y < 4.9999999999999998e106

    1. Initial program 98.2%

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

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

    if 4.9999999999999998e106 < y

    1. Initial program 88.1%

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

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

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

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

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

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

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

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

Alternative 9: 64.3% accurate, 0.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -7.2 \cdot 10^{-17} \lor \neg \left(z \leq 4.7\right):\\ \;\;\;\;x\_m \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (* x_s (if (or (<= z -7.2e-17) (not (<= z 4.7))) (* x_m (- z)) x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((z <= -7.2e-17) || !(z <= 4.7)) {
		tmp = x_m * -z;
	} else {
		tmp = x_m;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-7.2d-17)) .or. (.not. (z <= 4.7d0))) then
        tmp = x_m * -z
    else
        tmp = x_m
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((z <= -7.2e-17) || !(z <= 4.7)) {
		tmp = x_m * -z;
	} else {
		tmp = x_m;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if (z <= -7.2e-17) or not (z <= 4.7):
		tmp = x_m * -z
	else:
		tmp = x_m
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if ((z <= -7.2e-17) || !(z <= 4.7))
		tmp = Float64(x_m * Float64(-z));
	else
		tmp = x_m;
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if ((z <= -7.2e-17) || ~((z <= 4.7)))
		tmp = x_m * -z;
	else
		tmp = x_m;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[z, -7.2e-17], N[Not[LessEqual[z, 4.7]], $MachinePrecision]], N[(x$95$m * (-z)), $MachinePrecision], x$95$m]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-17} \lor \neg \left(z \leq 4.7\right):\\
\;\;\;\;x\_m \cdot \left(-z\right)\\

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


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

    1. Initial program 91.0%

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

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

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

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

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

    if -7.1999999999999999e-17 < z < 4.70000000000000018

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

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

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

Alternative 10: 97.7% accurate, 0.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{+72}:\\ \;\;\;\;z \cdot \left(x\_m \cdot \left(y + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \left(1 + z \cdot \left(y + -1\right)\right)\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (<= z -1e+72)
    (* z (* x_m (+ y -1.0)))
    (* x_m (+ 1.0 (* z (+ y -1.0)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (z <= -1e+72) {
		tmp = z * (x_m * (y + -1.0));
	} else {
		tmp = x_m * (1.0 + (z * (y + -1.0)));
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-1d+72)) then
        tmp = z * (x_m * (y + (-1.0d0)))
    else
        tmp = x_m * (1.0d0 + (z * (y + (-1.0d0))))
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (z <= -1e+72) {
		tmp = z * (x_m * (y + -1.0));
	} else {
		tmp = x_m * (1.0 + (z * (y + -1.0)));
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if z <= -1e+72:
		tmp = z * (x_m * (y + -1.0))
	else:
		tmp = x_m * (1.0 + (z * (y + -1.0)))
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if (z <= -1e+72)
		tmp = Float64(z * Float64(x_m * Float64(y + -1.0)));
	else
		tmp = Float64(x_m * Float64(1.0 + Float64(z * Float64(y + -1.0))));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if (z <= -1e+72)
		tmp = z * (x_m * (y + -1.0));
	else
		tmp = x_m * (1.0 + (z * (y + -1.0)));
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -1e+72], N[(z * N[(x$95$m * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(1.0 + N[(z * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

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

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


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

    1. Initial program 83.7%

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999944e71 < z

    1. Initial program 98.1%

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

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

Alternative 11: 39.0% accurate, 1.1× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq 3.2 \cdot 10^{+130}:\\ \;\;\;\;x\_m\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot z\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (* x_s (if (<= y 3.2e+130) x_m (* x_m z))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (y <= 3.2e+130) {
		tmp = x_m;
	} else {
		tmp = x_m * z;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= 3.2d+130) then
        tmp = x_m
    else
        tmp = x_m * z
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (y <= 3.2e+130) {
		tmp = x_m;
	} else {
		tmp = x_m * z;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if y <= 3.2e+130:
		tmp = x_m
	else:
		tmp = x_m * z
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if (y <= 3.2e+130)
		tmp = x_m;
	else
		tmp = Float64(x_m * z);
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if (y <= 3.2e+130)
		tmp = x_m;
	else
		tmp = x_m * z;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[y, 3.2e+130], x$95$m, N[(x$95$m * z), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq 3.2 \cdot 10^{+130}:\\
\;\;\;\;x\_m\\

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


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

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

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

    if 3.2e130 < y

    1. Initial program 85.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{z} \]
      6. pow123.9%

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

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

        \[\leadsto \color{blue}{x \cdot z} \]
    10. Simplified23.9%

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

Alternative 12: 38.7% accurate, 9.0× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot x\_m \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z) :precision binary64 (* x_s x_m))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	return x_s * x_m;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x_s * x_m
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	return x_s * x_m;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	return x_s * x_m
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	return Float64(x_s * x_m)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp = code(x_s, x_m, y, z)
	tmp = x_s * x_m;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * x$95$m), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot x\_m
\end{array}
Derivation
  1. Initial program 95.2%

    \[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.6% 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 2024123 
(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))))