Average Error: 12.5 → 0.7
Time: 2.2s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le -2.8024718099763744 \cdot 10^{284} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -2.72792898397245706 \cdot 10^{55} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.6295824888591354 \cdot 10^{-81} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 2.06201301805685587 \cdot 10^{265}\right)\right)\right):\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le -2.8024718099763744 \cdot 10^{284} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -2.72792898397245706 \cdot 10^{55} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.6295824888591354 \cdot 10^{-81} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 2.06201301805685587 \cdot 10^{265}\right)\right)\right):\\
\;\;\;\;x \cdot \frac{y + z}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r409261 = x;
        double r409262 = y;
        double r409263 = z;
        double r409264 = r409262 + r409263;
        double r409265 = r409261 * r409264;
        double r409266 = r409265 / r409263;
        return r409266;
}

double f(double x, double y, double z) {
        double r409267 = x;
        double r409268 = y;
        double r409269 = z;
        double r409270 = r409268 + r409269;
        double r409271 = r409267 * r409270;
        double r409272 = r409271 / r409269;
        double r409273 = -2.8024718099763744e+284;
        bool r409274 = r409272 <= r409273;
        double r409275 = -2.727928983972457e+55;
        bool r409276 = r409272 <= r409275;
        double r409277 = 1.6295824888591354e-81;
        bool r409278 = r409272 <= r409277;
        double r409279 = 2.062013018056856e+265;
        bool r409280 = r409272 <= r409279;
        double r409281 = !r409280;
        bool r409282 = r409278 || r409281;
        double r409283 = !r409282;
        bool r409284 = r409276 || r409283;
        double r409285 = !r409284;
        bool r409286 = r409274 || r409285;
        double r409287 = r409270 / r409269;
        double r409288 = r409267 * r409287;
        double r409289 = r409286 ? r409288 : r409272;
        return r409289;
}

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.5
Target3.2
Herbie0.7
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* x (+ y z)) z) < -2.8024718099763744e+284 or -2.727928983972457e+55 < (/ (* x (+ y z)) z) < 1.6295824888591354e-81 or 2.062013018056856e+265 < (/ (* x (+ y z)) z)

    1. Initial program 21.3

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

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

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

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

    if -2.8024718099763744e+284 < (/ (* x (+ y z)) z) < -2.727928983972457e+55 or 1.6295824888591354e-81 < (/ (* x (+ y z)) z) < 2.062013018056856e+265

    1. Initial program 0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le -2.8024718099763744 \cdot 10^{284} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -2.72792898397245706 \cdot 10^{55} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.6295824888591354 \cdot 10^{-81} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 2.06201301805685587 \cdot 10^{265}\right)\right)\right):\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \end{array}\]

Reproduce

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