Average Error: 12.3 → 2.5
Time: 1.8s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -9.5299802274924347 \cdot 10^{-270} \lor \neg \left(x \le 1.3270095901178072 \cdot 10^{85}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z} + x\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;x \le -9.5299802274924347 \cdot 10^{-270} \lor \neg \left(x \le 1.3270095901178072 \cdot 10^{85}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z} + x\\

\end{array}
double f(double x, double y, double z) {
        double r364884 = x;
        double r364885 = y;
        double r364886 = z;
        double r364887 = r364885 + r364886;
        double r364888 = r364884 * r364887;
        double r364889 = r364888 / r364886;
        return r364889;
}

double f(double x, double y, double z) {
        double r364890 = x;
        double r364891 = -9.529980227492435e-270;
        bool r364892 = r364890 <= r364891;
        double r364893 = 1.3270095901178072e+85;
        bool r364894 = r364890 <= r364893;
        double r364895 = !r364894;
        bool r364896 = r364892 || r364895;
        double r364897 = z;
        double r364898 = y;
        double r364899 = r364898 + r364897;
        double r364900 = r364897 / r364899;
        double r364901 = r364890 / r364900;
        double r364902 = r364890 * r364898;
        double r364903 = r364902 / r364897;
        double r364904 = r364903 + r364890;
        double r364905 = r364896 ? r364901 : r364904;
        return r364905;
}

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

Target

Original12.3
Target3.2
Herbie2.5
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -9.529980227492435e-270 or 1.3270095901178072e+85 < x

    1. Initial program 16.5

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Using strategy rm
    3. Applied associate-/l*2.3

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}}\]

    if -9.529980227492435e-270 < x < 1.3270095901178072e+85

    1. Initial program 6.0

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Using strategy rm
    3. Applied associate-/l*4.6

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}}\]
    4. Taylor expanded around 0 2.9

      \[\leadsto \color{blue}{\frac{x \cdot y}{z} + x}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -9.5299802274924347 \cdot 10^{-270} \lor \neg \left(x \le 1.3270095901178072 \cdot 10^{85}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z} + x\\ \end{array}\]

Reproduce

herbie shell --seed 2020003 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (/ x (/ z (+ y z)))

  (/ (* x (+ y z)) z))