Average Error: 22.7 → 7.6
Time: 4.0s
Precision: binary64
\[\]
\[\]
double code(double x, double y) {
	return ((double) (1.0 - ((double) (((double) (((double) (1.0 - x)) * y)) / ((double) (y + 1.0))))));
}
double code(double x, double y) {
	double VAR;
	if (((y <= -12375748977649096.0) || !(y <= 9089537523424004.0))) {
		VAR = ((double) (x + ((double) (((double) (x / y)) * ((double) (((double) (1.0 / y)) - 1.0))))));
	} else {
		VAR = ((double) (1.0 + ((double) (((double) (y * ((double) (x - 1.0)))) / ((double) (y + 1.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

Original22.7
Target0.2
Herbie7.6
\[\]

Derivation

  1. Split input into 2 regimes
  2. if y < -12375748977649096 or 9089537523424004 < y

    1. Initial program 47.0

      \[\]
    2. Simplified30.1

      \[\leadsto \]
    3. Taylor expanded around inf 15.4

      \[\leadsto \]
    4. Simplified15.4

      \[\leadsto \]

    if -12375748977649096 < y < 9089537523424004

    1. Initial program 0.6

      \[\]
  3. Recombined 2 regimes into one program.
  4. Final simplification7.6

    \[\leadsto \]

Reproduce

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

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

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