Average Error: 8.2 → 0.5
Time: 1.9s
Precision: binary64
\[\frac{x \cdot y}{y + 1}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.0116832049766011 \lor \neg \left(y \le 1.00916533814602549\right):\\ \;\;\;\;x + 1 \cdot \left(\frac{x}{{y}^{2}} - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 \cdot x\right) \cdot \left(y + \left({y}^{3} - {y}^{2}\right)\right)\\ \end{array}\]
\frac{x \cdot y}{y + 1}
\begin{array}{l}
\mathbf{if}\;y \le -1.0116832049766011 \lor \neg \left(y \le 1.00916533814602549\right):\\
\;\;\;\;x + 1 \cdot \left(\frac{x}{{y}^{2}} - \frac{x}{y}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(1 \cdot x\right) \cdot \left(y + \left({y}^{3} - {y}^{2}\right)\right)\\

\end{array}
double code(double x, double y) {
	return ((double) (((double) (x * y)) / ((double) (y + 1.0))));
}
double code(double x, double y) {
	double VAR;
	if (((y <= -1.0116832049766011) || !(y <= 1.0091653381460255))) {
		VAR = ((double) (x + ((double) (1.0 * ((double) (((double) (x / ((double) pow(y, 2.0)))) - ((double) (x / y))))))));
	} else {
		VAR = ((double) (((double) (1.0 * x)) * ((double) (y + ((double) (((double) pow(y, 3.0)) - ((double) pow(y, 2.0))))))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original8.2
Target0.0
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;y \lt -3693.84827882972468:\\ \;\;\;\;\frac{x}{y \cdot y} - \left(\frac{x}{y} - x\right)\\ \mathbf{elif}\;y \lt 6799310503.41891003:\\ \;\;\;\;\frac{x \cdot y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y} - \left(\frac{x}{y} - x\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -1.0116832049766011 or 1.00916533814602549 < y

    1. Initial program 16.4

      \[\frac{x \cdot y}{y + 1}\]
    2. Taylor expanded around inf 0.5

      \[\leadsto \color{blue}{\left(x + 1 \cdot \frac{x}{{y}^{2}}\right) - 1 \cdot \frac{x}{y}}\]
    3. Simplified0.5

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

    if -1.0116832049766011 < y < 1.00916533814602549

    1. Initial program 0.0

      \[\frac{x \cdot y}{y + 1}\]
    2. Taylor expanded around 0 0.4

      \[\leadsto \color{blue}{\left(1 \cdot \left(x \cdot y\right) + 1 \cdot \left(x \cdot {y}^{3}\right)\right) - 1 \cdot \left(x \cdot {y}^{2}\right)}\]
    3. Simplified0.4

      \[\leadsto \color{blue}{\left(1 \cdot x\right) \cdot \left(y + \left({y}^{3} - {y}^{2}\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.0116832049766011 \lor \neg \left(y \le 1.00916533814602549\right):\\ \;\;\;\;x + 1 \cdot \left(\frac{x}{{y}^{2}} - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 \cdot x\right) \cdot \left(y + \left({y}^{3} - {y}^{2}\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020152 
(FPCore (x y)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, B"
  :precision binary64

  :herbie-target
  (if (< y -3693.8482788297247) (- (/ x (* y y)) (- (/ x y) x)) (if (< y 6799310503.41891) (/ (* x y) (+ y 1.0)) (- (/ x (* y y)) (- (/ x y) x))))

  (/ (* x y) (+ y 1.0)))