Average Error: 3.0 → 0.1
Time: 2.6s
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 \left(-y\right)\right) \cdot z\\ \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 \left(-y\right)\right) \cdot z\\

\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 r223811 = x;
        double r223812 = 1.0;
        double r223813 = y;
        double r223814 = z;
        double r223815 = r223813 * r223814;
        double r223816 = r223812 - r223815;
        double r223817 = r223811 * r223816;
        return r223817;
}

double f(double x, double y, double z) {
        double r223818 = y;
        double r223819 = z;
        double r223820 = r223818 * r223819;
        double r223821 = -6.190538439488532e+277;
        bool r223822 = r223820 <= r223821;
        double r223823 = 1.5351485703257971e+308;
        bool r223824 = r223820 <= r223823;
        double r223825 = !r223824;
        bool r223826 = r223822 || r223825;
        double r223827 = x;
        double r223828 = 1.0;
        double r223829 = r223827 * r223828;
        double r223830 = -r223818;
        double r223831 = r223827 * r223830;
        double r223832 = r223831 * r223819;
        double r223833 = r223829 + r223832;
        double r223834 = r223828 - r223820;
        double r223835 = r223827 * r223834;
        double r223836 = -r223819;
        double r223837 = r223819 * r223818;
        double r223838 = fma(r223836, r223818, r223837);
        double r223839 = r223827 * r223838;
        double r223840 = r223835 + r223839;
        double r223841 = r223826 ? r223833 : r223840;
        return r223841;
}

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-lft-neg-in55.8

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

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

    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 \left(-y\right)\right) \cdot z\\ \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))))