Average Error: 12.5 → 0.7
Time: 2.0s
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 r545951 = x;
        double r545952 = y;
        double r545953 = z;
        double r545954 = r545952 + r545953;
        double r545955 = r545951 * r545954;
        double r545956 = r545955 / r545953;
        return r545956;
}

double f(double x, double y, double z) {
        double r545957 = x;
        double r545958 = y;
        double r545959 = z;
        double r545960 = r545958 + r545959;
        double r545961 = r545957 * r545960;
        double r545962 = r545961 / r545959;
        double r545963 = -2.8024718099763744e+284;
        bool r545964 = r545962 <= r545963;
        double r545965 = -2.727928983972457e+55;
        bool r545966 = r545962 <= r545965;
        double r545967 = 1.6295824888591354e-81;
        bool r545968 = r545962 <= r545967;
        double r545969 = 2.062013018056856e+265;
        bool r545970 = r545962 <= r545969;
        double r545971 = !r545970;
        bool r545972 = r545968 || r545971;
        double r545973 = !r545972;
        bool r545974 = r545966 || r545973;
        double r545975 = !r545974;
        bool r545976 = r545964 || r545975;
        double r545977 = r545960 / r545959;
        double r545978 = r545957 * r545977;
        double r545979 = r545976 ? r545978 : r545962;
        return r545979;
}

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