Average Error: 13.2 → 2.5
Time: 2.5s
Precision: binary64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le 3.103957478426698 \cdot 10^{-257} \lor \neg \left(z \le 1.8465527700659985 \cdot 10^{89}\right):\\ \;\;\;\;\frac{x}{z \cdot \frac{1}{y + z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z} + x\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;z \le 3.103957478426698 \cdot 10^{-257} \lor \neg \left(z \le 1.8465527700659985 \cdot 10^{89}\right):\\
\;\;\;\;\frac{x}{z \cdot \frac{1}{y + z}}\\

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

\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 (((z <= 3.103957478426698e-257) || !(z <= 1.8465527700659985e+89))) {
		VAR = ((double) (x / ((double) (z * ((double) (1.0 / ((double) (y + z))))))));
	} else {
		VAR = ((double) (((double) (((double) (x * y)) / z)) + x));
	}
	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

Original13.2
Target2.9
Herbie2.5
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < 3.103957478426698e-257 or 1.8465527700659985e89 < z

    1. Initial program 15.8

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}}\]
    4. Using strategy rm
    5. Applied div-inv2.5

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

    if 3.103957478426698e-257 < z < 1.8465527700659985e89

    1. Initial program 5.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le 3.103957478426698 \cdot 10^{-257} \lor \neg \left(z \le 1.8465527700659985 \cdot 10^{89}\right):\\ \;\;\;\;\frac{x}{z \cdot \frac{1}{y + z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z} + x\\ \end{array}\]

Reproduce

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