Average Error: 3.1 → 0.3
Time: 44.3s
Precision: 64
\[x \cdot \left(1 - y \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;z \cdot y \le -1.108288103314395720657572341848285003442 \cdot 10^{186}:\\ \;\;\;\;x \cdot 1 + \left(-z\right) \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;z \cdot y \le 2.512710765073089366060576529142548227499 \cdot 10^{168}:\\ \;\;\;\;\left(1 - z \cdot y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1 + \left(-z\right) \cdot \left(x \cdot y\right)\\ \end{array}\]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;z \cdot y \le -1.108288103314395720657572341848285003442 \cdot 10^{186}:\\
\;\;\;\;x \cdot 1 + \left(-z\right) \cdot \left(x \cdot y\right)\\

\mathbf{elif}\;z \cdot y \le 2.512710765073089366060576529142548227499 \cdot 10^{168}:\\
\;\;\;\;\left(1 - z \cdot y\right) \cdot x\\

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

\end{array}
double f(double x, double y, double z) {
        double r12049744 = x;
        double r12049745 = 1.0;
        double r12049746 = y;
        double r12049747 = z;
        double r12049748 = r12049746 * r12049747;
        double r12049749 = r12049745 - r12049748;
        double r12049750 = r12049744 * r12049749;
        return r12049750;
}

double f(double x, double y, double z) {
        double r12049751 = z;
        double r12049752 = y;
        double r12049753 = r12049751 * r12049752;
        double r12049754 = -1.1082881033143957e+186;
        bool r12049755 = r12049753 <= r12049754;
        double r12049756 = x;
        double r12049757 = 1.0;
        double r12049758 = r12049756 * r12049757;
        double r12049759 = -r12049751;
        double r12049760 = r12049756 * r12049752;
        double r12049761 = r12049759 * r12049760;
        double r12049762 = r12049758 + r12049761;
        double r12049763 = 2.5127107650730894e+168;
        bool r12049764 = r12049753 <= r12049763;
        double r12049765 = r12049757 - r12049753;
        double r12049766 = r12049765 * r12049756;
        double r12049767 = r12049764 ? r12049766 : r12049762;
        double r12049768 = r12049755 ? r12049762 : r12049767;
        return r12049768;
}

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.1082881033143957e+186 or 2.5127107650730894e+168 < (* y z)

    1. Initial program 20.9

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

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

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

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

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

    if -1.1082881033143957e+186 < (* y z) < 2.5127107650730894e+168

    1. Initial program 0.1

      \[x \cdot \left(1 - y \cdot z\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

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

Reproduce

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