Average Error: 22.1 → 7.4
Time: 4.6s
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 <= -1.5091161540073787e+20) || !(y <= 1.8268171308460768e+31))) {
		VAR = ((double) (x + ((double) (((double) (x / y)) * ((double) (((double) (1.0 / y)) - 1.0))))));
	} else {
		VAR = ((double) (1.0 + ((double) (y * ((double) (((double) (1.0 / ((double) (((double) cbrt(((double) (y + 1.0)))) * ((double) cbrt(((double) (y + 1.0)))))))) * ((double) (((double) (x - 1.0)) / ((double) cbrt(((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.1
Target0.2
Herbie7.4
\[\]

Derivation

  1. Split input into 2 regimes
  2. if y < -150911615400737866000 or 1.82681713084607681e31 < y

    1. Initial program 46.9

      \[\]
    2. Simplified29.7

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

      \[\leadsto \]
    4. Simplified14.5

      \[\leadsto \]

    if -150911615400737866000 < y < 1.82681713084607681e31

    1. Initial program 1.4

      \[\]
    2. Simplified1.3

      \[\leadsto \]
    3. Using strategy rm
    4. Applied add-cube-cbrt1.4

      \[\leadsto \]
    5. Applied *-un-lft-identity1.4

      \[\leadsto \]
    6. Applied times-frac1.4

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

    \[\leadsto \]

Reproduce

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