\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.321181503567267682308379168130116570047 \cdot 10^{154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{-1}{2} - x\\
\mathbf{elif}\;x \le 1.726425002480424766694997354741713243289 \cdot 10^{131}:\\
\;\;\;\;\sqrt{x \cdot x + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{2} \cdot \frac{y}{x}\\
\end{array}double f(double x, double y) {
double r411143 = x;
double r411144 = r411143 * r411143;
double r411145 = y;
double r411146 = r411144 + r411145;
double r411147 = sqrt(r411146);
return r411147;
}
double f(double x, double y) {
double r411148 = x;
double r411149 = -1.3211815035672677e+154;
bool r411150 = r411148 <= r411149;
double r411151 = y;
double r411152 = r411151 / r411148;
double r411153 = -0.5;
double r411154 = r411152 * r411153;
double r411155 = r411154 - r411148;
double r411156 = 1.7264250024804248e+131;
bool r411157 = r411148 <= r411156;
double r411158 = r411148 * r411148;
double r411159 = r411158 + r411151;
double r411160 = sqrt(r411159);
double r411161 = 0.5;
double r411162 = r411161 * r411152;
double r411163 = r411148 + r411162;
double r411164 = r411157 ? r411160 : r411163;
double r411165 = r411150 ? r411155 : r411164;
return r411165;
}




Bits error versus x




Bits error versus y
Results
| Original | 21.1 |
|---|---|
| Target | 0.5 |
| Herbie | 0.0 |
if x < -1.3211815035672677e+154Initial program 64.0
Taylor expanded around -inf 0
Simplified0
if -1.3211815035672677e+154 < x < 1.7264250024804248e+131Initial program 0.0
if 1.7264250024804248e+131 < x Initial program 56.4
Taylor expanded around inf 0.1
Final simplification0.0
herbie shell --seed 2019235
(FPCore (x y)
:name "Linear.Quaternion:$clog from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< x -1.5097698010472593e153) (- (+ (* 0.5 (/ y x)) x)) (if (< x 5.5823995511225407e57) (sqrt (+ (* x x) y)) (+ (* 0.5 (/ y x)) x)))
(sqrt (+ (* x x) y)))