Average Error: 21.0 → 0.0
Time: 1.6s
Precision: binary64
\[\]
\[\]
double code(double x, double y) {
	return ((double) sqrt(((double) (((double) (x * x)) + y))));
}
double code(double x, double y) {
	double VAR;
	if ((x <= -1.3695581431145475e+154)) {
		VAR = ((double) (((double) (y * ((double) (-0.5 / x)))) - x));
	} else {
		double VAR_1;
		if ((x <= 9.466964783487594e+132)) {
			VAR_1 = ((double) sqrt(((double) (y + ((double) (x * x))))));
		} else {
			VAR_1 = ((double) (x + ((double) (y * ((double) (0.5 / x))))));
		}
		VAR = VAR_1;
	}
	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

Original21.0
Target0.6
Herbie0.0
\[\]

Derivation

  1. Split input into 3 regimes
  2. if x < -1.36955814311454747e154

    1. Initial program 64.0

      \[\]
    2. Taylor expanded around -inf 0

      \[\leadsto \]
    3. Simplified0

      \[\leadsto \]

    if -1.36955814311454747e154 < x < 9.4669647834875944e132

    1. Initial program 0.0

      \[\]

    if 9.4669647834875944e132 < x

    1. Initial program 56.5

      \[\]
    2. Taylor expanded around inf 0.2

      \[\leadsto \]
    3. Simplified0.2

      \[\leadsto \]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \]

Reproduce

herbie shell --seed 2020192 
(FPCore (x y)
  :name "Linear.Quaternion:$clog from linear-1.19.1.3"
  :precision binary64

  :herbie-target
  (if (< x -1.5097698010472593e+153) (neg (+ (* 0.5 (/ y x)) x)) (if (< x 5.582399551122541e+57) (sqrt (+ (* x x) y)) (+ (* 0.5 (/ y x)) x)))

  (sqrt (+ (* x x) y)))