Average Error: 12.4 → 2.2
Time: 2.1s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.1403332970259781 \cdot 10^{120} \lor \neg \left(y \le 2.29487294548203845 \cdot 10^{98} \lor \neg \left(y \le 1.2257998951478701 \cdot 10^{226}\right)\right):\\ \;\;\;\;\frac{x}{z} \cdot y + x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;y \le -1.1403332970259781 \cdot 10^{120} \lor \neg \left(y \le 2.29487294548203845 \cdot 10^{98} \lor \neg \left(y \le 1.2257998951478701 \cdot 10^{226}\right)\right):\\
\;\;\;\;\frac{x}{z} \cdot y + x\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y + z}{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 VAR;
	if (((y <= -1.1403332970259781e+120) || !((y <= 2.2948729454820384e+98) || !(y <= 1.22579989514787e+226)))) {
		VAR = (((x / z) * y) + x);
	} else {
		VAR = (x * ((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.4
Target2.9
Herbie2.2
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -1.1403332970259781e+120 or 2.2948729454820384e+98 < y < 1.22579989514787e+226

    1. Initial program 12.1

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}}\]
    4. Using strategy rm
    5. Applied associate-/r/11.1

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(y + z\right)}\]
    6. Using strategy rm
    7. Applied distribute-lft-in11.1

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

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

    if -1.1403332970259781e+120 < y < 2.2948729454820384e+98 or 1.22579989514787e+226 < y

    1. Initial program 12.5

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.1403332970259781 \cdot 10^{120} \lor \neg \left(y \le 2.29487294548203845 \cdot 10^{98} \lor \neg \left(y \le 1.2257998951478701 \cdot 10^{226}\right)\right):\\ \;\;\;\;\frac{x}{z} \cdot y + x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \end{array}\]

Reproduce

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