Average Error: 12.0 → 1.5
Time: 1.9s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3224881.21410087356:\\ \;\;\;\;x \cdot \frac{y}{z} + x\\ \mathbf{elif}\;x \le 6.52312952635915906 \cdot 10^{-73}:\\ \;\;\;\;\frac{x \cdot y}{z} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;x \le -3224881.21410087356:\\
\;\;\;\;x \cdot \frac{y}{z} + x\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r527655 = x;
        double r527656 = y;
        double r527657 = z;
        double r527658 = r527656 + r527657;
        double r527659 = r527655 * r527658;
        double r527660 = r527659 / r527657;
        return r527660;
}

double f(double x, double y, double z) {
        double r527661 = x;
        double r527662 = -3224881.2141008736;
        bool r527663 = r527661 <= r527662;
        double r527664 = y;
        double r527665 = z;
        double r527666 = r527664 / r527665;
        double r527667 = r527661 * r527666;
        double r527668 = r527667 + r527661;
        double r527669 = 6.523129526359159e-73;
        bool r527670 = r527661 <= r527669;
        double r527671 = r527661 * r527664;
        double r527672 = r527671 / r527665;
        double r527673 = r527672 + r527661;
        double r527674 = r527664 + r527665;
        double r527675 = r527665 / r527674;
        double r527676 = r527661 / r527675;
        double r527677 = r527670 ? r527673 : r527676;
        double r527678 = r527663 ? r527668 : r527677;
        return r527678;
}

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

Derivation

  1. Split input into 3 regimes
  2. if x < -3224881.2141008736

    1. Initial program 22.7

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z} + x}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity7.6

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

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

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

    if -3224881.2141008736 < x < 6.523129526359159e-73

    1. Initial program 5.2

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

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

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

    if 6.523129526359159e-73 < x

    1. Initial program 16.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -3224881.21410087356:\\ \;\;\;\;x \cdot \frac{y}{z} + x\\ \mathbf{elif}\;x \le 6.52312952635915906 \cdot 10^{-73}:\\ \;\;\;\;\frac{x \cdot y}{z} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \end{array}\]

Reproduce

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