Average Error: 3.5 → 3.1
Time: 2.6s
Precision: 64
\[x \cdot \left(1 - y \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;y \le -3.671253073044597861783345883626749758604 \cdot 10^{138} \lor \neg \left(y \le 1.960803050623658027373990885927505399753 \cdot 10^{71} \lor \neg \left(y \le 6.198127841043233411679773067859289148308 \cdot 10^{226}\right)\right):\\ \;\;\;\;x \cdot 1 + \left(x \cdot \left(-y\right)\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1 + x \cdot \left(-y \cdot z\right)\\ \end{array}\]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \le -3.671253073044597861783345883626749758604 \cdot 10^{138} \lor \neg \left(y \le 1.960803050623658027373990885927505399753 \cdot 10^{71} \lor \neg \left(y \le 6.198127841043233411679773067859289148308 \cdot 10^{226}\right)\right):\\
\;\;\;\;x \cdot 1 + \left(x \cdot \left(-y\right)\right) \cdot z\\

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

\end{array}
double f(double x, double y, double z) {
        double r236925 = x;
        double r236926 = 1.0;
        double r236927 = y;
        double r236928 = z;
        double r236929 = r236927 * r236928;
        double r236930 = r236926 - r236929;
        double r236931 = r236925 * r236930;
        return r236931;
}

double f(double x, double y, double z) {
        double r236932 = y;
        double r236933 = -3.671253073044598e+138;
        bool r236934 = r236932 <= r236933;
        double r236935 = 1.960803050623658e+71;
        bool r236936 = r236932 <= r236935;
        double r236937 = 6.198127841043233e+226;
        bool r236938 = r236932 <= r236937;
        double r236939 = !r236938;
        bool r236940 = r236936 || r236939;
        double r236941 = !r236940;
        bool r236942 = r236934 || r236941;
        double r236943 = x;
        double r236944 = 1.0;
        double r236945 = r236943 * r236944;
        double r236946 = -r236932;
        double r236947 = r236943 * r236946;
        double r236948 = z;
        double r236949 = r236947 * r236948;
        double r236950 = r236945 + r236949;
        double r236951 = r236932 * r236948;
        double r236952 = -r236951;
        double r236953 = r236943 * r236952;
        double r236954 = r236945 + r236953;
        double r236955 = r236942 ? r236950 : r236954;
        return r236955;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if y < -3.671253073044598e+138 or 1.960803050623658e+71 < y < 6.198127841043233e+226

    1. Initial program 10.2

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

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

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

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

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

    if -3.671253073044598e+138 < y < 1.960803050623658e+71 or 6.198127841043233e+226 < y

    1. Initial program 1.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -3.671253073044597861783345883626749758604 \cdot 10^{138} \lor \neg \left(y \le 1.960803050623658027373990885927505399753 \cdot 10^{71} \lor \neg \left(y \le 6.198127841043233411679773067859289148308 \cdot 10^{226}\right)\right):\\ \;\;\;\;x \cdot 1 + \left(x \cdot \left(-y\right)\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1 + x \cdot \left(-y \cdot z\right)\\ \end{array}\]

Reproduce

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