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

Percentage Accurate: 96.1% → 98.0%
Time: 7.3s
Alternatives: 13
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 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: 98.0% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \leq 2 \cdot 10^{+51}:\\ \;\;\;\;x + z \cdot \left(x \cdot y - x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y + -1, x \cdot z, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= (* x (- 1.0 (* (- 1.0 y) z))) 2e+51)
   (+ x (* z (- (* x y) x)))
   (fma (+ y -1.0) (* x z) x)))
double code(double x, double y, double z) {
	double tmp;
	if ((x * (1.0 - ((1.0 - y) * z))) <= 2e+51) {
		tmp = x + (z * ((x * y) - x));
	} else {
		tmp = fma((y + -1.0), (x * z), x);
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (Float64(x * Float64(1.0 - Float64(Float64(1.0 - y) * z))) <= 2e+51)
		tmp = Float64(x + Float64(z * Float64(Float64(x * y) - x)));
	else
		tmp = fma(Float64(y + -1.0), Float64(x * z), x);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[N[(x * N[(1.0 - N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+51], N[(x + N[(z * N[(N[(x * y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y + -1.0), $MachinePrecision] * N[(x * z), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 97.2%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Step-by-step derivation
      1. sub-neg97.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(z, y + -1, 1\right)} \]
    4. Step-by-step derivation
      1. fma-udef97.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e51 < (*.f64 x (-.f64 1 (*.f64 (-.f64 1 y) z)))

    1. Initial program 94.2%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Step-by-step derivation
      1. distribute-rgt-out--94.2%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-\left(1 - y\right), z \cdot x, x\right)} \]
      8. neg-sub099.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{0 - \left(1 - y\right)}, z \cdot x, x\right) \]
      9. associate--r-99.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \leq 2 \cdot 10^{+51}:\\ \;\;\;\;x + z \cdot \left(x \cdot y - x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y + -1, x \cdot z, x\right)\\ \end{array} \]

Alternative 2: 97.8% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 5 \cdot 10^{-45}:\\ \;\;\;\;x \cdot \mathsf{fma}\left(z, y + -1, 1\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(x \cdot y - x\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z 5e-45) (* x (fma z (+ y -1.0) 1.0)) (+ x (* z (- (* x y) x)))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= 5e-45) {
		tmp = x * fma(z, (y + -1.0), 1.0);
	} else {
		tmp = x + (z * ((x * y) - x));
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (z <= 5e-45)
		tmp = Float64(x * fma(z, Float64(y + -1.0), 1.0));
	else
		tmp = Float64(x + Float64(z * Float64(Float64(x * y) - x)));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[z, 5e-45], N[(x * N[(z * N[(y + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(x * y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 97.9%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Step-by-step derivation
      1. sub-neg97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999976e-45 < z

    1. Initial program 91.6%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Step-by-step derivation
      1. sub-neg91.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 5 \cdot 10^{-45}:\\ \;\;\;\;x \cdot \mathsf{fma}\left(z, y + -1, 1\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(x \cdot y - x\right)\\ \end{array} \]

Alternative 3: 63.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -x \cdot z\\ t_1 := x \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -1.15 \cdot 10^{+43}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.9 \cdot 10^{-76}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{+54} \lor \neg \left(z \leq 5.8 \cdot 10^{+149}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (* x z))) (t_1 (* x (* y z))))
   (if (<= z -1.15e+43)
     t_0
     (if (<= z -3.9e-76)
       t_1
       (if (<= z 1.0)
         x
         (if (or (<= z 2.2e+54) (not (<= z 5.8e+149))) t_0 t_1))))))
double code(double x, double y, double z) {
	double t_0 = -(x * z);
	double t_1 = x * (y * z);
	double tmp;
	if (z <= -1.15e+43) {
		tmp = t_0;
	} else if (z <= -3.9e-76) {
		tmp = t_1;
	} else if (z <= 1.0) {
		tmp = x;
	} else if ((z <= 2.2e+54) || !(z <= 5.8e+149)) {
		tmp = t_0;
	} 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 * z)
    t_1 = x * (y * z)
    if (z <= (-1.15d+43)) then
        tmp = t_0
    else if (z <= (-3.9d-76)) then
        tmp = t_1
    else if (z <= 1.0d0) then
        tmp = x
    else if ((z <= 2.2d+54) .or. (.not. (z <= 5.8d+149))) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -(x * z);
	double t_1 = x * (y * z);
	double tmp;
	if (z <= -1.15e+43) {
		tmp = t_0;
	} else if (z <= -3.9e-76) {
		tmp = t_1;
	} else if (z <= 1.0) {
		tmp = x;
	} else if ((z <= 2.2e+54) || !(z <= 5.8e+149)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -(x * z)
	t_1 = x * (y * z)
	tmp = 0
	if z <= -1.15e+43:
		tmp = t_0
	elif z <= -3.9e-76:
		tmp = t_1
	elif z <= 1.0:
		tmp = x
	elif (z <= 2.2e+54) or not (z <= 5.8e+149):
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(-Float64(x * z))
	t_1 = Float64(x * Float64(y * z))
	tmp = 0.0
	if (z <= -1.15e+43)
		tmp = t_0;
	elseif (z <= -3.9e-76)
		tmp = t_1;
	elseif (z <= 1.0)
		tmp = x;
	elseif ((z <= 2.2e+54) || !(z <= 5.8e+149))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -(x * z);
	t_1 = x * (y * z);
	tmp = 0.0;
	if (z <= -1.15e+43)
		tmp = t_0;
	elseif (z <= -3.9e-76)
		tmp = t_1;
	elseif (z <= 1.0)
		tmp = x;
	elseif ((z <= 2.2e+54) || ~((z <= 5.8e+149)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = (-N[(x * z), $MachinePrecision])}, Block[{t$95$1 = N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.15e+43], t$95$0, If[LessEqual[z, -3.9e-76], t$95$1, If[LessEqual[z, 1.0], x, If[Or[LessEqual[z, 2.2e+54], N[Not[LessEqual[z, 5.8e+149]], $MachinePrecision]], t$95$0, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -x \cdot z\\
t_1 := x \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{+43}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -3.9 \cdot 10^{-76}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{+54} \lor \neg \left(z \leq 5.8 \cdot 10^{+149}\right):\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.1500000000000001e43 or 1 < z < 2.1999999999999999e54 or 5.8000000000000004e149 < z

    1. Initial program 94.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.1500000000000001e43 < z < -3.90000000000000025e-76 or 2.1999999999999999e54 < z < 5.8000000000000004e149

    1. Initial program 90.2%

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

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

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

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

    if -3.90000000000000025e-76 < z < 1

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+43}:\\ \;\;\;\;-x \cdot z\\ \mathbf{elif}\;z \leq -3.9 \cdot 10^{-76}:\\ \;\;\;\;x \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{+54} \lor \neg \left(z \leq 5.8 \cdot 10^{+149}\right):\\ \;\;\;\;-x \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot z\right)\\ \end{array} \]

Alternative 4: 64.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -x \cdot z\\ \mathbf{if}\;z \leq -6.8 \cdot 10^{+42}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.2 \cdot 10^{-76}:\\ \;\;\;\;x \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{+50} \lor \neg \left(z \leq 1.8 \cdot 10^{+166}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (* x z))))
   (if (<= z -6.8e+42)
     t_0
     (if (<= z -3.2e-76)
       (* x (* y z))
       (if (<= z 1.0)
         x
         (if (or (<= z 1.4e+50) (not (<= z 1.8e+166))) t_0 (* y (* x z))))))))
double code(double x, double y, double z) {
	double t_0 = -(x * z);
	double tmp;
	if (z <= -6.8e+42) {
		tmp = t_0;
	} else if (z <= -3.2e-76) {
		tmp = x * (y * z);
	} else if (z <= 1.0) {
		tmp = x;
	} else if ((z <= 1.4e+50) || !(z <= 1.8e+166)) {
		tmp = t_0;
	} else {
		tmp = y * (x * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -(x * z)
    if (z <= (-6.8d+42)) then
        tmp = t_0
    else if (z <= (-3.2d-76)) then
        tmp = x * (y * z)
    else if (z <= 1.0d0) then
        tmp = x
    else if ((z <= 1.4d+50) .or. (.not. (z <= 1.8d+166))) then
        tmp = t_0
    else
        tmp = y * (x * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -(x * z);
	double tmp;
	if (z <= -6.8e+42) {
		tmp = t_0;
	} else if (z <= -3.2e-76) {
		tmp = x * (y * z);
	} else if (z <= 1.0) {
		tmp = x;
	} else if ((z <= 1.4e+50) || !(z <= 1.8e+166)) {
		tmp = t_0;
	} else {
		tmp = y * (x * z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -(x * z)
	tmp = 0
	if z <= -6.8e+42:
		tmp = t_0
	elif z <= -3.2e-76:
		tmp = x * (y * z)
	elif z <= 1.0:
		tmp = x
	elif (z <= 1.4e+50) or not (z <= 1.8e+166):
		tmp = t_0
	else:
		tmp = y * (x * z)
	return tmp
function code(x, y, z)
	t_0 = Float64(-Float64(x * z))
	tmp = 0.0
	if (z <= -6.8e+42)
		tmp = t_0;
	elseif (z <= -3.2e-76)
		tmp = Float64(x * Float64(y * z));
	elseif (z <= 1.0)
		tmp = x;
	elseif ((z <= 1.4e+50) || !(z <= 1.8e+166))
		tmp = t_0;
	else
		tmp = Float64(y * Float64(x * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -(x * z);
	tmp = 0.0;
	if (z <= -6.8e+42)
		tmp = t_0;
	elseif (z <= -3.2e-76)
		tmp = x * (y * z);
	elseif (z <= 1.0)
		tmp = x;
	elseif ((z <= 1.4e+50) || ~((z <= 1.8e+166)))
		tmp = t_0;
	else
		tmp = y * (x * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = (-N[(x * z), $MachinePrecision])}, If[LessEqual[z, -6.8e+42], t$95$0, If[LessEqual[z, -3.2e-76], N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], x, If[Or[LessEqual[z, 1.4e+50], N[Not[LessEqual[z, 1.8e+166]], $MachinePrecision]], t$95$0, N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -x \cdot z\\
\mathbf{if}\;z \leq -6.8 \cdot 10^{+42}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -3.2 \cdot 10^{-76}:\\
\;\;\;\;x \cdot \left(y \cdot z\right)\\

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.4 \cdot 10^{+50} \lor \neg \left(z \leq 1.8 \cdot 10^{+166}\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -6.7999999999999995e42 or 1 < z < 1.3999999999999999e50 or 1.7999999999999999e166 < z

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.7999999999999995e42 < z < -3.1999999999999998e-76

    1. Initial program 99.8%

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

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

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

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

    if -3.1999999999999998e-76 < z < 1

    1. Initial program 99.9%

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

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

    if 1.3999999999999999e50 < z < 1.7999999999999999e166

    1. Initial program 81.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.8 \cdot 10^{+42}:\\ \;\;\;\;-x \cdot z\\ \mathbf{elif}\;z \leq -3.2 \cdot 10^{-76}:\\ \;\;\;\;x \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{+50} \lor \neg \left(z \leq 1.8 \cdot 10^{+166}\right):\\ \;\;\;\;-x \cdot z\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 5: 94.3% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.6e11 or 1.34999999999999994e-30 < y

    1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

    if -9.6e11 < y < 1.34999999999999994e-30

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto \color{blue}{x + \left(-z\right) \cdot x} \]
      4. cancel-sign-sub-inv99.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -960000000000 \lor \neg \left(y \leq 1.35 \cdot 10^{-30}\right):\\ \;\;\;\;x \cdot \left(1 + y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot z\\ \end{array} \]

Alternative 6: 98.1% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 91.6%

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

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

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

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

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

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

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

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

    if -4.2000000000000003e29 < z < 1

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 97.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 98.0%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]

    if 8.8e15 < z

    1. Initial program 89.5%

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

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

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

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

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

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

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

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

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

Alternative 8: 97.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 98.0%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Step-by-step derivation
      1. sub-neg98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.5e17 < z

    1. Initial program 89.5%

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

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

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

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

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

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

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

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

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

Alternative 9: 97.7% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 97.9%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Step-by-step derivation
      1. sub-neg97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e-79 < z

    1. Initial program 92.3%

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \]
    2. Step-by-step derivation
      1. sub-neg92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(z, y + -1, 1\right)} \]
    4. Step-by-step derivation
      1. fma-udef92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 82.0% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.9999999999999997e34 or 6.70000000000000037e165 < y

    1. Initial program 90.6%

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

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

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

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

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

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

    if -9.9999999999999997e34 < y < 6.70000000000000037e165

    1. Initial program 99.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{+35} \lor \neg \left(y \leq 6.7 \cdot 10^{+165}\right):\\ \;\;\;\;z \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \end{array} \]

Alternative 11: 82.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+36} \lor \neg \left(y \leq 6.7 \cdot 10^{+165}\right):\\
\;\;\;\;z \cdot \left(x \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3e36 or 6.70000000000000037e165 < y

    1. Initial program 90.6%

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

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

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

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

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

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

    if -3e36 < y < 6.70000000000000037e165

    1. Initial program 99.3%

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

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

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

        \[\leadsto \color{blue}{\left(\left(-z\right) + 1\right)} \cdot x \]
      3. distribute-rgt1-in91.0%

        \[\leadsto \color{blue}{x + \left(-z\right) \cdot x} \]
      4. cancel-sign-sub-inv91.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3 \cdot 10^{+36} \lor \neg \left(y \leq 6.7 \cdot 10^{+165}\right):\\ \;\;\;\;z \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot z\\ \end{array} \]

Alternative 12: 64.6% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 92.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.86e-6 < z < 1

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.86 \cdot 10^{-6} \lor \neg \left(z \leq 1\right):\\ \;\;\;\;-x \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 13: 38.7% accurate, 9.0× speedup?

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

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

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

    \[\leadsto \color{blue}{x} \]
  3. Final simplification42.1%

    \[\leadsto x \]

Developer target: 99.7% accurate, 0.3× 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 2023240 
(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))))