Average Error: 3.8 → 0.2
Time: 3.2s
Precision: binary64
\[[y, z] = \mathsf{sort}([y, z]) \\]
\[x \cdot \left(1 - y \cdot z\right) \]
\[\begin{array}{l} t_0 := -y \cdot \left(z \cdot x\right)\\ \mathbf{if}\;y \cdot z \leq -2.247873275022244 \cdot 10^{+274}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \cdot z \leq 7.710288669014886 \cdot 10^{+211}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right) + x \cdot \mathsf{fma}\left(-z, y, y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
t_0 := -y \cdot \left(z \cdot x\right)\\
\mathbf{if}\;y \cdot z \leq -2.247873275022244 \cdot 10^{+274}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \cdot z \leq 7.710288669014886 \cdot 10^{+211}:\\
\;\;\;\;x \cdot \left(1 - y \cdot z\right) + x \cdot \mathsf{fma}\left(-z, y, y \cdot z\right)\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (* y (* z x)))))
   (if (<= (* y z) -2.247873275022244e+274)
     t_0
     (if (<= (* y z) 7.710288669014886e+211)
       (+ (* x (- 1.0 (* y z))) (* x (fma (- z) y (* y z))))
       t_0))))
double code(double x, double y, double z) {
	return x * (1.0 - (y * z));
}
double code(double x, double y, double z) {
	double t_0 = -(y * (z * x));
	double tmp;
	if ((y * z) <= -2.247873275022244e+274) {
		tmp = t_0;
	} else if ((y * z) <= 7.710288669014886e+211) {
		tmp = (x * (1.0 - (y * z))) + (x * fma(-z, y, (y * z)));
	} else {
		tmp = t_0;
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Split input into 2 regimes
  2. if (*.f64 y z) < -2.24787327502224399e274 or 7.71028866901488629e211 < (*.f64 y z)

    1. Initial program 37.2

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

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

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

    if -2.24787327502224399e274 < (*.f64 y z) < 7.71028866901488629e211

    1. Initial program 0.1

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Applied *-un-lft-identity_binary640.1

      \[\leadsto x \cdot \left(\color{blue}{1 \cdot 1} - y \cdot z\right) \]
    3. Applied prod-diff_binary640.1

      \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(1, 1, -z \cdot y\right) + \mathsf{fma}\left(-z, y, z \cdot y\right)\right)} \]
    4. Applied distribute-rgt-in_binary640.1

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

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

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

Reproduce

herbie shell --seed 2022088 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
  :precision binary64
  (* x (- 1.0 (* y z))))