Average Error: 14.9 → 0.9
Time: 1.8s
Precision: binary64
\[\]
\[\]
double code(double x, double y) {
	return ((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))));
}
double code(double x, double y) {
	double VAR;
	if (((((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -4.678397753548392e-66) || !((((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -2.448627909818234e-302) || (!(((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 0.0) && (((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 4.98076392673537e-81))))) {
		VAR = ((double) (x * ((double) (2.0 * ((double) (y / ((double) (x - y))))))));
	} else {
		VAR = ((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - 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

Original14.9
Target0.3
Herbie0.9
\[\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* (* x 2.0) y) (- x y)) < -4.6783977535483921e-66 or -2.44862790981823397e-302 < (/ (* (* x 2.0) y) (- x y)) < 0.0 or 4.98076392673537e-81 < (/ (* (* x 2.0) y) (- x y))

    1. Initial program 29.7

      \[\]
    2. Simplified1.1

      \[\leadsto \]

    if -4.6783977535483921e-66 < (/ (* (* x 2.0) y) (- x y)) < -2.44862790981823397e-302 or 0.0 < (/ (* (* x 2.0) y) (- x y)) < 4.98076392673537e-81

    1. Initial program 0.8

      \[\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \]

Reproduce

herbie shell --seed 2020179 
(FPCore (x y)
  :name "Linear.Projection:perspective from linear-1.19.1.3, B"
  :precision binary64

  :herbie-target
  (if (< x -1.7210442634149447e+81) (* (/ (* 2.0 x) (- x y)) y) (if (< x 8.364504563556443e+16) (/ (* x 2.0) (/ (- x y) y)) (* (/ (* 2.0 x) (- x y)) y)))

  (/ (* (* x 2.0) y) (- x y)))