Average Error: 20.9 → 20.9
Time: 2.3s
Precision: binary64
\[\sqrt{x \cdot x + y}\]
\[\sqrt{x \cdot x + y}\]
\sqrt{x \cdot x + y}
\sqrt{x \cdot x + y}
(FPCore (x y) :precision binary64 (sqrt (+ (* x x) y)))
(FPCore (x y) :precision binary64 (sqrt (+ (* x x) y)))
double code(double x, double y) {
	return sqrt((x * x) + y);
}
double code(double x, double y) {
	return sqrt((x * x) + y);
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original20.9
Target0.5
Herbie20.9
\[\begin{array}{l} \mathbf{if}\;x < -1.5097698010472593 \cdot 10^{+153}:\\ \;\;\;\;-\left(0.5 \cdot \frac{y}{x} + x\right)\\ \mathbf{elif}\;x < 5.582399551122541 \cdot 10^{+57}:\\ \;\;\;\;\sqrt{x \cdot x + y}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y}{x} + x\\ \end{array}\]

Derivation

  1. Initial program 20.9

    \[\sqrt{x \cdot x + y}\]
  2. Final simplification20.9

    \[\leadsto \sqrt{x \cdot x + y}\]

Reproduce

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

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

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