Home | History | Annotate | Line # | Download | only in src
w_hypotf.c revision 1.2
      1  1.1  jtc /* w_hypotf.c -- float version of w_hypot.c.
      2  1.1  jtc  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian (at) cygnus.com.
      3  1.1  jtc  */
      4  1.1  jtc 
      5  1.1  jtc /*
      6  1.1  jtc  * ====================================================
      7  1.1  jtc  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
      8  1.1  jtc  *
      9  1.1  jtc  * Developed at SunPro, a Sun Microsystems, Inc. business.
     10  1.1  jtc  * Permission to use, copy, modify, and distribute this
     11  1.1  jtc  * software is freely granted, provided that this notice
     12  1.1  jtc  * is preserved.
     13  1.1  jtc  * ====================================================
     14  1.1  jtc  */
     15  1.1  jtc 
     16  1.2  jtc #if defined(LIBM_SCCS) && !defined(lint)
     17  1.2  jtc static char rcsid[] = "$Id: w_hypotf.c,v 1.2 1994/09/22 16:45:43 jtc Exp $";
     18  1.1  jtc #endif
     19  1.1  jtc 
     20  1.1  jtc /*
     21  1.1  jtc  * wrapper hypotf(x,y)
     22  1.1  jtc  */
     23  1.1  jtc 
     24  1.1  jtc #include "math.h"
     25  1.1  jtc #include "math_private.h"
     26  1.1  jtc 
     27  1.1  jtc 
     28  1.1  jtc #ifdef __STDC__
     29  1.1  jtc 	float hypotf(float x, float y)	/* wrapper hypotf */
     30  1.1  jtc #else
     31  1.1  jtc 	float hypotf(x,y)		/* wrapper hypotf */
     32  1.1  jtc 	float x,y;
     33  1.1  jtc #endif
     34  1.1  jtc {
     35  1.1  jtc #ifdef _IEEE_LIBM
     36  1.1  jtc 	return __ieee754_hypotf(x,y);
     37  1.1  jtc #else
     38  1.1  jtc 	float z;
     39  1.1  jtc 	z = __ieee754_hypotf(x,y);
     40  1.1  jtc 	if(_LIB_VERSION == _IEEE_) return z;
     41  1.1  jtc 	if((!finitef(z))&&finitef(x)&&finitef(y))
     42  1.1  jtc 	    /* hypot overflow */
     43  1.1  jtc 	    return (float)__kernel_standard((double)x,(double)y,104);
     44  1.1  jtc 	else
     45  1.1  jtc 	    return z;
     46  1.1  jtc #endif
     47  1.1  jtc }
     48