Average Error: 3.2 → 0.1
Time: 1.9s
Precision: 64
\[x \cdot \left(1 - y \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;y \cdot z = -\infty \lor \neg \left(y \cdot z \le 4.46375759606627534 \cdot 10^{301}\right):\\ \;\;\;\;x \cdot 1 + \left(x \cdot y\right) \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right) + x \cdot \mathsf{fma}\left(-z, y, z \cdot y\right)\\ \end{array}\]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z = -\infty \lor \neg \left(y \cdot z \le 4.46375759606627534 \cdot 10^{301}\right):\\
\;\;\;\;x \cdot 1 + \left(x \cdot y\right) \cdot \left(-z\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r233408 = x;
        double r233409 = 1.0;
        double r233410 = y;
        double r233411 = z;
        double r233412 = r233410 * r233411;
        double r233413 = r233409 - r233412;
        double r233414 = r233408 * r233413;
        return r233414;
}

double f(double x, double y, double z) {
        double r233415 = y;
        double r233416 = z;
        double r233417 = r233415 * r233416;
        double r233418 = -inf.0;
        bool r233419 = r233417 <= r233418;
        double r233420 = 4.463757596066275e+301;
        bool r233421 = r233417 <= r233420;
        double r233422 = !r233421;
        bool r233423 = r233419 || r233422;
        double r233424 = x;
        double r233425 = 1.0;
        double r233426 = r233424 * r233425;
        double r233427 = r233424 * r233415;
        double r233428 = -r233416;
        double r233429 = r233427 * r233428;
        double r233430 = r233426 + r233429;
        double r233431 = r233425 - r233417;
        double r233432 = r233424 * r233431;
        double r233433 = r233416 * r233415;
        double r233434 = fma(r233428, r233415, r233433);
        double r233435 = r233424 * r233434;
        double r233436 = r233432 + r233435;
        double r233437 = r233423 ? r233430 : r233436;
        return r233437;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Split input into 2 regimes
  2. if (* y z) < -inf.0 or 4.463757596066275e+301 < (* y z)

    1. Initial program 63.2

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

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

      \[\leadsto \color{blue}{x \cdot 1 + x \cdot \left(-y \cdot z\right)}\]
    5. Using strategy rm
    6. Applied distribute-rgt-neg-in63.2

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

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

    if -inf.0 < (* y z) < 4.463757596066275e+301

    1. Initial program 0.1

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

      \[\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-diff0.1

      \[\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-in0.1

      \[\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. Simplified0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z = -\infty \lor \neg \left(y \cdot z \le 4.46375759606627534 \cdot 10^{301}\right):\\ \;\;\;\;x \cdot 1 + \left(x \cdot y\right) \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right) + x \cdot \mathsf{fma}\left(-z, y, z \cdot y\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020100 +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))))