Average Error: 0.0 → 0.1
Time: 3.8s
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 r27961 = x;
        double r27962 = y;
        double r27963 = r27961 + r27962;
        double r27964 = 1.0;
        double r27965 = z;
        double r27966 = r27964 - r27965;
        double r27967 = r27963 * r27966;
        return r27967;
}

double f(double x, double y, double z) {
        double r27968 = z;
        double r27969 = -1324274292343200.2;
        bool r27970 = r27968 <= r27969;
        double r27971 = 511536835406.9681;
        bool r27972 = r27968 <= r27971;
        double r27973 = !r27972;
        bool r27974 = r27970 || r27973;
        double r27975 = 1.0;
        double r27976 = y;
        double r27977 = x;
        double r27978 = r27968 * r27976;
        double r27979 = fma(r27977, r27968, r27978);
        double r27980 = -r27979;
        double r27981 = fma(r27975, r27976, r27980);
        double r27982 = r27977 + r27976;
        double r27983 = 3.0;
        double r27984 = pow(r27975, r27983);
        double r27985 = pow(r27968, r27983);
        double r27986 = r27984 - r27985;
        double r27987 = r27982 * r27986;
        double r27988 = r27975 * r27975;
        double r27989 = r27968 * r27968;
        double r27990 = r27975 * r27968;
        double r27991 = r27989 + r27990;
        double r27992 = r27988 + r27991;
        double r27993 = sqrt(r27992);
        double r27994 = r27987 / r27993;
        double r27995 = r27994 / r27993;
        double r27996 = r27974 ? r27981 : r27995;
        return r27996;
}

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)))