Average Error: 2.8 → 1.4
Time: 10.9s
Precision: 64
\[x \cdot \left(1.0 - y \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;y \cdot z \le -5.397766473200316 \cdot 10^{+213}:\\ \;\;\;\;x \cdot 1.0 + \left(-z\right) \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-\left(y \cdot z\right) \cdot x\right) + x \cdot 1.0\\ \end{array}\]
x \cdot \left(1.0 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \le -5.397766473200316 \cdot 10^{+213}:\\
\;\;\;\;x \cdot 1.0 + \left(-z\right) \cdot \left(x \cdot y\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r9386647 = x;
        double r9386648 = 1.0;
        double r9386649 = y;
        double r9386650 = z;
        double r9386651 = r9386649 * r9386650;
        double r9386652 = r9386648 - r9386651;
        double r9386653 = r9386647 * r9386652;
        return r9386653;
}

double f(double x, double y, double z) {
        double r9386654 = y;
        double r9386655 = z;
        double r9386656 = r9386654 * r9386655;
        double r9386657 = -5.397766473200316e+213;
        bool r9386658 = r9386656 <= r9386657;
        double r9386659 = x;
        double r9386660 = 1.0;
        double r9386661 = r9386659 * r9386660;
        double r9386662 = -r9386655;
        double r9386663 = r9386659 * r9386654;
        double r9386664 = r9386662 * r9386663;
        double r9386665 = r9386661 + r9386664;
        double r9386666 = r9386656 * r9386659;
        double r9386667 = -r9386666;
        double r9386668 = r9386667 + r9386661;
        double r9386669 = r9386658 ? r9386665 : r9386668;
        return r9386669;
}

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 z) < -5.397766473200316e+213

    1. Initial program 26.8

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

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

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

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

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

    if -5.397766473200316e+213 < (* y z)

    1. Initial program 1.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \le -5.397766473200316 \cdot 10^{+213}:\\ \;\;\;\;x \cdot 1.0 + \left(-z\right) \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-\left(y \cdot z\right) \cdot x\right) + x \cdot 1.0\\ \end{array}\]

Reproduce

herbie shell --seed 2019164 +o rules:numerics
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
  (* x (- 1.0 (* y z))))