diff options
-rw-r--r-- | include/Makefile | 6 | ||||
-rw-r--r-- | include/math.h | 8 | ||||
-rw-r--r-- | lib/libm/Makefile | 17 | ||||
-rw-r--r-- | lib/libm/shlib_version | 2 | ||||
-rw-r--r-- | lib/libm/src/s_nearbyint.c | 59 | ||||
-rw-r--r-- | sys/arch/armish/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/aviion/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/beagle/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/gumstix/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/hp300/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/landisk/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/loongson/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/luna88k/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/mac68k/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/macppc/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/mvme68k/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/mvmeppc/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/octeon/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/palm/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/sgi/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/socppc/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/solbourne/include/fenv.h | 3 | ||||
-rw-r--r-- | sys/arch/zaurus/include/fenv.h | 3 |
24 files changed, 137 insertions, 12 deletions
diff --git a/include/Makefile b/include/Makefile index bc46796c7b2..a42662f0bfe 100644 --- a/include/Makefile +++ b/include/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.157 2010/10/28 08:34:37 mikeb Exp $ +# $OpenBSD: Makefile,v 1.158 2011/04/28 18:05:39 martynas Exp $ # $NetBSD: Makefile,v 1.59 1996/05/15 21:36:43 jtc Exp $ # @(#)Makefile 5.45.1.1 (Berkeley) 5/6/91 @@ -12,8 +12,8 @@ # Missing: mp.h FILES= a.out.h ar.h assert.h bitstring.h blf.h bm.h bsd_auth.h \ complex.h cpio.h ctype.h curses.h db.h dbm.h des.h dirent.h disktab.h \ - dlfcn.h elf_abi.h err.h errno.h fnmatch.h fstab.h fts.h ftw.h getopt.h \ - glob.h grp.h ifaddrs.h inttypes.h iso646.h kvm.h langinfo.h \ + dlfcn.h elf_abi.h err.h errno.h fenv.h fnmatch.h fstab.h fts.h ftw.h \ + getopt.h glob.h grp.h ifaddrs.h inttypes.h iso646.h kvm.h langinfo.h \ libgen.h limits.h locale.h login_cap.h malloc.h math.h md4.h \ md5.h memory.h mpool.h ndbm.h netdb.h netgroup.h nlist.h nl_types.h \ ohash.h paths.h poll.h pwd.h ranlib.h re_comp.h \ diff --git a/include/math.h b/include/math.h index c03e466c0dd..769659e0475 100644 --- a/include/math.h +++ b/include/math.h @@ -1,4 +1,4 @@ -/* $OpenBSD: math.h,v 1.27 2010/12/14 11:16:15 martynas Exp $ */ +/* $OpenBSD: math.h,v 1.28 2011/04/28 18:05:39 martynas Exp $ */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -201,9 +201,7 @@ double erfc(double); double lgamma(double); double tgamma(double); -#if 0 double nearbyint(double); -#endif double rint(double); long int lrint(double); long long int llrint(double); @@ -312,9 +310,7 @@ float tgammaf(float); float ceilf(float); float floorf(float); -#if 0 float nearbyintf(float); -#endif float rintf(float); long int lrintf(float); long long int llrintf(float); @@ -444,8 +440,8 @@ long double tgammal(long double); #if 0 long double ceill(long double); long double floorl(long double); -long double nearbyintl(long double); #endif +long double nearbyintl(long double); long double rintl(long double); #if 0 long int lrintl(long double); diff --git a/lib/libm/Makefile b/lib/libm/Makefile index b7b20a1199d..ec17881fcb0 100644 --- a/lib/libm/Makefile +++ b/lib/libm/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.76 2010/07/19 12:48:23 millert Exp $ +# $OpenBSD: Makefile,v 1.77 2011/04/28 18:05:39 martynas Exp $ # $NetBSD: Makefile,v 1.28 1995/11/20 22:06:19 jtc Exp $ # # @(#)Makefile 5.1beta 93/09/24 @@ -61,6 +61,18 @@ ARCH_SRCS = e_sqrt.c e_sqrtf.c e_remainder.c e_remainderf.c \ .elif (${MACHINE_ARCH} == "sh") .PATH: ${.CURDIR}/arch/sh ARCH_SRCS = e_sqrt.c e_sqrtf.c s_fabsf.c +.elif (${MACHINE_ARCH} == "arm") +.PATH: ${.CURDIR}/arch/arm +.elif (${MACHINE_ARCH} == "hppa64") +.PATH: ${.CURDIR}/arch/hppa64 +.elif (${MACHINE_ARCH} == "m88k") +.PATH: ${.CURDIR}/arch/m88k +.elif (${MACHINE_ARCH} == "mips64") +.PATH: ${.CURDIR}/arch/mips64 +.elif (${MACHINE_ARCH} == "powerpc") +.PATH: ${.CURDIR}/arch/powerpc +.elif (${MACHINE_ARCH} == "sparc") +.PATH: ${.CURDIR}/arch/sparc .elif (${MACHINE_ARCH} == "vax") .PATH: ${.CURDIR}/arch/vax NOIEEE_ARCH = n_argred.S n_infnan.S n_sqrt.S @@ -82,6 +94,7 @@ COMMON_SRCS = b_exp__D.c b_log__D.c b_tgamma.c \ e_rem_pio2.c \ e_rem_pio2f.c e_remainder.c e_remainderf.c e_scalb.c e_scalbf.c \ e_sinh.c e_sinhf.c e_sqrt.c e_sqrtf.c \ + fenv.c \ k_cos.c k_cosf.c k_rem_pio2.c k_rem_pio2f.c k_sin.c k_sinf.c \ k_tan.c k_tanf.c \ s_lround.c s_lroundf.c s_llround.c s_llroundf.c \ @@ -99,7 +112,7 @@ COMMON_SRCS = b_exp__D.c b_log__D.c b_tgamma.c \ s_floor.c s_floorf.c s_frexpf.c s_ilogb.c s_ilogbf.c \ s_log1p.c \ s_log1pf.c s_logb.c s_logbf.c s_llrint.c s_llrintf.c s_lrint.c \ - s_lrintf.c s_modff.c s_nan.c \ + s_lrintf.c s_modff.c s_nan.c s_nearbyint.c \ s_nextafter.c s_nextafterf.c s_remquo.c s_remquof.c s_rint.c \ s_rintf.c s_round.c s_roundf.c \ s_scalbln.c s_scalbn.c s_scalbnf.c s_signgam.c s_significand.c \ diff --git a/lib/libm/shlib_version b/lib/libm/shlib_version index 715ca914844..3d02023227e 100644 --- a/lib/libm/shlib_version +++ b/lib/libm/shlib_version @@ -1,2 +1,2 @@ major=5 -minor=2 +minor=3 diff --git a/lib/libm/src/s_nearbyint.c b/lib/libm/src/s_nearbyint.c new file mode 100644 index 00000000000..d299c21b07d --- /dev/null +++ b/lib/libm/src/s_nearbyint.c @@ -0,0 +1,59 @@ +/* $OpenBSD: s_nearbyint.c,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +/* + * Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <fenv.h> +#include <math.h> + +double +nearbyint(double x) +{ + fenv_t fenv; + double res; + + feholdexcept(&fenv); + res = rint(x); + fesetenv(&fenv); + + return (res); +} + +float +nearbyintf(float x) +{ + fenv_t fenv; + float res; + + feholdexcept(&fenv); + res = rintf(x); + fesetenv(&fenv); + + return (res); +} + +long double +nearbyintl(long double x) +{ + fenv_t fenv; + long double res; + + feholdexcept(&fenv); + res = rintl(x); + fesetenv(&fenv); + + return (res); +} diff --git a/sys/arch/armish/include/fenv.h b/sys/arch/armish/include/fenv.h new file mode 100644 index 00000000000..e6c57adf058 --- /dev/null +++ b/sys/arch/armish/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <arm/fenv.h> diff --git a/sys/arch/aviion/include/fenv.h b/sys/arch/aviion/include/fenv.h new file mode 100644 index 00000000000..e36fc48fe57 --- /dev/null +++ b/sys/arch/aviion/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <m88k/fenv.h> diff --git a/sys/arch/beagle/include/fenv.h b/sys/arch/beagle/include/fenv.h new file mode 100644 index 00000000000..e6c57adf058 --- /dev/null +++ b/sys/arch/beagle/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <arm/fenv.h> diff --git a/sys/arch/gumstix/include/fenv.h b/sys/arch/gumstix/include/fenv.h new file mode 100644 index 00000000000..e6c57adf058 --- /dev/null +++ b/sys/arch/gumstix/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <arm/fenv.h> diff --git a/sys/arch/hp300/include/fenv.h b/sys/arch/hp300/include/fenv.h new file mode 100644 index 00000000000..f7924ba05fa --- /dev/null +++ b/sys/arch/hp300/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <m68k/fenv.h> diff --git a/sys/arch/landisk/include/fenv.h b/sys/arch/landisk/include/fenv.h new file mode 100644 index 00000000000..f5d8a3e2415 --- /dev/null +++ b/sys/arch/landisk/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <sh/fenv.h> diff --git a/sys/arch/loongson/include/fenv.h b/sys/arch/loongson/include/fenv.h new file mode 100644 index 00000000000..744afed950e --- /dev/null +++ b/sys/arch/loongson/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <mips64/fenv.h> diff --git a/sys/arch/luna88k/include/fenv.h b/sys/arch/luna88k/include/fenv.h new file mode 100644 index 00000000000..e36fc48fe57 --- /dev/null +++ b/sys/arch/luna88k/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <m88k/fenv.h> diff --git a/sys/arch/mac68k/include/fenv.h b/sys/arch/mac68k/include/fenv.h new file mode 100644 index 00000000000..f7924ba05fa --- /dev/null +++ b/sys/arch/mac68k/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <m68k/fenv.h> diff --git a/sys/arch/macppc/include/fenv.h b/sys/arch/macppc/include/fenv.h new file mode 100644 index 00000000000..c7434bec406 --- /dev/null +++ b/sys/arch/macppc/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <powerpc/fenv.h> diff --git a/sys/arch/mvme68k/include/fenv.h b/sys/arch/mvme68k/include/fenv.h new file mode 100644 index 00000000000..f7924ba05fa --- /dev/null +++ b/sys/arch/mvme68k/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <m68k/fenv.h> diff --git a/sys/arch/mvme88k/include/fenv.h b/sys/arch/mvme88k/include/fenv.h new file mode 100644 index 00000000000..e36fc48fe57 --- /dev/null +++ b/sys/arch/mvme88k/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <m88k/fenv.h> diff --git a/sys/arch/mvmeppc/include/fenv.h b/sys/arch/mvmeppc/include/fenv.h new file mode 100644 index 00000000000..c7434bec406 --- /dev/null +++ b/sys/arch/mvmeppc/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <powerpc/fenv.h> diff --git a/sys/arch/octeon/include/fenv.h b/sys/arch/octeon/include/fenv.h new file mode 100644 index 00000000000..744afed950e --- /dev/null +++ b/sys/arch/octeon/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <mips64/fenv.h> diff --git a/sys/arch/palm/include/fenv.h b/sys/arch/palm/include/fenv.h new file mode 100644 index 00000000000..e6c57adf058 --- /dev/null +++ b/sys/arch/palm/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <arm/fenv.h> diff --git a/sys/arch/sgi/include/fenv.h b/sys/arch/sgi/include/fenv.h new file mode 100644 index 00000000000..744afed950e --- /dev/null +++ b/sys/arch/sgi/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <mips64/fenv.h> diff --git a/sys/arch/socppc/include/fenv.h b/sys/arch/socppc/include/fenv.h new file mode 100644 index 00000000000..c7434bec406 --- /dev/null +++ b/sys/arch/socppc/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <powerpc/fenv.h> diff --git a/sys/arch/solbourne/include/fenv.h b/sys/arch/solbourne/include/fenv.h new file mode 100644 index 00000000000..05b7a1589d7 --- /dev/null +++ b/sys/arch/solbourne/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <sparc/fenv.h> diff --git a/sys/arch/zaurus/include/fenv.h b/sys/arch/zaurus/include/fenv.h new file mode 100644 index 00000000000..e6c57adf058 --- /dev/null +++ b/sys/arch/zaurus/include/fenv.h @@ -0,0 +1,3 @@ +/* $OpenBSD: fenv.h,v 1.1 2011/04/28 18:05:39 martynas Exp $ */ + +#include <arm/fenv.h> |