Average Error: 0.0 → 0.2
Time: 2.7s
Precision: 64
\[\left(x + y\right) \cdot \left(z + 1\right)\]
\[\begin{array}{l} \mathbf{if}\;z + 1 \le -3.75848260846165456 \cdot 10^{29} \lor \neg \left(z + 1 \le 95607046.8625872284\right):\\ \;\;\;\;\mathsf{fma}\left(x, z, \mathsf{fma}\left(z, y, 1 \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(z \cdot z - 1 \cdot 1\right) \cdot \left(x + y\right)}{z - 1}\\ \end{array}\]
\left(x + y\right) \cdot \left(z + 1\right)
\begin{array}{l}
\mathbf{if}\;z + 1 \le -3.75848260846165456 \cdot 10^{29} \lor \neg \left(z + 1 \le 95607046.8625872284\right):\\
\;\;\;\;\mathsf{fma}\left(x, z, \mathsf{fma}\left(z, y, 1 \cdot y\right)\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r38847 = x;
        double r38848 = y;
        double r38849 = r38847 + r38848;
        double r38850 = z;
        double r38851 = 1.0;
        double r38852 = r38850 + r38851;
        double r38853 = r38849 * r38852;
        return r38853;
}

double f(double x, double y, double z) {
        double r38854 = z;
        double r38855 = 1.0;
        double r38856 = r38854 + r38855;
        double r38857 = -3.7584826084616546e+29;
        bool r38858 = r38856 <= r38857;
        double r38859 = 95607046.86258723;
        bool r38860 = r38856 <= r38859;
        double r38861 = !r38860;
        bool r38862 = r38858 || r38861;
        double r38863 = x;
        double r38864 = y;
        double r38865 = r38855 * r38864;
        double r38866 = fma(r38854, r38864, r38865);
        double r38867 = fma(r38863, r38854, r38866);
        double r38868 = r38854 * r38854;
        double r38869 = r38855 * r38855;
        double r38870 = r38868 - r38869;
        double r38871 = r38863 + r38864;
        double r38872 = r38870 * r38871;
        double r38873 = r38854 - r38855;
        double r38874 = r38872 / r38873;
        double r38875 = r38862 ? r38867 : r38874;
        return r38875;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Split input into 2 regimes
  2. if (+ z 1.0) < -3.7584826084616546e+29 or 95607046.86258723 < (+ z 1.0)

    1. Initial program 0.0

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

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

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

    if -3.7584826084616546e+29 < (+ z 1.0) < 95607046.86258723

    1. Initial program 0.0

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

      \[\leadsto \color{blue}{\left(z + 1\right) \cdot \left(x + y\right)}\]
    4. Using strategy rm
    5. Applied flip-+0.0

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

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

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

Reproduce

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