Average Error: 3.4 → 1.8
Time: 2.2s
Precision: 64
\[x \cdot \left(1 - y \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;y \cdot z \le 4.6923579209708362 \cdot 10^{247}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right) + x \cdot \mathsf{fma}\left(-z, y, z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 1 + \left(x \cdot \left(-y\right)\right) \cdot z\right) + x \cdot 0\\ \end{array}\]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \le 4.6923579209708362 \cdot 10^{247}:\\
\;\;\;\;x \cdot \left(1 - y \cdot z\right) + x \cdot \mathsf{fma}\left(-z, y, z \cdot y\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r291606 = x;
        double r291607 = 1.0;
        double r291608 = y;
        double r291609 = z;
        double r291610 = r291608 * r291609;
        double r291611 = r291607 - r291610;
        double r291612 = r291606 * r291611;
        return r291612;
}

double f(double x, double y, double z) {
        double r291613 = y;
        double r291614 = z;
        double r291615 = r291613 * r291614;
        double r291616 = 4.692357920970836e+247;
        bool r291617 = r291615 <= r291616;
        double r291618 = x;
        double r291619 = 1.0;
        double r291620 = r291619 - r291615;
        double r291621 = r291618 * r291620;
        double r291622 = -r291614;
        double r291623 = r291614 * r291613;
        double r291624 = fma(r291622, r291613, r291623);
        double r291625 = r291618 * r291624;
        double r291626 = r291621 + r291625;
        double r291627 = r291618 * r291619;
        double r291628 = -r291613;
        double r291629 = r291618 * r291628;
        double r291630 = r291629 * r291614;
        double r291631 = r291627 + r291630;
        double r291632 = 0.0;
        double r291633 = r291618 * r291632;
        double r291634 = r291631 + r291633;
        double r291635 = r291617 ? r291626 : r291634;
        return r291635;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Split input into 2 regimes
  2. if (* y z) < 4.692357920970836e+247

    1. Initial program 1.8

      \[x \cdot \left(1 - y \cdot z\right)\]
    2. Using strategy rm
    3. Applied add-cube-cbrt1.8

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

      \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{1} \cdot \sqrt[3]{1}, \sqrt[3]{1}, -z \cdot y\right) + \mathsf{fma}\left(-z, y, z \cdot y\right)\right)}\]
    5. Applied distribute-lft-in1.8

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

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

    if 4.692357920970836e+247 < (* y z)

    1. Initial program 37.2

      \[x \cdot \left(1 - y \cdot z\right)\]
    2. Using strategy rm
    3. Applied add-cube-cbrt37.2

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

      \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{1} \cdot \sqrt[3]{1}, \sqrt[3]{1}, -z \cdot y\right) + \mathsf{fma}\left(-z, y, z \cdot y\right)\right)}\]
    5. Applied distribute-lft-in37.2

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

      \[\leadsto \color{blue}{x \cdot \left(1 - y \cdot z\right)} + x \cdot \mathsf{fma}\left(-z, y, z \cdot y\right)\]
    7. Using strategy rm
    8. Applied sub-neg37.2

      \[\leadsto x \cdot \color{blue}{\left(1 + \left(-y \cdot z\right)\right)} + x \cdot \mathsf{fma}\left(-z, y, z \cdot y\right)\]
    9. Applied distribute-lft-in37.2

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

      \[\leadsto \left(x \cdot 1 + x \cdot \left(-y \cdot z\right)\right) + x \cdot \color{blue}{0}\]
    11. Using strategy rm
    12. Applied distribute-lft-neg-in37.2

      \[\leadsto \left(x \cdot 1 + x \cdot \color{blue}{\left(\left(-y\right) \cdot z\right)}\right) + x \cdot 0\]
    13. Applied associate-*r*0.5

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

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

Reproduce

herbie shell --seed 2020083 +o rules:numerics
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
  :precision binary64
  (* x (- 1 (* y z))))