Average Error: 12.3 → 3.0
Time: 12.2s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -8.3314135878818525418922407335108977686 \cdot 10^{-18} \lor \neg \left(z \le 2.717641103527439173532310107215917032371 \cdot 10^{-184}\right):\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y + z\right)\right) \cdot \frac{1}{z}\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;z \le -8.3314135878818525418922407335108977686 \cdot 10^{-18} \lor \neg \left(z \le 2.717641103527439173532310107215917032371 \cdot 10^{-184}\right):\\
\;\;\;\;x \cdot \frac{y + z}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r240553 = x;
        double r240554 = y;
        double r240555 = z;
        double r240556 = r240554 + r240555;
        double r240557 = r240553 * r240556;
        double r240558 = r240557 / r240555;
        return r240558;
}

double f(double x, double y, double z) {
        double r240559 = z;
        double r240560 = -8.331413587881853e-18;
        bool r240561 = r240559 <= r240560;
        double r240562 = 2.717641103527439e-184;
        bool r240563 = r240559 <= r240562;
        double r240564 = !r240563;
        bool r240565 = r240561 || r240564;
        double r240566 = x;
        double r240567 = y;
        double r240568 = r240567 + r240559;
        double r240569 = r240568 / r240559;
        double r240570 = r240566 * r240569;
        double r240571 = r240566 * r240568;
        double r240572 = 1.0;
        double r240573 = r240572 / r240559;
        double r240574 = r240571 * r240573;
        double r240575 = r240565 ? r240570 : r240574;
        return r240575;
}

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
Herbie3.0
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -8.331413587881853e-18 or 2.717641103527439e-184 < z

    1. Initial program 14.2

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity14.2

      \[\leadsto \frac{x \cdot \left(y + z\right)}{\color{blue}{1 \cdot z}}\]
    4. Applied times-frac1.1

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y + z}{z}}\]
    5. Simplified1.1

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

    if -8.331413587881853e-18 < z < 2.717641103527439e-184

    1. Initial program 7.6

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Using strategy rm
    3. Applied div-inv7.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -8.3314135878818525418922407335108977686 \cdot 10^{-18} \lor \neg \left(z \le 2.717641103527439173532310107215917032371 \cdot 10^{-184}\right):\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y + z\right)\right) \cdot \frac{1}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019325 
(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))