Average Error: 22.5 → 7.3
Time: 4.8s
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 <= -8.804440934020806e+30) || !(y <= 5.5750201166678655e+20))) {
		VAR = ((double) (x + ((double) (((double) (x / y)) * ((double) (((double) (1.0 / y)) - 1.0))))));
	} else {
		VAR = ((double) (1.0 + ((double) (((double) (y * ((double) (((double) (x - 1.0)) / ((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))))) * ((double) (1.0 - y))))));
	}
	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.5
Target0.2
Herbie7.3
\[\]

Derivation

  1. Split input into 2 regimes
  2. if y < -8.804440934020806e30 or 557502011666786550000 < y

    1. Initial program 47.2

      \[\]
    2. Simplified29.6

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

      \[\leadsto \]
    4. Simplified14.1

      \[\leadsto \]

    if -8.804440934020806e30 < y < 557502011666786550000

    1. Initial program 1.6

      \[\]
    2. Simplified1.5

      \[\leadsto \]
    3. Using strategy rm
    4. Applied flip-+1.5

      \[\leadsto \]
    5. Applied associate-/r/1.5

      \[\leadsto \]
    6. Applied associate-*r*1.5

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

    \[\leadsto \]

Reproduce

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