Average Error: 12.7 → 2.0
Time: 1.9s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.025060815940221284599523414245967851062 \cdot 10^{-116}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{elif}\;x \le 2.033791867065685906604667525203590533578 \cdot 10^{-67}:\\ \;\;\;\;\frac{x \cdot y}{z} + x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z} + x\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;x \le -1.025060815940221284599523414245967851062 \cdot 10^{-116}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\

\mathbf{elif}\;x \le 2.033791867065685906604667525203590533578 \cdot 10^{-67}:\\
\;\;\;\;\frac{x \cdot y}{z} + x\\

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

\end{array}
double f(double x, double y, double z) {
        double r481527 = x;
        double r481528 = y;
        double r481529 = z;
        double r481530 = r481528 + r481529;
        double r481531 = r481527 * r481530;
        double r481532 = r481531 / r481529;
        return r481532;
}

double f(double x, double y, double z) {
        double r481533 = x;
        double r481534 = -1.0250608159402213e-116;
        bool r481535 = r481533 <= r481534;
        double r481536 = z;
        double r481537 = y;
        double r481538 = r481537 + r481536;
        double r481539 = r481536 / r481538;
        double r481540 = r481533 / r481539;
        double r481541 = 2.033791867065686e-67;
        bool r481542 = r481533 <= r481541;
        double r481543 = r481533 * r481537;
        double r481544 = r481543 / r481536;
        double r481545 = r481544 + r481533;
        double r481546 = r481537 / r481536;
        double r481547 = r481533 * r481546;
        double r481548 = r481547 + r481533;
        double r481549 = r481542 ? r481545 : r481548;
        double r481550 = r481535 ? r481540 : r481549;
        return r481550;
}

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

Derivation

  1. Split input into 3 regimes
  2. if x < -1.0250608159402213e-116

    1. Initial program 16.1

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

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

    if -1.0250608159402213e-116 < x < 2.033791867065686e-67

    1. Initial program 6.5

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Taylor expanded around 0 3.9

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

    if 2.033791867065686e-67 < x

    1. Initial program 18.0

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Taylor expanded around 0 6.2

      \[\leadsto \color{blue}{\frac{x \cdot y}{z} + x}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity6.2

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot z}} + x\]
    5. Applied times-frac0.4

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{z}} + x\]
    6. Simplified0.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.025060815940221284599523414245967851062 \cdot 10^{-116}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{elif}\;x \le 2.033791867065685906604667525203590533578 \cdot 10^{-67}:\\ \;\;\;\;\frac{x \cdot y}{z} + x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z} + x\\ \end{array}\]

Reproduce

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