Average Error: 14.9 → 1.4
Time: 1.4s
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)))) <= -5.7452082763940146e-67) || !((((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -1.191949392464429e-284) || (!(((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 0.0) && (((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 1.1202517080680182e-97))))) {
		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
Herbie1.4
\[\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* (* x 2.0) y) (- x y)) < -5.74520827639401457e-67 or -1.1919493924644289e-284 < (/ (* (* x 2.0) y) (- x y)) < 0.0 or 1.12025170806801818e-97 < (/ (* (* x 2.0) y) (- x y))

    1. Initial program 27.1

      \[\]
    2. Simplified2.0

      \[\leadsto \]

    if -5.74520827639401457e-67 < (/ (* (* x 2.0) y) (- x y)) < -1.1919493924644289e-284 or 0.0 < (/ (* (* x 2.0) y) (- x y)) < 1.12025170806801818e-97

    1. Initial program 0.7

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

    \[\leadsto \]

Reproduce

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