Average Error: 3.0 → 0.1
Time: 2.5s
Precision: 64
\[x \cdot \left(1 - y \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;y \cdot z \le -6.190538439488532156885246023707942998935 \cdot 10^{277} \lor \neg \left(y \cdot z \le 1.535148570325797106530223815276498078201 \cdot 10^{308}\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 \le -6.190538439488532156885246023707942998935 \cdot 10^{277} \lor \neg \left(y \cdot z \le 1.535148570325797106530223815276498078201 \cdot 10^{308}\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 r246598 = x;
        double r246599 = 1.0;
        double r246600 = y;
        double r246601 = z;
        double r246602 = r246600 * r246601;
        double r246603 = r246599 - r246602;
        double r246604 = r246598 * r246603;
        return r246604;
}

double f(double x, double y, double z) {
        double r246605 = y;
        double r246606 = z;
        double r246607 = r246605 * r246606;
        double r246608 = -6.190538439488532e+277;
        bool r246609 = r246607 <= r246608;
        double r246610 = 1.5351485703257971e+308;
        bool r246611 = r246607 <= r246610;
        double r246612 = !r246611;
        bool r246613 = r246609 || r246612;
        double r246614 = x;
        double r246615 = 1.0;
        double r246616 = r246614 * r246615;
        double r246617 = r246614 * r246605;
        double r246618 = -r246606;
        double r246619 = r246617 * r246618;
        double r246620 = r246616 + r246619;
        double r246621 = r246615 - r246607;
        double r246622 = r246614 * r246621;
        double r246623 = r246606 * r246605;
        double r246624 = fma(r246618, r246605, r246623);
        double r246625 = r246614 * r246624;
        double r246626 = r246622 + r246625;
        double r246627 = r246613 ? r246620 : r246626;
        return r246627;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Split input into 2 regimes
  2. if (* y z) < -6.190538439488532e+277 or 1.5351485703257971e+308 < (* y z)

    1. Initial program 55.8

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

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

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

      \[\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 -6.190538439488532e+277 < (* y z) < 1.5351485703257971e+308

    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 \le -6.190538439488532156885246023707942998935 \cdot 10^{277} \lor \neg \left(y \cdot z \le 1.535148570325797106530223815276498078201 \cdot 10^{308}\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 2019353 +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))))