1/* e_hypotf.c -- float version of e_hypot.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3 */
4
5/*
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 *
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
12 * is preserved.
13 * ====================================================
14 */
15
16#include <math.h>
17#include <math_private.h>
18
19float
20__ieee754_hypotf(float x, float y)
21{
22 double d_x, d_y;
23 int32_t ha, hb;
24
25 GET_FLOAT_WORD(ha,x);
26 ha &= 0x7fffffff;
27 GET_FLOAT_WORD(hb,y);
28 hb &= 0x7fffffff;
29 if (ha == 0x7f800000 && !issignaling (y))
30 return fabsf(x);
31 else if (hb == 0x7f800000 && !issignaling (x))
32 return fabsf(y);
33 else if (ha > 0x7f800000 || hb > 0x7f800000)
34 return fabsf(x) * fabsf(y);
35 else if (ha == 0)
36 return fabsf(y);
37 else if (hb == 0)
38 return fabsf(x);
39
40 d_x = (double) x;
41 d_y = (double) y;
42
43 return (float) __ieee754_sqrt(d_x * d_x + d_y * d_y);
44}
45strong_alias (__ieee754_hypotf, __hypotf_finite)
46