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 r254176 = x;
        double r254177 = 1.0;
        double r254178 = y;
        double r254179 = z;
        double r254180 = r254178 * r254179;
        double r254181 = r254177 - r254180;
        double r254182 = r254176 * r254181;
        return r254182;
}

double f(double x, double y, double z) {
        double r254183 = y;
        double r254184 = -3.671253073044598e+138;
        bool r254185 = r254183 <= r254184;
        double r254186 = 1.960803050623658e+71;
        bool r254187 = r254183 <= r254186;
        double r254188 = 6.198127841043233e+226;
        bool r254189 = r254183 <= r254188;
        double r254190 = !r254189;
        bool r254191 = r254187 || r254190;
        double r254192 = !r254191;
        bool r254193 = r254185 || r254192;
        double r254194 = x;
        double r254195 = 1.0;
        double r254196 = r254194 * r254195;
        double r254197 = -r254183;
        double r254198 = r254194 * r254197;
        double r254199 = z;
        double r254200 = r254198 * r254199;
        double r254201 = r254196 + r254200;
        double r254202 = r254183 * r254199;
        double r254203 = -r254202;
        double r254204 = r254194 * r254203;
        double r254205 = r254196 + r254204;
        double r254206 = r254193 ? r254201 : r254205;
        return r254206;
}

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))))