Blame sysdeps/ieee754/flt-32/e_hypotf.c

Packit 6c4009
/* e_hypotf.c -- float version of e_hypot.c.
Packit 6c4009
 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * ====================================================
Packit 6c4009
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
Packit 6c4009
 *
Packit 6c4009
 * Developed at SunPro, a Sun Microsystems, Inc. business.
Packit 6c4009
 * Permission to use, copy, modify, and distribute this
Packit 6c4009
 * software is freely granted, provided that this notice
Packit 6c4009
 * is preserved.
Packit 6c4009
 * ====================================================
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#include <math.h>
Packit 6c4009
#include <math_private.h>
Packit 6c4009
Packit 6c4009
float
Packit 6c4009
__ieee754_hypotf(float x, float y)
Packit 6c4009
{
Packit 6c4009
	double d_x, d_y;
Packit 6c4009
	int32_t ha, hb;
Packit 6c4009
Packit 6c4009
	GET_FLOAT_WORD(ha,x);
Packit 6c4009
	ha &= 0x7fffffff;
Packit 6c4009
	GET_FLOAT_WORD(hb,y);
Packit 6c4009
	hb &= 0x7fffffff;
Packit 6c4009
	if (ha == 0x7f800000 && !issignaling (y))
Packit 6c4009
	  return fabsf(x);
Packit 6c4009
	else if (hb == 0x7f800000 && !issignaling (x))
Packit 6c4009
	  return fabsf(y);
Packit 6c4009
	else if (ha > 0x7f800000 || hb > 0x7f800000)
Packit 6c4009
	  return fabsf(x) * fabsf(y);
Packit 6c4009
	else if (ha == 0)
Packit 6c4009
	  return fabsf(y);
Packit 6c4009
	else if (hb == 0)
Packit 6c4009
	  return fabsf(x);
Packit 6c4009
Packit 6c4009
	d_x = (double) x;
Packit 6c4009
	d_y = (double) y;
Packit 6c4009
Packit 6c4009
	return (float) sqrt(d_x * d_x + d_y * d_y);
Packit 6c4009
}
Packit 6c4009
strong_alias (__ieee754_hypotf, __hypotf_finite)