Average Error: 12.3 → 0.7
Time: 2.3s
Precision: binary64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le -1.1242336700964007 \cdot 10^{282} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -969610033840.32202 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.48620450230642644 \cdot 10^{141} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 4.7595502063025706 \cdot 10^{303}\right)\right)\right):\\ \;\;\;\;x \cdot \left(\frac{y}{z} + 1\right)\\ \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 -1.1242336700964007 \cdot 10^{282} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -969610033840.32202 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.48620450230642644 \cdot 10^{141} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 4.7595502063025706 \cdot 10^{303}\right)\right)\right):\\
\;\;\;\;x \cdot \left(\frac{y}{z} + 1\right)\\

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

\end{array}
double code(double x, double y, double z) {
	return ((double) (((double) (x * ((double) (y + z)))) / z));
}
double code(double x, double y, double z) {
	double VAR;
	if (((((double) (((double) (x * ((double) (y + z)))) / z)) <= -1.1242336700964007e+282) || !((((double) (((double) (x * ((double) (y + z)))) / z)) <= -969610033840.322) || !((((double) (((double) (x * ((double) (y + z)))) / z)) <= 1.4862045023064264e+141) || !(((double) (((double) (x * ((double) (y + z)))) / z)) <= 4.7595502063025706e+303))))) {
		VAR = ((double) (x * ((double) (((double) (y / z)) + 1.0))));
	} else {
		VAR = ((double) (((double) (x * ((double) (y + z)))) / z));
	}
	return VAR;
}

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.3
Target2.9
Herbie0.7
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* x (+ y z)) z) < -1.1242336700964007e282 or -969610033840.32202 < (/ (* x (+ y z)) z) < 1.48620450230642644e141 or 4.7595502063025706e303 < (/ (* x (+ y z)) z)

    1. Initial program 17.1

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

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

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

      \[\leadsto \color{blue}{x} \cdot \frac{y + z}{z}\]
    6. Taylor expanded around 0 0.9

      \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} + 1\right)}\]

    if -1.1242336700964007e282 < (/ (* x (+ y z)) z) < -969610033840.32202 or 1.48620450230642644e141 < (/ (* x (+ y z)) z) < 4.7595502063025706e303

    1. Initial program 0.2

      \[\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 -1.1242336700964007 \cdot 10^{282} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -969610033840.32202 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.48620450230642644 \cdot 10^{141} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 4.7595502063025706 \cdot 10^{303}\right)\right)\right):\\ \;\;\;\;x \cdot \left(\frac{y}{z} + 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \end{array}\]

Reproduce

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