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 code(double x, double y, double z) {
	return ((x * (y + z)) / z);
}
double code(double x, double y, double z) {
	double temp;
	if ((x <= -3224881.2141008736)) {
		temp = ((x * (y / z)) + x);
	} else {
		double temp_1;
		if ((x <= 6.523129526359159e-73)) {
			temp_1 = (((x * y) / z) + x);
		} else {
			temp_1 = (x / (z / (y + z)));
		}
		temp = temp_1;
	}
	return temp;
}

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