From 481b1331437b14f7f909ecb11373910f8a55bfe2 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 29 Dec 2005 02:01:55 +0000 Subject: [PATCH] Added missing wrappers for hypot() and hypotf(), fixing bug #75. I wouldn't be surprised, if more wrappers are still missing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15709 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../posix/glibc/arch/generic/w_hypot.c | 48 +++++++++++++++++++ .../posix/glibc/arch/generic/w_hypotf.c | 48 +++++++++++++++++++ .../libroot/posix/glibc/arch/ppc/Jamfile | 1 + .../libroot/posix/glibc/arch/x86/Jamfile | 1 + 4 files changed, 98 insertions(+) create mode 100644 src/system/libroot/posix/glibc/arch/generic/w_hypot.c create mode 100644 src/system/libroot/posix/glibc/arch/generic/w_hypotf.c diff --git a/src/system/libroot/posix/glibc/arch/generic/w_hypot.c b/src/system/libroot/posix/glibc/arch/generic/w_hypot.c new file mode 100644 index 0000000000..e91db17083 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/generic/w_hypot.c @@ -0,0 +1,48 @@ +/* @(#)w_hypot.c 5.1 93/09/24 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: w_hypot.c,v 1.6 1995/05/10 20:49:07 jtc Exp $"; +#endif + +/* + * wrapper hypot(x,y) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __hypot(double x, double y)/* wrapper hypot */ +#else + double __hypot(x,y) /* wrapper hypot */ + double x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_hypot(x,y); +#else + double z; + z = __ieee754_hypot(x,y); + if(_LIB_VERSION == _IEEE_) return z; + if((!__finite(z))&&__finite(x)&&__finite(y)) + return __kernel_standard(x,y,4); /* hypot overflow */ + else + return z; +#endif +} +weak_alias (__hypot, hypot) +#ifdef NO_LONG_DOUBLE +strong_alias (__hypot, __hypotl) +weak_alias (__hypot, hypotl) +#endif diff --git a/src/system/libroot/posix/glibc/arch/generic/w_hypotf.c b/src/system/libroot/posix/glibc/arch/generic/w_hypotf.c new file mode 100644 index 0000000000..a7e5c1fdb6 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/generic/w_hypotf.c @@ -0,0 +1,48 @@ +/* w_hypotf.c -- float version of w_hypot.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: w_hypotf.c,v 1.3 1995/05/10 20:49:09 jtc Exp $"; +#endif + +/* + * wrapper hypotf(x,y) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __hypotf(float x, float y) /* wrapper hypotf */ +#else + float __hypotf(x,y) /* wrapper hypotf */ + float x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_hypotf(x,y); +#else + float z; + z = __ieee754_hypotf(x,y); + if(_LIB_VERSION == _IEEE_) return z; + if((!__finitef(z))&&__finitef(x)&&__finitef(y)) + /* hypot overflow */ + return (float)__kernel_standard((double)x,(double)y,104); + else + return z; +#endif +} +weak_alias (__hypotf, hypotf) diff --git a/src/system/libroot/posix/glibc/arch/ppc/Jamfile b/src/system/libroot/posix/glibc/arch/ppc/Jamfile index cdb4527d12..53add9237a 100644 --- a/src/system/libroot/posix/glibc/arch/ppc/Jamfile +++ b/src/system/libroot/posix/glibc/arch/ppc/Jamfile @@ -93,6 +93,7 @@ local genericSources = w_drem.c w_dremf.c # w_dreml.c w_exp.c w_expf.c # w_expl.c w_fmod.c w_fmodf.c # w_fmodl.c + w_hypot.c w_hypotf.c # w_hypotl.c w_j0.c w_j0f.c w_j1.c w_j1f.c w_jn.c w_jnf.c diff --git a/src/system/libroot/posix/glibc/arch/x86/Jamfile b/src/system/libroot/posix/glibc/arch/x86/Jamfile index 9ce07f4024..33d05fce3e 100644 --- a/src/system/libroot/posix/glibc/arch/x86/Jamfile +++ b/src/system/libroot/posix/glibc/arch/x86/Jamfile @@ -48,6 +48,7 @@ local genericSources = w_drem.c w_dremf.c # w_dreml.c w_exp.c w_expf.c # w_expl.c w_fmod.c w_fmodf.c # w_fmodl.c + w_hypot.c w_hypotf.c # w_hypotl.c w_j0.c w_j0f.c w_j1.c w_j1f.c w_jn.c w_jnf.c