diff options
author | Martynas Venckus <martynas@cvs.openbsd.org> | 2008-12-09 19:52:35 +0000 |
---|---|---|
committer | Martynas Venckus <martynas@cvs.openbsd.org> | 2008-12-09 19:52:35 +0000 |
commit | 9e5337fc957e6c7535daf2a109184402a542f1ec (patch) | |
tree | 84cad8df1ca61a3ef08f4c6720f1d9f771a6fd1d /lib/libc/gen | |
parent | eeeafb12487449aefa05ef31aa83d0b6e24b8a8f (diff) |
- add long double signbit
- make long double versions weak aliases to double versions,
on archs where long doubles are 64 bits
- no need to have two finites. finite() and finitef() are
non-standard 3BSD obsolete versions of isfinite. remove
from libm. make them weak_alias in libc to __isfinite and
__isfinitef instead. similarly make 3BSD obsolete versions
of isinf, isinff, isnan, isnanf weak_aliases to C99's
__isinf, __isinff, __isnan, __isnanf
- bump major
ok millert@
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/fpclassify.c | 10 | ||||
-rw-r--r-- | lib/libc/gen/isfinite.c | 19 | ||||
-rw-r--r-- | lib/libc/gen/isinf.c | 20 | ||||
-rw-r--r-- | lib/libc/gen/isnan.c | 20 | ||||
-rw-r--r-- | lib/libc/gen/isnormal.c | 11 | ||||
-rw-r--r-- | lib/libc/gen/signbit.c | 19 |
6 files changed, 82 insertions, 17 deletions
diff --git a/lib/libc/gen/fpclassify.c b/lib/libc/gen/fpclassify.c index 10a0904637b..60d21770bfb 100644 --- a/lib/libc/gen/fpclassify.c +++ b/lib/libc/gen/fpclassify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpclassify.c,v 1.2 2008/09/07 20:36:08 martynas Exp $ */ +/* $OpenBSD: fpclassify.c,v 1.3 2008/12/09 19:52:34 martynas Exp $ */ /* * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org> * @@ -16,7 +16,9 @@ */ #include <sys/types.h> +#include <machine/cdefs.h> #include <machine/ieee.h> +#include <float.h> #include <math.h> int @@ -62,3 +64,9 @@ __fpclassifyf(float f) return FP_NORMAL; } + +#if LDBL_MANT_DIG == 53 +#ifdef __weak_alias +__weak_alias(__fpclassifyl, __fpclassify); +#endif /* __weak_alias */ +#endif /* LDBL_MANT_DIG == 53 */ diff --git a/lib/libc/gen/isfinite.c b/lib/libc/gen/isfinite.c index 0e0e8844492..537eed7716a 100644 --- a/lib/libc/gen/isfinite.c +++ b/lib/libc/gen/isfinite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isfinite.c,v 1.2 2008/09/07 20:36:08 martynas Exp $ */ +/* $OpenBSD: isfinite.c,v 1.3 2008/12/09 19:52:34 martynas Exp $ */ /* * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org> * @@ -16,7 +16,10 @@ */ #include <sys/types.h> +#include <machine/cdefs.h> #include <machine/ieee.h> +#include <float.h> +#include <math.h> int __isfinite(double d) @@ -33,3 +36,17 @@ __isfinitef(float f) return (p->sng_exp != SNG_EXP_INFNAN); } + +#if LDBL_MANT_DIG == 53 +#ifdef __weak_alias +__weak_alias(__isfinitel, __isfinite); +#endif /* __weak_alias */ +#endif /* LDBL_MANT_DIG == 53 */ + +/* + * 3BSD compatibility aliases. + */ +#ifdef __weak_alias +__weak_alias(finite, __isfinite); +__weak_alias(finitef, __isfinitef); +#endif /* __weak_alias */ diff --git a/lib/libc/gen/isinf.c b/lib/libc/gen/isinf.c index 9af1ca9657b..a7b991b1c7f 100644 --- a/lib/libc/gen/isinf.c +++ b/lib/libc/gen/isinf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isinf.c,v 1.2 2008/09/07 20:36:08 martynas Exp $ */ +/* $OpenBSD: isinf.c,v 1.3 2008/12/09 19:52:34 martynas Exp $ */ /* * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org> * @@ -16,7 +16,9 @@ */ #include <sys/types.h> +#include <machine/cdefs.h> #include <machine/ieee.h> +#include <float.h> int __isinf(double d) @@ -28,9 +30,23 @@ __isinf(double d) } int -isinff(float f) +__isinff(float f) { struct ieee_single *p = (struct ieee_single *)&f; return (p->sng_exp == SNG_EXP_INFNAN && p->sng_frac == 0); } + +#if LDBL_MANT_DIG == 53 +#ifdef __weak_alias +__weak_alias(__isinfl, __isinf); +#endif /* __weak_alias */ +#endif /* LDBL_MANT_DIG == 53 */ + +/* + * 3BSD compatibility aliases. + */ +#ifdef __weak_alias +__weak_alias(isinf, __isinf); +__weak_alias(isinff, __isinff); +#endif /* __weak_alias */ diff --git a/lib/libc/gen/isnan.c b/lib/libc/gen/isnan.c index 116360369ed..eadb1f18a5e 100644 --- a/lib/libc/gen/isnan.c +++ b/lib/libc/gen/isnan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isnan.c,v 1.2 2008/09/07 20:36:08 martynas Exp $ */ +/* $OpenBSD: isnan.c,v 1.3 2008/12/09 19:52:34 martynas Exp $ */ /* * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org> * @@ -16,7 +16,9 @@ */ #include <sys/types.h> +#include <machine/cdefs.h> #include <machine/ieee.h> +#include <float.h> int __isnan(double d) @@ -28,9 +30,23 @@ __isnan(double d) } int -isnanf(float f) +__isnanf(float f) { struct ieee_single *p = (struct ieee_single *)&f; return (p->sng_exp == SNG_EXP_INFNAN && p->sng_frac != 0); } + +#if LDBL_MANT_DIG == 53 +#ifdef __weak_alias +__weak_alias(__isnanl, __isnan); +#endif /* __weak_alias */ +#endif /* LDBL_MANT_DIG == 53 */ + +/* + * 3BSD compatibility aliases. + */ +#ifdef __weak_alias +__weak_alias(isnan, __isnan); +__weak_alias(isnanf, __isnanf); +#endif /* __weak_alias */ diff --git a/lib/libc/gen/isnormal.c b/lib/libc/gen/isnormal.c index 8879218e7fe..40e59913a02 100644 --- a/lib/libc/gen/isnormal.c +++ b/lib/libc/gen/isnormal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isnormal.c,v 1.2 2008/09/07 20:36:08 martynas Exp $ */ +/* $OpenBSD: isnormal.c,v 1.3 2008/12/09 19:52:34 martynas Exp $ */ /* * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org> * @@ -16,7 +16,10 @@ */ #include <sys/types.h> +#include <machine/cdefs.h> #include <machine/ieee.h> +#include <float.h> +#include <math.h> int __isnormal(double d) @@ -33,3 +36,9 @@ __isnormalf(float f) return (p->sng_exp != 0 && p->sng_exp != SNG_EXP_INFNAN); } + +#if LDBL_MANT_DIG == 53 +#ifdef __weak_alias +__weak_alias(__isnormall, __isnormal); +#endif /* __weak_alias */ +#endif /* LDBL_MANT_DIG == 53 */ diff --git a/lib/libc/gen/signbit.c b/lib/libc/gen/signbit.c index 426362c8288..b4a3f3617e1 100644 --- a/lib/libc/gen/signbit.c +++ b/lib/libc/gen/signbit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signbit.c,v 1.1 2008/07/24 09:31:07 martynas Exp $ */ +/* $OpenBSD: signbit.c,v 1.2 2008/12/09 19:52:34 martynas Exp $ */ /* * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org> * @@ -16,7 +16,10 @@ */ #include <sys/types.h> +#include <machine/cdefs.h> #include <machine/ieee.h> +#include <float.h> +#include <math.h> int __signbit(double d) @@ -34,12 +37,8 @@ __signbitf(float f) return p->sng_sign; } -#if 0 /* XXX */ -int -__signbitl(long double e) -{ - struct ieee_ext *p = (struct ieee_ext *)&e; - - return p->ext_sign; -} -#endif /* XXX */ +#if LDBL_MANT_DIG == 53 +#ifdef __weak_alias +__weak_alias(__signbitl, __signbit); +#endif /* __weak_alias */ +#endif /* LDBL_MANT_DIG == 53 */ |