Average Error: 3.1 → 0.3
Time: 2.3s
Precision: 64
\[x \cdot \left(1 - y \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;y \cdot z \le -2.4721039413106089 \cdot 10^{169} \lor \neg \left(y \cdot z \le 7.17200634455581739 \cdot 10^{212}\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 -2.4721039413106089 \cdot 10^{169} \lor \neg \left(y \cdot z \le 7.17200634455581739 \cdot 10^{212}\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 r198898 = x;
        double r198899 = 1.0;
        double r198900 = y;
        double r198901 = z;
        double r198902 = r198900 * r198901;
        double r198903 = r198899 - r198902;
        double r198904 = r198898 * r198903;
        return r198904;
}

double f(double x, double y, double z) {
        double r198905 = y;
        double r198906 = z;
        double r198907 = r198905 * r198906;
        double r198908 = -2.472103941310609e+169;
        bool r198909 = r198907 <= r198908;
        double r198910 = 7.172006344555817e+212;
        bool r198911 = r198907 <= r198910;
        double r198912 = !r198911;
        bool r198913 = r198909 || r198912;
        double r198914 = x;
        double r198915 = 1.0;
        double r198916 = r198914 * r198915;
        double r198917 = r198914 * r198905;
        double r198918 = -r198906;
        double r198919 = r198917 * r198918;
        double r198920 = r198916 + r198919;
        double r198921 = r198915 - r198907;
        double r198922 = r198914 * r198921;
        double r198923 = r198906 * r198905;
        double r198924 = fma(r198918, r198905, r198923);
        double r198925 = r198914 * r198924;
        double r198926 = r198922 + r198925;
        double r198927 = r198913 ? r198920 : r198926;
        return r198927;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Split input into 2 regimes
  2. if (* y z) < -2.472103941310609e+169 or 7.172006344555817e+212 < (* y z)

    1. Initial program 22.3

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

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

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

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

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

    if -2.472103941310609e+169 < (* y z) < 7.172006344555817e+212

    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.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \le -2.4721039413106089 \cdot 10^{169} \lor \neg \left(y \cdot z \le 7.17200634455581739 \cdot 10^{212}\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 2020056 +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))))