Average Error: 0.0 → 0.1
Time: 3.9s
Precision: 64
\[\left(x + y\right) \cdot \left(1 - z\right)\]
\[\begin{array}{l} \mathbf{if}\;z \le -1324274292343200.25 \lor \neg \left(z \le 511536835406.96807861328125\right):\\ \;\;\;\;\mathsf{fma}\left(1, y, -\mathsf{fma}\left(x, z, z \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(x + y\right) \cdot \left({1}^{3} - {z}^{3}\right)}{\sqrt{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)}}}{\sqrt{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)}}\\ \end{array}\]
\left(x + y\right) \cdot \left(1 - z\right)
\begin{array}{l}
\mathbf{if}\;z \le -1324274292343200.25 \lor \neg \left(z \le 511536835406.96807861328125\right):\\
\;\;\;\;\mathsf{fma}\left(1, y, -\mathsf{fma}\left(x, z, z \cdot y\right)\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r39507 = x;
        double r39508 = y;
        double r39509 = r39507 + r39508;
        double r39510 = 1.0;
        double r39511 = z;
        double r39512 = r39510 - r39511;
        double r39513 = r39509 * r39512;
        return r39513;
}

double f(double x, double y, double z) {
        double r39514 = z;
        double r39515 = -1324274292343200.2;
        bool r39516 = r39514 <= r39515;
        double r39517 = 511536835406.9681;
        bool r39518 = r39514 <= r39517;
        double r39519 = !r39518;
        bool r39520 = r39516 || r39519;
        double r39521 = 1.0;
        double r39522 = y;
        double r39523 = x;
        double r39524 = r39514 * r39522;
        double r39525 = fma(r39523, r39514, r39524);
        double r39526 = -r39525;
        double r39527 = fma(r39521, r39522, r39526);
        double r39528 = r39523 + r39522;
        double r39529 = 3.0;
        double r39530 = pow(r39521, r39529);
        double r39531 = pow(r39514, r39529);
        double r39532 = r39530 - r39531;
        double r39533 = r39528 * r39532;
        double r39534 = r39521 * r39521;
        double r39535 = r39514 * r39514;
        double r39536 = r39521 * r39514;
        double r39537 = r39535 + r39536;
        double r39538 = r39534 + r39537;
        double r39539 = sqrt(r39538);
        double r39540 = r39533 / r39539;
        double r39541 = r39540 / r39539;
        double r39542 = r39520 ? r39527 : r39541;
        return r39542;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Split input into 2 regimes
  2. if z < -1324274292343200.2 or 511536835406.9681 < z

    1. Initial program 0.0

      \[\left(x + y\right) \cdot \left(1 - z\right)\]
    2. Taylor expanded around inf 0.1

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

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

    if -1324274292343200.2 < z < 511536835406.9681

    1. Initial program 0.0

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

      \[\leadsto \left(x + y\right) \cdot \color{blue}{\frac{{1}^{3} - {z}^{3}}{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)}}\]
    4. Applied associate-*r/0.1

      \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot \left({1}^{3} - {z}^{3}\right)}{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)}}\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt0.1

      \[\leadsto \frac{\left(x + y\right) \cdot \left({1}^{3} - {z}^{3}\right)}{\color{blue}{\sqrt{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)} \cdot \sqrt{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)}}}\]
    7. Applied associate-/r*0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1324274292343200.25 \lor \neg \left(z \le 511536835406.96807861328125\right):\\ \;\;\;\;\mathsf{fma}\left(1, y, -\mathsf{fma}\left(x, z, z \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(x + y\right) \cdot \left({1}^{3} - {z}^{3}\right)}{\sqrt{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)}}}{\sqrt{1 \cdot 1 + \left(z \cdot z + 1 \cdot z\right)}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019353 +o rules:numerics
(FPCore (x y z)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, H"
  :precision binary64
  (* (+ x y) (- 1 z)))