Average Error: 12.7 → 2.4
Time: 3.0s
Precision: binary64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -6.138318967552782 \cdot 10^{-271} \lor \neg \left(z \le 6.8283667429510999 \cdot 10^{-91}\right):\\ \;\;\;\;x \cdot \frac{y + z}{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 -6.138318967552782 \cdot 10^{-271} \lor \neg \left(z \le 6.8283667429510999 \cdot 10^{-91}\right):\\
\;\;\;\;x \cdot \frac{y + z}{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 <= -6.138318967552782e-271) || !(z <= 6.8283667429511e-91))) {
		VAR = ((double) (x * ((double) (((double) (y + z)) / 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

Original12.7
Target3.1
Herbie2.4
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -6.138318967552782e-271 or 6.8283667429510999e-91 < z

    1. Initial program 13.4

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

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

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

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

    if -6.138318967552782e-271 < z < 6.8283667429510999e-91

    1. Initial program 9.2

      \[\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. Recombined 2 regimes into one program.
  4. Final simplification2.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -6.138318967552782 \cdot 10^{-271} \lor \neg \left(z \le 6.8283667429510999 \cdot 10^{-91}\right):\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z} + x\\ \end{array}\]

Reproduce

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