Average Error: 3.5 → 2.0
Time: 13.4s
Precision: 64
\[x \cdot \left(1 - y \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;y \cdot z \le 1.504828077239251210599676853555794383052 \cdot 10^{159}:\\ \;\;\;\;1 \cdot x + \left(-y \cdot z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;1 \cdot x + \left(-y\right) \cdot \left(z \cdot x\right)\\ \end{array}\]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \le 1.504828077239251210599676853555794383052 \cdot 10^{159}:\\
\;\;\;\;1 \cdot x + \left(-y \cdot z\right) \cdot x\\

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

\end{array}
double f(double x, double y, double z) {
        double r150602 = x;
        double r150603 = 1.0;
        double r150604 = y;
        double r150605 = z;
        double r150606 = r150604 * r150605;
        double r150607 = r150603 - r150606;
        double r150608 = r150602 * r150607;
        return r150608;
}

double f(double x, double y, double z) {
        double r150609 = y;
        double r150610 = z;
        double r150611 = r150609 * r150610;
        double r150612 = 1.5048280772392512e+159;
        bool r150613 = r150611 <= r150612;
        double r150614 = 1.0;
        double r150615 = x;
        double r150616 = r150614 * r150615;
        double r150617 = -r150611;
        double r150618 = r150617 * r150615;
        double r150619 = r150616 + r150618;
        double r150620 = -r150609;
        double r150621 = r150610 * r150615;
        double r150622 = r150620 * r150621;
        double r150623 = r150616 + r150622;
        double r150624 = r150613 ? r150619 : r150623;
        return r150624;
}

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) < 1.5048280772392512e+159

    1. Initial program 1.9

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

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

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

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

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

    if 1.5048280772392512e+159 < (* y z)

    1. Initial program 22.7

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

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

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

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

      \[\leadsto 1 \cdot x + \color{blue}{\left(-y \cdot z\right) \cdot x}\]
    7. Using strategy rm
    8. Applied distribute-lft-neg-in22.7

      \[\leadsto 1 \cdot x + \color{blue}{\left(\left(-y\right) \cdot z\right)} \cdot x\]
    9. Applied associate-*l*2.6

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

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

Reproduce

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