diff options
author | obrien <obrien@FreeBSD.org> | 2002-05-28 16:16:03 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2002-05-28 16:16:03 +0000 |
commit | 0895e1acb698e05d503c26bec5471de2e88b7d93 (patch) | |
tree | 7b14e1142a8f8cf48f311f5246aa3b355f2380b6 /contrib/libstdc++/libmath | |
parent | efbfe7b228c18b8cc364aabaefd6f8253bc6b5ad (diff) | |
download | FreeBSD-src-0895e1acb698e05d503c26bec5471de2e88b7d93.zip FreeBSD-src-0895e1acb698e05d503c26bec5471de2e88b7d93.tar.gz |
Gcc 3.1.0 pre-release's C++ support bits from the FSF anoncvs repo
on 9-May-2002 15:57:15 EDT.
Diffstat (limited to 'contrib/libstdc++/libmath')
-rw-r--r-- | contrib/libstdc++/libmath/Makefile.am | 45 | ||||
-rw-r--r-- | contrib/libstdc++/libmath/Makefile.in | 393 | ||||
-rw-r--r-- | contrib/libstdc++/libmath/copysignf.c | 39 | ||||
-rw-r--r-- | contrib/libstdc++/libmath/mathconf.h | 314 | ||||
-rw-r--r-- | contrib/libstdc++/libmath/nan.c | 36 | ||||
-rw-r--r-- | contrib/libstdc++/libmath/signbit.c | 41 | ||||
-rw-r--r-- | contrib/libstdc++/libmath/signbitf.c | 41 | ||||
-rw-r--r-- | contrib/libstdc++/libmath/signbitl.c | 48 | ||||
-rw-r--r-- | contrib/libstdc++/libmath/stubs.c | 271 |
9 files changed, 1228 insertions, 0 deletions
diff --git a/contrib/libstdc++/libmath/Makefile.am b/contrib/libstdc++/libmath/Makefile.am new file mode 100644 index 0000000..27d76e9 --- /dev/null +++ b/contrib/libstdc++/libmath/Makefile.am @@ -0,0 +1,45 @@ +## Makefile for the math subdirectory of the GNU C++ Standard library. +## +## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +## Free Software Foundation, Inc. +## +## This file is part of the libstdc++ version 3 distribution. +## Process this file with automake to produce Makefile.in. + +## This file is part of the GNU ISO C++ Library. This library is free +## software; you can redistribute it and/or modify it under the +## terms of the GNU General Public License as published by the +## Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License along +## with this library; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +## USA. + +AUTOMAKE_OPTIONS = 1.3 cygnus + +mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs + +noinst_LTLIBRARIES = libmath.la + +libmath_la_LIBADD = @LIBMATHOBJS@ + +libmath_la_DEPENDENCIES = $(libmath_la_LIBADD) + +libmath_la_SOURCES = stubs.c + +LINK = \ + $(LIBTOOL) --tag CC --mode=link "$(CCLD)" \ + $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ + +# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES +TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@ + +INCLUDES = \ + $(TOPLEVEL_INCLUDES) diff --git a/contrib/libstdc++/libmath/Makefile.in b/contrib/libstdc++/libmath/Makefile.in new file mode 100644 index 0000000..4ac55ad --- /dev/null +++ b/contrib/libstdc++/libmath/Makefile.in @@ -0,0 +1,393 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AR = @AR@ +AS = @AS@ +ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@ +AWK = @AWK@ +BASIC_FILE_H = @BASIC_FILE_H@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCODECVT_C = @CCODECVT_C@ +CCODECVT_H = @CCODECVT_H@ +CLOCALE_H = @CLOCALE_H@ +CMESSAGES_H = @CMESSAGES_H@ +CPP = @CPP@ +CPU_LIMITS_INC_SRCDIR = @CPU_LIMITS_INC_SRCDIR@ +CSHADOW_FLAGS = @CSHADOW_FLAGS@ +CSTDIO_H = @CSTDIO_H@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +C_INCLUDE_DIR = @C_INCLUDE_DIR@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_FLAGS = @DEBUG_FLAGS@ +DLLTOOL = @DLLTOOL@ +EXEEXT = @EXEEXT@ +EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@ +GCJ = @GCJ@ +GCJFLAGS = @GCJFLAGS@ +GENCAT = @GENCAT@ +GLIBC21 = @GLIBC21@ +GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@ +GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +INSTOBJEXT = @INSTOBJEXT@ +INTLBISON = @INTLBISON@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LIBICONV = @LIBICONV@ +LIBIO_INCLUDES = @LIBIO_INCLUDES@ +LIBMATHOBJS = @LIBMATHOBJS@ +LIBMATH_INCLUDES = @LIBMATH_INCLUDES@ +LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@ +LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBUNWIND_FLAG = @LIBUNWIND_FLAG@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@ +OPT_LDFLAGS = @OPT_LDFLAGS@ +OS_INC_SRCDIR = @OS_INC_SRCDIR@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SECTION_FLAGS = @SECTION_FLAGS@ +SECTION_LDFLAGS = @SECTION_LDFLAGS@ +STRIP = @STRIP@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_FLAGS = @WARN_FLAGS@ +WERROR = @WERROR@ +check_msgfmt = @check_msgfmt@ +enable_shared = @enable_shared@ +enable_static = @enable_static@ +glibcpp_CXX = @glibcpp_CXX@ +glibcpp_MOFILES = @glibcpp_MOFILES@ +glibcpp_POFILES = @glibcpp_POFILES@ +glibcpp_basedir = @glibcpp_basedir@ +glibcpp_builddir = @glibcpp_builddir@ +glibcpp_localedir = @glibcpp_localedir@ +glibcpp_prefixdir = @glibcpp_prefixdir@ +glibcpp_srcdir = @glibcpp_srcdir@ +glibcpp_thread_h = @glibcpp_thread_h@ +glibcpp_toolexecdir = @glibcpp_toolexecdir@ +glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@ +gxx_include_dir = @gxx_include_dir@ +ifGNUmake = @ifGNUmake@ +libio_la = @libio_la@ +libtool_VERSION = @libtool_VERSION@ +release_VERSION = @release_VERSION@ +toplevel_srcdir = @toplevel_srcdir@ + +AUTOMAKE_OPTIONS = 1.3 cygnus + +mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs + +noinst_LTLIBRARIES = libmath.la + +libmath_la_LIBADD = @LIBMATHOBJS@ + +libmath_la_DEPENDENCIES = $(libmath_la_LIBADD) + +libmath_la_SOURCES = stubs.c + +LINK = \ + $(LIBTOOL) --tag CC --mode=link "$(CCLD)" \ + $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ + + +# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES +TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@ + +INCLUDES = \ + $(TOPLEVEL_INCLUDES) + +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +libmath_la_LDFLAGS = +libmath_la_OBJECTS = stubs.lo +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(libmath_la_SOURCES) +OBJECTS = $(libmath_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .obj .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --cygnus libmath/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-noinstLTLIBRARIES: + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + +distclean-noinstLTLIBRARIES: + +maintainer-clean-noinstLTLIBRARIES: + +.c.o: + $(COMPILE) -c $< + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +libmath.la: $(libmath_la_OBJECTS) $(libmath_la_DEPENDENCIES) + $(LINK) $(libmath_la_LDFLAGS) $(libmath_la_OBJECTS) $(libmath_la_LIBADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = libmath + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: +check: check-am +installcheck-am: +installcheck: installcheck-am +install-info-am: +install-info: install-info-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile $(LTLIBRARIES) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-noinstLTLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-tags \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-noinstLTLIBRARIES clean-compile clean-libtool \ + clean-tags clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-noinstLTLIBRARIES distclean-compile \ + distclean-libtool distclean-tags distclean-generic \ + clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-noinstLTLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-noinstLTLIBRARIES distclean-noinstLTLIBRARIES \ +clean-noinstLTLIBRARIES maintainer-clean-noinstLTLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile mostlyclean-libtool distclean-libtool \ +clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-info-am \ +install-info install-exec-am install-exec install-data-am install-data \ +install-am install uninstall-am uninstall all-redirect all-am all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/contrib/libstdc++/libmath/copysignf.c b/contrib/libstdc++/libmath/copysignf.c new file mode 100644 index 0000000..91d40e9 --- /dev/null +++ b/contrib/libstdc++/libmath/copysignf.c @@ -0,0 +1,39 @@ +/* Copy sign of one number to another. */ + +/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + + This file is part of the GNU ISO C++ Library. This library is free + software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) + any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this library; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. + + As a special exception, you may use this file as part of a free software + library without restriction. Specifically, if other files instantiate + templates or use macros or inline functions from this file, or you compile + this file and link it with other files to produce an executable, this + file does not by itself cause the resulting executable to be covered by + the GNU General Public License. This exception does not however + invalidate any other reasons why the executable file might be covered by + the GNU General Public License. */ + + +#include <math.h> +#include "mathconf.h" + +float +copysignf (float x, float y) +{ + /* We use the double version. */ + return copysign (x, y); +} diff --git a/contrib/libstdc++/libmath/mathconf.h b/contrib/libstdc++/libmath/mathconf.h new file mode 100644 index 0000000..087631a --- /dev/null +++ b/contrib/libstdc++/libmath/mathconf.h @@ -0,0 +1,314 @@ +/* Configuration data for libmath subpart of libstdc++. */ + +/* Copyright (C) 1997-1999, 2000, 2001 Free Software Foundation, Inc. + + This file is part of the GNU ISO C++ Library. This library is free + software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) + any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this library; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. + + As a special exception, you may use this file as part of a free software + library without restriction. Specifically, if other files instantiate + templates or use macros or inline functions from this file, or you compile + this file and link it with other files to produce an executable, this + file does not by itself cause the resulting executable to be covered by + the GNU General Public License. This exception does not however + invalidate any other reasons why the executable file might be covered by + the GNU General Public License. */ + + +#include <config.h> + +#ifdef HAVE_ENDIAN_H +# include <endian.h> +#else +# ifdef HAVE_MACHINE_ENDIAN_H +# ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +# endif +# include <machine/endian.h> +# else +# ifdef HAVE_SYS_MACHINE_H +# include <sys/machine.h> +# else +# if defined HAVE_SYS_ISA_DEFS_H || defined HAVE_MACHINE_PARAM_H +/* This is on Solaris. */ +# ifdef HAVE_SYS_ISA_DEFS_H +# include <sys/isa_defs.h> +# endif +# ifdef HAVE_MACHINE_PARAM_H +# include <machine/param.h> +# endif +# ifdef _LITTLE_ENDIAN +# define LITTLE_ENDIAN 1 +# endif +# ifdef _BIG_ENDIAN +# define BIG_ENDIAN 1 +# endif +# define BYTE_ORDER 1 +# else +/* We have to rely on the AC_C_BIGENDIAN test. */ +# ifdef WORDS_BIGENDIAN +# define BIG_ENDIAN 1 +# else +# define LITTLE_ENDIAN 1 +# endif +# define BYTE_ORDER 1 +# endif +# endif +# endif +#endif + +typedef unsigned int U_int32_t __attribute ((mode (SI))); +typedef int Int32_t __attribute ((mode (SI))); +typedef unsigned int U_int64_t __attribute ((mode (DI))); +typedef int Int64_t __attribute ((mode (DI))); + +#ifdef HAVE_NAN_H +# include <nan.h> +#endif + +#ifndef NAN +# define NAN (nan()) +double nan (void); +#endif + +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif + +#ifdef HAVE_FP_H +# include <fp.h> +#endif + +#ifdef HAVE_FLOAT_H +# include <float.h> +#endif + +/* `float' variant of HUGE_VAL. */ +#ifndef HUGE_VALF +# ifdef HUGE_VALf +# define HUGE_VALF HUGE_VALf +# else +# define HUGE_VALF HUGE_VAL +# endif +#endif + +/* `long double' variant of HUGE_VAL. */ +#ifndef HUGE_VALL +# ifdef HUGE_VALl +# define HUGE_VALL HUGE_VALl +# else +# define HUGE_VALL HUGE_VAL +# endif +#endif + +/* Make sure that at least HUGE_VAL is defined. */ +#ifndef HUGE_VAL +# ifdef HUGE +# define HUGE_VAL HUGE +# else +# ifdef MAXFLOAT +# define HUGE_VAL MAXFLOAT +# else +# error "We need HUGE_VAL!" +# endif +# endif +#endif + +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +/* signbit is a macro in ISO C99. */ +#ifndef signbit +extern int __signbitf (float); +extern int __signbit (double); +extern int __signbitl (long double); + +# define signbit(x) \ + (sizeof (x) == sizeof (float) ? \ + __signbitf (x) \ + : sizeof (x) == sizeof (double) ? \ + __signbit (x) : __signbitl (x)) +#endif + +#if BYTE_ORDER == BIG_ENDIAN +typedef union +{ + double value; + struct + { + U_int32_t msw; + U_int32_t lsw; + } parts; +} ieee_double_shape_type; +#endif +#if BYTE_ORDER == LITTLE_ENDIAN +typedef union +{ + double value; + struct + { + U_int32_t lsw; + U_int32_t msw; + } parts; +} ieee_double_shape_type; +#endif +/* Get the more significant 32 bit int from a double. */ +#define GET_HIGH_WORD(i,d) \ +do { \ + ieee_double_shape_type gh_u; \ + gh_u.value = (d); \ + (i) = gh_u.parts.msw; \ +} while (0) + + +typedef union +{ + float value; + U_int32_t word; +} ieee_float_shape_type; +/* Get a 32 bit int from a float. */ +#define GET_FLOAT_WORD(i,d) \ +do { \ + ieee_float_shape_type gf_u; \ + gf_u.value = (d); \ + (i) = gf_u.word; \ +} while (0) + + +#if BYTE_ORDER == BIG_ENDIAN +typedef union +{ + long double value; + struct + { + unsigned int sign_exponent:16; + unsigned int empty:16; + U_int32_t msw; + U_int32_t lsw; + } parts; +} ieee_long_double_shape_type; +#endif +#if BYTE_ORDER == LITTLE_ENDIAN +typedef union +{ + long double value; + struct + { + U_int32_t lsw; + U_int32_t msw; + unsigned int sign_exponent:16; + unsigned int empty:16; + } parts; +} ieee_long_double_shape_type; +#endif +/* Get int from the exponent of a long double. */ +#define GET_LDOUBLE_EXP(exp,d) \ +do { \ + ieee_long_double_shape_type ge_u; \ + ge_u.value = (d); \ + (exp) = ge_u.parts.sign_exponent; \ +} while (0) + +#if BYTE_ORDER == BIG_ENDIAN +typedef union +{ + long double value; + struct + { + U_int64_t msw; + U_int64_t lsw; + } parts64; + struct + { + U_int32_t w0, w1, w2, w3; + } parts32; +} ieee_quad_double_shape_type; +#endif +#if BYTE_ORDER == LITTLE_ENDIAN +typedef union +{ + long double value; + struct + { + U_int64_t lsw; + U_int64_t msw; + } parts64; + struct + { + U_int32_t w3, w2, w1, w0; + } parts32; +} ieee_quad_double_shape_type; +#endif +/* Get most significant 64 bit int from a quad long double. */ +#define GET_LDOUBLE_MSW64(msw,d) \ +do { \ + ieee_quad_double_shape_type qw_u; \ + qw_u.value = (d); \ + (msw) = qw_u.parts64.msw; \ +} while (0) + + +/* Replacement for non-existing float functions. */ +#if !defined(HAVE_FABSF) && !defined(HAVE___BUILTIN_FABSF) +# define fabsf(x) fabs (x) +#endif +#if !defined(HAVE_COSF) && !defined(HAVE___BUILTIN_COSF) +# define cosf(x) cos (x) +#endif +#ifndef HAVE_COSHF +# define coshf(x) cosh (x) +#endif +#ifndef HAVE_EXPF +# define expf(x) expf (x) +#endif +#ifndef HAVE_LOGF +# define logf(x) log(x) +#endif +#ifndef HAVE_LOG10F +# define log10f(x) log10 (x) +#endif +#ifndef HAVE_POWF +# define powf(x, y) pow (x, y) +#endif +#if !defined(HAVE_SINF) && !defined(HAVE___BUILTIN_SINF) +# define sinf(x) sin (x) +#endif +#ifndef HAVE_SINHF +# define sinhf(x) sinh (x) +#endif +#if !defined(HAVE_SQRTF) && !defined(HAVE___BUILTIN_SQRTF) +# define sqrtf(x) sqrt (x) +#endif +#ifndef HAVE_TANF +# define tanf(x) tan (x) +#endif +#ifndef HAVE_TANHF +# define tanhf(x) tanh (x) +#endif +#ifndef HAVE_STRTOF +# define strtof(s, e) strtod (s, e) +#endif + +#ifdef __cplusplus +} +#endif + diff --git a/contrib/libstdc++/libmath/nan.c b/contrib/libstdc++/libmath/nan.c new file mode 100644 index 0000000..1814b5d --- /dev/null +++ b/contrib/libstdc++/libmath/nan.c @@ -0,0 +1,36 @@ +/* Return quiet nan. */ + +/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + + This file is part of the GNU ISO C++ Library. This library is free + software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) + any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this library; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. + + As a special exception, you may use this file as part of a free software + library without restriction. Specifically, if other files instantiate + templates or use macros or inline functions from this file, or you compile + this file and link it with other files to produce an executable, this + file does not by itself cause the resulting executable to be covered by + the GNU General Public License. This exception does not however + invalidate any other reasons why the executable file might be covered by + the GNU General Public License. */ + + +#include <stdlib.h> +#include <string.h> + +double +nan () +{ return strtod ("nan", NULL); } diff --git a/contrib/libstdc++/libmath/signbit.c b/contrib/libstdc++/libmath/signbit.c new file mode 100644 index 0000000..f400b8d --- /dev/null +++ b/contrib/libstdc++/libmath/signbit.c @@ -0,0 +1,41 @@ +/* Return nonzero value if number is negative. */ + +/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + + This file is part of the GNU ISO C++ Library. This library is free + software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) + any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this library; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. + + As a special exception, you may use this file as part of a free software + library without restriction. Specifically, if other files instantiate + templates or use macros or inline functions from this file, or you compile + this file and link it with other files to produce an executable, this + file does not by itself cause the resulting executable to be covered by + the GNU General Public License. This exception does not however + invalidate any other reasons why the executable file might be covered by + the GNU General Public License. */ + + +#include <math.h> +#include "mathconf.h" + +int +__signbit (double x) +{ + Int32_t hx; + + GET_HIGH_WORD (hx, x); + return hx & 0x80000000; +} diff --git a/contrib/libstdc++/libmath/signbitf.c b/contrib/libstdc++/libmath/signbitf.c new file mode 100644 index 0000000..6a72f46 --- /dev/null +++ b/contrib/libstdc++/libmath/signbitf.c @@ -0,0 +1,41 @@ +/* Return nonzero value if number is negative. */ + +/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + + This file is part of the GNU ISO C++ Library. This library is free + software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) + any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this library; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. + + As a special exception, you may use this file as part of a free software + library without restriction. Specifically, if other files instantiate + templates or use macros or inline functions from this file, or you compile + this file and link it with other files to produce an executable, this + file does not by itself cause the resulting executable to be covered by + the GNU General Public License. This exception does not however + invalidate any other reasons why the executable file might be covered by + the GNU General Public License. */ + + +#include <math.h> +#include "mathconf.h" + +int +__signbitf (float x) +{ + Int32_t hx; + + GET_FLOAT_WORD (hx, x); + return hx & 0x80000000; +} diff --git a/contrib/libstdc++/libmath/signbitl.c b/contrib/libstdc++/libmath/signbitl.c new file mode 100644 index 0000000..f5e0035 --- /dev/null +++ b/contrib/libstdc++/libmath/signbitl.c @@ -0,0 +1,48 @@ +/* Return nonzero value if number is negative. */ + +/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + + This file is part of the GNU ISO C++ Library. This library is free + software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) + any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this library; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. + + As a special exception, you may use this file as part of a free software + library without restriction. Specifically, if other files instantiate + templates or use macros or inline functions from this file, or you compile + this file and link it with other files to produce an executable, this + file does not by itself cause the resulting executable to be covered by + the GNU General Public License. This exception does not however + invalidate any other reasons why the executable file might be covered by + the GNU General Public License. */ + +#include <float.h> +#include <math.h> +#include "mathconf.h" + +int +__signbitl (long double x) +{ +#if LDBL_MANT_DIG == 113 + Int64_t msw; + + GET_LDOUBLE_MSW64 (msw, x); + return msw < 0; +#else + Int32_t e; + + GET_LDOUBLE_EXP (e, x); + return e & 0x8000; +#endif +} diff --git a/contrib/libstdc++/libmath/stubs.c b/contrib/libstdc++/libmath/stubs.c new file mode 100644 index 0000000..586fd6d --- /dev/null +++ b/contrib/libstdc++/libmath/stubs.c @@ -0,0 +1,271 @@ +/* Stub definitions for libmath subpart of libstdc++. */ + +/* Copyright (C) 2001, 2002 Free Software Foundation, Inc. + + This file is part of the GNU ISO C++ Library. This library is free + software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) + any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this library; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. + + As a special exception, you may use this file as part of a free software + library without restriction. Specifically, if other files instantiate + templates or use macros or inline functions from this file, or you compile + this file and link it with other files to produce an executable, this + file does not by itself cause the resulting executable to be covered by + the GNU General Public License. This exception does not however + invalidate any other reasons why the executable file might be covered by + the GNU General Public License. */ + +#include <math.h> +#include "config.h" + +/* For targets which do not have support for long double versions, + we use the crude approximation. We'll do better later. */ + + +#ifndef HAVE_ATAN2F +float +atan2f(float x, float y) +{ + return (float) atan2(x, y); +} +#endif + +#ifndef HAVE_ATAN2L +long double +atan2l(long double x, long double y) +{ + return atan2((double) x, (double) y); +} +#endif + + +#ifndef HAVE_COSF +float +cosf(float x) +{ + return (float) cos(x); +} +#endif + +#ifndef HAVE_COSL +long double +cosl(long double x) +{ + return cos((double) x); +} +#endif + + +#ifndef HAVE_COSHF +float +coshf(float x) +{ + return (float) cosh(x); +} +#endif + +#ifndef HAVE_COSHL +long double +coshl(long double x) +{ + return cosh((double) x); +} +#endif + + +#ifndef HAVE_EXPF +float +expf(float x) +{ + return (float) exp(x); +} +#endif + +#ifndef HAVE_EXPL +long double +expl(long double x) +{ + return exp((double) x); +} +#endif + + +/* Compute the hypothenuse of a right triangle with side x and y. */ +#ifndef HAVE_HYPOTF +float +hypotf(float x, float y) +{ + float s = fabsf(x) + fabsf(y); + x /= s; y /= s; + return s * sqrtf(x * x + y * y); +} +#endif + +#ifndef HAVE_HYPOT +double +hypot(double x, double y) +{ + double s = fabs(x) + fabs(y); + x /= s; y /= s; + return s * sqrt(x * x + y * y); +} +#endif + +#ifndef HAVE_HYPOTL +long double +hypotl(long double x, long double y) +{ + long double s = fabsl(x) + fabsl(y); + x /= s; y /= s; + return s * sqrtl(x * x + y * y); +} +#endif + + + +#ifndef HAVE_LOGF +float +logf(float x) +{ + return (float) log(x); +} +#endif + +#ifndef HAVE_LOGL +long double +logl(long double x) +{ + return log((double) x); +} +#endif + + +#ifndef HAVE_LOG10F +float +log10f(float x) +{ + return (float) log10(x); +} +#endif + +#ifndef HAVE_LOG10L +long double +log10l(long double x) +{ + return log10((double) x); +} +#endif + + +#ifndef HAVE_POWF +float +powf(float x, float y) +{ + return (float) pow(x, y); +} +#endif + +#ifndef HAVE_POWL +long double +powl(long double x, long double y) +{ + return pow((double) x, (double) y); +} +#endif + + +#ifndef HAVE_SINF +float +sinf(float x) +{ + return (float) sin(x); +} +#endif + +#ifndef HAVE_SINL +long double +sinl(long double x) +{ + return sin((double) x); +} +#endif + + +#ifndef HAVE_SINHF +float +sinhf(float x) +{ + return (float) sinh(x); +} +#endif + +#ifndef HAVE_SINHL +long double +sinhl(long double x) +{ + return sinh((double) x); +} +#endif + + +#ifndef HAVE_SQRTF +float +sqrtf(float x) +{ + return (float) sqrt(x); +} +#endif + +#ifndef HAVE_SQRTL +long double +sqrtl(long double x) +{ + return sqrt((double) x); +} +#endif + + +#ifndef HAVE_TANF +float +tanf(float x) +{ + return (float) tan(x); +} +#endif + +#ifndef HAVE_TANL +long double +tanl(long double x) +{ + return tan((double) x); +} +#endif + + +#ifndef HAVE_TANHF +float +tanhf(float x) +{ + return (float) tanh(x); +} +#endif + +#ifndef HAVE_TANHL +long double +tanhl(long double x) +{ + return tanh((double) x); +} +#endif |