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

Percentage Accurate: 96.2% → 99.5%
Time: 7.7s
Alternatives: 11
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 11 alternatives:

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

Initial Program: 96.2% 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.5% 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 5.5 \cdot 10^{-80}:\\ \;\;\;\;x\_m + \left(x\_m \cdot \left(-1 + y\right)\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\_m - x\_m \cdot \left(z \cdot \left(1 - y\right)\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (<= x_m 5.5e-80)
    (+ x_m (* (* x_m (+ -1.0 y)) z))
    (- x_m (* x_m (* z (- 1.0 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 (x_m <= 5.5e-80) {
		tmp = x_m + ((x_m * (-1.0 + y)) * z);
	} else {
		tmp = x_m - (x_m * (z * (1.0 - 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 (x_m <= 5.5d-80) then
        tmp = x_m + ((x_m * ((-1.0d0) + y)) * z)
    else
        tmp = x_m - (x_m * (z * (1.0d0 - 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 (x_m <= 5.5e-80) {
		tmp = x_m + ((x_m * (-1.0 + y)) * z);
	} else {
		tmp = x_m - (x_m * (z * (1.0 - 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 x_m <= 5.5e-80:
		tmp = x_m + ((x_m * (-1.0 + y)) * z)
	else:
		tmp = x_m - (x_m * (z * (1.0 - 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 (x_m <= 5.5e-80)
		tmp = Float64(x_m + Float64(Float64(x_m * Float64(-1.0 + y)) * z));
	else
		tmp = Float64(x_m - Float64(x_m * Float64(z * Float64(1.0 - 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 (x_m <= 5.5e-80)
		tmp = x_m + ((x_m * (-1.0 + y)) * z);
	else
		tmp = x_m - (x_m * (z * (1.0 - 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[LessEqual[x$95$m, 5.5e-80], N[(x$95$m + N[(N[(x$95$m * N[(-1.0 + y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x$95$m - N[(x$95$m * N[(z * N[(1.0 - y), $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 5.5 \cdot 10^{-80}:\\
\;\;\;\;x\_m + \left(x\_m \cdot \left(-1 + y\right)\right) \cdot z\\

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


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

    1. Initial program 92.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.4999999999999997e-80 < x

    1. Initial program 99.9%

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

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

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

Alternative 2: 65.0% accurate, 0.2× 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(y \cdot z\right)\\ t_1 := x\_m \cdot \left(-z\right)\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{+120}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{+52}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-46}:\\ \;\;\;\;x\_m\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+45} \lor \neg \left(z \leq 8 \cdot 10^{+149}\right) \land z \leq 1.9 \cdot 10^{+177}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (let* ((t_0 (* x_m (* y z))) (t_1 (* x_m (- z))))
   (*
    x_s
    (if (<= z -5.2e+120)
      t_1
      (if (<= z -5.8e+52)
        t_0
        (if (<= z -1.0)
          t_1
          (if (<= z 5.8e-46)
            x_m
            (if (or (<= z 6e+45) (and (not (<= z 8e+149)) (<= z 1.9e+177)))
              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 * (y * z);
	double t_1 = x_m * -z;
	double tmp;
	if (z <= -5.2e+120) {
		tmp = t_1;
	} else if (z <= -5.8e+52) {
		tmp = t_0;
	} else if (z <= -1.0) {
		tmp = t_1;
	} else if (z <= 5.8e-46) {
		tmp = x_m;
	} else if ((z <= 6e+45) || (!(z <= 8e+149) && (z <= 1.9e+177))) {
		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 * (y * z)
    t_1 = x_m * -z
    if (z <= (-5.2d+120)) then
        tmp = t_1
    else if (z <= (-5.8d+52)) then
        tmp = t_0
    else if (z <= (-1.0d0)) then
        tmp = t_1
    else if (z <= 5.8d-46) then
        tmp = x_m
    else if ((z <= 6d+45) .or. (.not. (z <= 8d+149)) .and. (z <= 1.9d+177)) 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 * (y * z);
	double t_1 = x_m * -z;
	double tmp;
	if (z <= -5.2e+120) {
		tmp = t_1;
	} else if (z <= -5.8e+52) {
		tmp = t_0;
	} else if (z <= -1.0) {
		tmp = t_1;
	} else if (z <= 5.8e-46) {
		tmp = x_m;
	} else if ((z <= 6e+45) || (!(z <= 8e+149) && (z <= 1.9e+177))) {
		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 * (y * z)
	t_1 = x_m * -z
	tmp = 0
	if z <= -5.2e+120:
		tmp = t_1
	elif z <= -5.8e+52:
		tmp = t_0
	elif z <= -1.0:
		tmp = t_1
	elif z <= 5.8e-46:
		tmp = x_m
	elif (z <= 6e+45) or (not (z <= 8e+149) and (z <= 1.9e+177)):
		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(y * z))
	t_1 = Float64(x_m * Float64(-z))
	tmp = 0.0
	if (z <= -5.2e+120)
		tmp = t_1;
	elseif (z <= -5.8e+52)
		tmp = t_0;
	elseif (z <= -1.0)
		tmp = t_1;
	elseif (z <= 5.8e-46)
		tmp = x_m;
	elseif ((z <= 6e+45) || (!(z <= 8e+149) && (z <= 1.9e+177)))
		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 * (y * z);
	t_1 = x_m * -z;
	tmp = 0.0;
	if (z <= -5.2e+120)
		tmp = t_1;
	elseif (z <= -5.8e+52)
		tmp = t_0;
	elseif (z <= -1.0)
		tmp = t_1;
	elseif (z <= 5.8e-46)
		tmp = x_m;
	elseif ((z <= 6e+45) || (~((z <= 8e+149)) && (z <= 1.9e+177)))
		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[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$95$m * (-z)), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -5.2e+120], t$95$1, If[LessEqual[z, -5.8e+52], t$95$0, If[LessEqual[z, -1.0], t$95$1, If[LessEqual[z, 5.8e-46], x$95$m, If[Or[LessEqual[z, 6e+45], And[N[Not[LessEqual[z, 8e+149]], $MachinePrecision], LessEqual[z, 1.9e+177]]], 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(y \cdot z\right)\\
t_1 := x\_m \cdot \left(-z\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+120}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -5.8 \cdot 10^{+52}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -1:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 5.8 \cdot 10^{-46}:\\
\;\;\;\;x\_m\\

\mathbf{elif}\;z \leq 6 \cdot 10^{+45} \lor \neg \left(z \leq 8 \cdot 10^{+149}\right) \land z \leq 1.9 \cdot 10^{+177}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.1999999999999998e120 or -5.8e52 < z < -1 or 6.00000000000000021e45 < z < 8.00000000000000039e149 or 1.8999999999999999e177 < z

    1. Initial program 87.1%

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

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

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

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

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

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

    if -5.1999999999999998e120 < z < -5.8e52 or 5.80000000000000009e-46 < z < 6.00000000000000021e45 or 8.00000000000000039e149 < z < 1.8999999999999999e177

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

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

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

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

    if -1 < z < 5.80000000000000009e-46

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{+120}:\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{+52}:\\ \;\;\;\;x \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-46}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+45} \lor \neg \left(z \leq 8 \cdot 10^{+149}\right) \land z \leq 1.9 \cdot 10^{+177}:\\ \;\;\;\;x \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 97.9% 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 \cdot \left(1 - y\right) \leq 2 \cdot 10^{+168}:\\ \;\;\;\;x\_m \cdot \left(1 + z \cdot \left(-1 + y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x\_m \cdot \left(-1 + y\right)\right) \cdot z\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (<= (* z (- 1.0 y)) 2e+168)
    (* x_m (+ 1.0 (* z (+ -1.0 y))))
    (* (* x_m (+ -1.0 y)) 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.0 - y)) <= 2e+168) {
		tmp = x_m * (1.0 + (z * (-1.0 + y)));
	} else {
		tmp = (x_m * (-1.0 + y)) * 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.0d0 - y)) <= 2d+168) then
        tmp = x_m * (1.0d0 + (z * ((-1.0d0) + y)))
    else
        tmp = (x_m * ((-1.0d0) + y)) * 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.0 - y)) <= 2e+168) {
		tmp = x_m * (1.0 + (z * (-1.0 + y)));
	} else {
		tmp = (x_m * (-1.0 + y)) * 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.0 - y)) <= 2e+168:
		tmp = x_m * (1.0 + (z * (-1.0 + y)))
	else:
		tmp = (x_m * (-1.0 + y)) * 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 (Float64(z * Float64(1.0 - y)) <= 2e+168)
		tmp = Float64(x_m * Float64(1.0 + Float64(z * Float64(-1.0 + y))));
	else
		tmp = Float64(Float64(x_m * Float64(-1.0 + y)) * 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.0 - y)) <= 2e+168)
		tmp = x_m * (1.0 + (z * (-1.0 + y)));
	else
		tmp = (x_m * (-1.0 + y)) * 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[N[(z * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], 2e+168], N[(x$95$m * N[(1.0 + N[(z * N[(-1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * N[(-1.0 + y), $MachinePrecision]), $MachinePrecision] * 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}\;z \cdot \left(1 - y\right) \leq 2 \cdot 10^{+168}:\\
\;\;\;\;x\_m \cdot \left(1 + z \cdot \left(-1 + y\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (-.f64 1 y) z) < 1.9999999999999999e168

    1. Initial program 98.1%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Add Preprocessing

    if 1.9999999999999999e168 < (*.f64 (-.f64 1 y) z)

    1. Initial program 80.5%

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

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

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

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

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

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

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

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

Alternative 4: 97.9% accurate, 0.5× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_0 := z \cdot \left(1 - y\right)\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 2 \cdot 10^{+168}:\\ \;\;\;\;x\_m - x\_m \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(x\_m \cdot \left(-1 + y\right)\right) \cdot z\\ \end{array} \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (let* ((t_0 (* z (- 1.0 y))))
   (* x_s (if (<= t_0 2e+168) (- x_m (* x_m t_0)) (* (* x_m (+ -1.0 y)) z)))))
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 = z * (1.0 - y);
	double tmp;
	if (t_0 <= 2e+168) {
		tmp = x_m - (x_m * t_0);
	} else {
		tmp = (x_m * (-1.0 + y)) * 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) :: t_0
    real(8) :: tmp
    t_0 = z * (1.0d0 - y)
    if (t_0 <= 2d+168) then
        tmp = x_m - (x_m * t_0)
    else
        tmp = (x_m * ((-1.0d0) + y)) * 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 t_0 = z * (1.0 - y);
	double tmp;
	if (t_0 <= 2e+168) {
		tmp = x_m - (x_m * t_0);
	} else {
		tmp = (x_m * (-1.0 + y)) * 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):
	t_0 = z * (1.0 - y)
	tmp = 0
	if t_0 <= 2e+168:
		tmp = x_m - (x_m * t_0)
	else:
		tmp = (x_m * (-1.0 + y)) * z
	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(z * Float64(1.0 - y))
	tmp = 0.0
	if (t_0 <= 2e+168)
		tmp = Float64(x_m - Float64(x_m * t_0));
	else
		tmp = Float64(Float64(x_m * Float64(-1.0 + y)) * 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)
	t_0 = z * (1.0 - y);
	tmp = 0.0;
	if (t_0 <= 2e+168)
		tmp = x_m - (x_m * t_0);
	else
		tmp = (x_m * (-1.0 + y)) * 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_] := Block[{t$95$0 = N[(z * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, 2e+168], N[(x$95$m - N[(x$95$m * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * N[(-1.0 + y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)

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

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (-.f64 1 y) z) < 1.9999999999999999e168

    1. Initial program 98.1%

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

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

    if 1.9999999999999999e168 < (*.f64 (-.f64 1 y) z)

    1. Initial program 80.5%

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

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

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

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

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

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

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

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

Alternative 5: 85.3% 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}\;y \leq -180000 \lor \neg \left(y \leq 6 \cdot 10^{+76}\right):\\ \;\;\;\;\left(x\_m \cdot \left(-1 + y\right)\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \left(1 - z\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= y -180000.0) (not (<= y 6e+76)))
    (* (* x_m (+ -1.0 y)) 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 <= -180000.0) || !(y <= 6e+76)) {
		tmp = (x_m * (-1.0 + y)) * 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 <= (-180000.0d0)) .or. (.not. (y <= 6d+76))) then
        tmp = (x_m * ((-1.0d0) + y)) * 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 <= -180000.0) || !(y <= 6e+76)) {
		tmp = (x_m * (-1.0 + y)) * 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 <= -180000.0) or not (y <= 6e+76):
		tmp = (x_m * (-1.0 + y)) * 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 <= -180000.0) || !(y <= 6e+76))
		tmp = Float64(Float64(x_m * Float64(-1.0 + y)) * 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 <= -180000.0) || ~((y <= 6e+76)))
		tmp = (x_m * (-1.0 + y)) * 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, -180000.0], N[Not[LessEqual[y, 6e+76]], $MachinePrecision]], N[(N[(x$95$m * N[(-1.0 + y), $MachinePrecision]), $MachinePrecision] * z), $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 -180000 \lor \neg \left(y \leq 6 \cdot 10^{+76}\right):\\
\;\;\;\;\left(x\_m \cdot \left(-1 + y\right)\right) \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.8e5 or 5.9999999999999996e76 < y

    1. Initial program 86.5%

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

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

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

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

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

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

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

    if -1.8e5 < y < 5.9999999999999996e76

    1. Initial program 99.4%

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

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

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

Alternative 6: 95.5% 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}\;y \leq -64000 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;x\_m + z \cdot \left(x\_m \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 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= y -64000.0) (not (<= y 1.0)))
    (+ x_m (* z (* x_m 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 <= -64000.0) || !(y <= 1.0)) {
		tmp = x_m + (z * (x_m * 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 <= (-64000.0d0)) .or. (.not. (y <= 1.0d0))) then
        tmp = x_m + (z * (x_m * 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 <= -64000.0) || !(y <= 1.0)) {
		tmp = x_m + (z * (x_m * 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 <= -64000.0) or not (y <= 1.0):
		tmp = x_m + (z * (x_m * 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 <= -64000.0) || !(y <= 1.0))
		tmp = Float64(x_m + Float64(z * Float64(x_m * 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 <= -64000.0) || ~((y <= 1.0)))
		tmp = x_m + (z * (x_m * 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, -64000.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(x$95$m + N[(z * N[(x$95$m * y), $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}\;y \leq -64000 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;x\_m + z \cdot \left(x\_m \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 < -64000 or 1 < y

    1. Initial program 88.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -64000 < 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 y around 0 98.9%

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

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

Alternative 7: 99.0% 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 -0.95 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\left(x\_m \cdot \left(-1 + y\right)\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\_m + x\_m \cdot \left(y \cdot z\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= z -0.95) (not (<= z 1.0)))
    (* (* x_m (+ -1.0 y)) z)
    (+ x_m (* x_m (* y 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 <= -0.95) || !(z <= 1.0)) {
		tmp = (x_m * (-1.0 + y)) * z;
	} else {
		tmp = x_m + (x_m * (y * 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 <= (-0.95d0)) .or. (.not. (z <= 1.0d0))) then
        tmp = (x_m * ((-1.0d0) + y)) * z
    else
        tmp = x_m + (x_m * (y * 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 <= -0.95) || !(z <= 1.0)) {
		tmp = (x_m * (-1.0 + y)) * z;
	} else {
		tmp = x_m + (x_m * (y * 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 <= -0.95) or not (z <= 1.0):
		tmp = (x_m * (-1.0 + y)) * z
	else:
		tmp = x_m + (x_m * (y * 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 <= -0.95) || !(z <= 1.0))
		tmp = Float64(Float64(x_m * Float64(-1.0 + y)) * z);
	else
		tmp = Float64(x_m + Float64(x_m * Float64(y * 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 <= -0.95) || ~((z <= 1.0)))
		tmp = (x_m * (-1.0 + y)) * z;
	else
		tmp = x_m + (x_m * (y * 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, -0.95], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(x$95$m * N[(-1.0 + y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(x$95$m + N[(x$95$m * N[(y * z), $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 -0.95 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\left(x\_m \cdot \left(-1 + y\right)\right) \cdot z\\

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


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

    1. Initial program 89.3%

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

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

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

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

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

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

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

    if -0.94999999999999996 < 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 98.4%

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(-y \cdot z\right)}\right) \]
      2. distribute-lft-neg-out98.4%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 83.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 -230000 \lor \neg \left(y \leq 6.5 \cdot 10^{+76}\right):\\ \;\;\;\;x\_m \cdot \left(y \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 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= y -230000.0) (not (<= y 6.5e+76)))
    (* x_m (* y 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 <= -230000.0) || !(y <= 6.5e+76)) {
		tmp = x_m * (y * 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 <= (-230000.0d0)) .or. (.not. (y <= 6.5d+76))) then
        tmp = x_m * (y * 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 <= -230000.0) || !(y <= 6.5e+76)) {
		tmp = x_m * (y * 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 <= -230000.0) or not (y <= 6.5e+76):
		tmp = x_m * (y * 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 <= -230000.0) || !(y <= 6.5e+76))
		tmp = Float64(x_m * Float64(y * 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 <= -230000.0) || ~((y <= 6.5e+76)))
		tmp = x_m * (y * 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, -230000.0], N[Not[LessEqual[y, 6.5e+76]], $MachinePrecision]], N[(x$95$m * N[(y * 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 -230000 \lor \neg \left(y \leq 6.5 \cdot 10^{+76}\right):\\
\;\;\;\;x\_m \cdot \left(y \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 < -2.3e5 or 6.5000000000000005e76 < y

    1. Initial program 86.5%

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

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

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

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

    if -2.3e5 < y < 6.5000000000000005e76

    1. Initial program 99.4%

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

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

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

Alternative 9: 85.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 -230000 \lor \neg \left(y \leq 9 \cdot 10^{+76}\right):\\ \;\;\;\;z \cdot \left(x\_m \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 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= y -230000.0) (not (<= y 9e+76)))
    (* z (* x_m 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 <= -230000.0) || !(y <= 9e+76)) {
		tmp = z * (x_m * 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 <= (-230000.0d0)) .or. (.not. (y <= 9d+76))) then
        tmp = z * (x_m * 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 <= -230000.0) || !(y <= 9e+76)) {
		tmp = z * (x_m * 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 <= -230000.0) or not (y <= 9e+76):
		tmp = z * (x_m * 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 <= -230000.0) || !(y <= 9e+76))
		tmp = Float64(z * Float64(x_m * 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 <= -230000.0) || ~((y <= 9e+76)))
		tmp = z * (x_m * 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, -230000.0], N[Not[LessEqual[y, 9e+76]], $MachinePrecision]], N[(z * N[(x$95$m * 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 -230000 \lor \neg \left(y \leq 9 \cdot 10^{+76}\right):\\
\;\;\;\;z \cdot \left(x\_m \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 < -2.3e5 or 8.9999999999999995e76 < y

    1. Initial program 86.5%

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

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

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

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

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

    if -2.3e5 < y < 8.9999999999999995e76

    1. Initial program 99.4%

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

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

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

Alternative 10: 65.5% 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 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;x\_m \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (* x_s (if (or (<= z -1.0) (not (<= z 1.0))) (* 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 <= -1.0) || !(z <= 1.0)) {
		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 <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) 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 <= -1.0) || !(z <= 1.0)) {
		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 <= -1.0) or not (z <= 1.0):
		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 <= -1.0) || !(z <= 1.0))
		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 <= -1.0) || ~((z <= 1.0)))
		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, -1.0], N[Not[LessEqual[z, 1.0]], $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 -1 \lor \neg \left(z \leq 1\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 < -1 or 1 < z

    1. Initial program 89.3%

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 99.9%

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

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

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

Alternative 11: 39.2% 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 1 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 94.4%

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

    \[\leadsto \color{blue}{x} \]
  4. Final simplification38.0%

    \[\leadsto x \]
  5. Add Preprocessing

Developer target: 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 2024031 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J"
  :precision binary64

  :herbie-target
  (if (< (* x (- 1.0 (* (- 1.0 y) z))) -1.618195973607049e+50) (+ x (* (- 1.0 y) (* (- z) x))) (if (< (* x (- 1.0 (* (- 1.0 y) z))) 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1.0 y) (* (- z) x)))))

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