From be5524ae411e0e3165eef05142f65055f16a9837 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 12 Apr 2002 03:24:52 +0000 Subject: /tmp/log git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 13 +++++++++ MANIFEST | 1 + Makefile.in | 6 ++++ configure.in | 22 +++++++-------- missing/acosh.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 119 insertions(+), 11 deletions(-) create mode 100644 missing/acosh.c diff --git a/ChangeLog b/ChangeLog index 0d75f673cd..82136c2d3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Fri Apr 12 00:34:17 2002 Nobuyoshi Nakada + + * MANIFEST (missing/acosh.c): added. + + * Makefile.in (missing/acosh.c): ditto. + + * Makefile.in (missing/fileblocks.c): ditto. + + * configure.in (AC_REPLACE_FUNCS): check acosh() on behalf of + inverse hyperbolic functions, asinh() and atanh(). + + * missing/acosh.c: added for acosh(), asinh() and atanh(). + Thu Apr 11 19:10:37 2002 WATANABE Hirofumi * io.c (remain_size): IO#read returns "" if file.size == 0. diff --git a/MANIFEST b/MANIFEST index 1be7ecbc7a..5d656879f2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -205,6 +205,7 @@ misc/inf-ruby.el misc/ruby-mode.el misc/rubydb2x.el misc/rubydb3x.el +missing/acosh.c missing/alloca.c missing/crypt.c missing/dup2.c diff --git a/Makefile.in b/Makefile.in index 4663a65b2a..fd02b46874 100644 --- a/Makefile.in +++ b/Makefile.in @@ -165,6 +165,9 @@ parse.c: parse.y parse.@OBJEXT@: parse.c +acosh.@OBJEXT@: $(srcdir)/missing/acosh.c + $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/acosh.c + alloca.@OBJEXT@: $(srcdir)/missing/alloca.c $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/alloca.c @@ -174,6 +177,9 @@ crypt.@OBJEXT@: $(srcdir)/missing/crypt.c dup2.@OBJEXT@: $(srcdir)/missing/dup2.c $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/dup2.c +fileblocks.@OBJEXT@: $(srcdir)/missing/fileblocks.c + $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/fileblocks.c + finite.@OBJEXT@: $(srcdir)/missing/finite.c $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/finite.c diff --git a/configure.in b/configure.in index b4d0b5110f..a172b79bfc 100644 --- a/configure.in +++ b/configure.in @@ -11,7 +11,7 @@ AC_SUBST(MAJOR) AC_SUBST(MINOR) AC_SUBST(TEENY) dnl checks for alternative programs -AC_ARG_WITH(gcc, [--without-gcc never use gcc], [ +AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [ case $withval in no) : ${CC=cc} ;; @@ -36,7 +36,7 @@ RUBY_CANONICAL_BUILD dnl checks for fat-binary fat_binary=no AC_ARG_ENABLE(fat-binary, - [--enable-fat-binary build a NeXT/Apple Multi Architecture Binary. ], + [ --enable-fat-binary build a NeXT/Apple Multi Architecture Binary. ], [fat_binary=$enableval]) if test "$fat_binary" = yes ; then @@ -83,7 +83,7 @@ case $target_cpu in *) frame_address=no;; esac AC_ARG_ENABLE(frame-address, - [--enable-frame-address use GCC __builtin_frame_address(). ], + [ --enable-frame-address use GCC __builtin_frame_address(). ], [frame_address=$enableval]) if test $frame_address = yes; then AC_DEFINE(USE_BUILTIN_FRAME_ADDRESS) @@ -191,7 +191,7 @@ AC_DEFINE_UNQUOTED([NORETURN(x)], $rb_cv_noreturn) dnl wheather link libc_r or not AC_ARG_WITH(libc_r, - [--with-libc_r link libc_r if possible (FreeBSD only)], [ + [ --with-libc_r link libc_r if possible (FreeBSD only)], [ case $withval in yes) with_libc_r=yes;; *) with_libc_r=no;; @@ -301,7 +301,7 @@ AC_FUNC_FSEEKO AC_CHECK_FUNCS(ftello) AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\ strchr strstr strtoul crypt flock vsnprintf\ - isinf isnan finite hypot) + isinf isnan finite hypot acosh) AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall chroot fsync\ truncate chsize times utimes fcntl lockf lstat symlink readlink\ setitimer setruid seteuid setreuid setresuid setproctitle\ @@ -522,7 +522,7 @@ dnl default value for $KANJI DEFAULT_KCODE="KCODE_NONE" AC_ARG_WITH(default-kcode, - [--with-default-kcode=CODE specify default value for \$KCODE (utf8|euc|sjis|none)], + [ --with-default-kcode=CODE specify default value for \$KCODE (utf8|euc|sjis|none)], [case $withval in utf8) DEFAULT_KCODE="KCODE_UTF8";; euc) DEFAULT_KCODE="KCODE_EUC";; @@ -534,7 +534,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_KCODE, $DEFAULT_KCODE) dnl wheather use dln_a_out or not AC_ARG_WITH(dln-a-out, - [--with-dln-a-out use dln_a_out if possible], [ + [ --with-dln-a-out use dln_a_out if possible], [ case $withval in yes) with_dln_a_out=yes;; *) with_dln_a_out=no;; @@ -801,7 +801,7 @@ esac EXTSTATIC= AC_SUBST(EXTSTATIC)dnl AC_ARG_WITH(static-linked-ext, - [--with-static-linked-ext link external modules statically], + [ --with-static-linked-ext link external modules statically], [case $withval in yes) STATIC= EXTSTATIC=static;; @@ -911,7 +911,7 @@ LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so' ENABLE_SHARED=no AC_ARG_ENABLE(shared, - [--enable-shared build a shared library for Ruby. ], + [ --enable-shared build a shared library for Ruby. ], [enable_shared=$enableval]) if test "$enable_shared" = 'yes'; then LIBRUBY='$(LIBRUBY_SO)' @@ -1097,7 +1097,7 @@ esac RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${MAJOR}.${MINOR}" AC_ARG_WITH(sitedir, - [--with-sitedir=DIR site libraries in DIR [PREFIX/lib/ruby/site_ruby]], + [ --with-sitedir=DIR site libraries in DIR [PREFIX/lib/ruby/site_ruby]], [sitedir=$withval], [sitedir='${prefix}/lib/ruby/site_ruby']) SITE_DIR="`eval \"echo ${sitedir}\"`" @@ -1138,7 +1138,7 @@ AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}") AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${arch}") AC_ARG_WITH(search-path, - [--with-search-path=DIR specify the additional search path], + [ --with-search-path=DIR specify the additional search path], [search_path=$withval]) if test "$search_path" != ""; then AC_DEFINE_UNQUOTED(RUBY_SEARCH_PATH,"$search_path") diff --git a/missing/acosh.c b/missing/acosh.c new file mode 100644 index 0000000000..6a9daffa5f --- /dev/null +++ b/missing/acosh.c @@ -0,0 +1,88 @@ +/********************************************************************** + + acosh.c - + + $Author$ + $Date$ + created at: Fri Apr 12 00:34:17 JST 2002 + + public domain rewrite of acosh(3), asinh(3) and atanh(3) + +**********************************************************************/ + +#include +#include +#include + +/* DBL_MANT_DIG must be less than 4 times of bits of int */ +#ifdef DBL_MANT_DIG +#define DBL_MANT_DIG 53 /* in this case, at least 12 digit precision */ +#endif +#define BIG_CRITERIA_BIT (1< 0 +#define BIG_CRITERIA (1.0*BIG_CRITERIA_BIT) +#else +#define BIG_CRITERIA (1.0*(1< 0 +#define SMALL_CRITERIA (1.0/SMALL_CRITERIA_BIT) +#else +#define SMALL_CRITERIA (1.0*(1< BIG_CRITERIA) + x += x; + else + x += sqrt((x + 1) * (x - 1)); + return log(x); +} +#endif + +#ifndef HAVE_ASINH +double +asinh(x) + double x; +{ + int neg = x < 0; + double z = fabs(x); + + if (z < SMALL_CRITERIA) return x; + if (z < (1.0/(1< BIG_CRITERIA) { + z = log(z + z); + } + else { + z = log(z + sqrt(z * z + 1)); + } + if (neg) z = -z; + return z; +} +#endif + +#ifndef HAVE_ATANH +double +atanh(x) + double x; +{ + int neg = x < 0; + double z = fabs(x); + + if (z < SMALL_CRITERIA) return x; + z = log(z > 1 ? -1 : (1 + z) / (1 - z)) / 2; + if (neg) z = -z; + return z; +} +#endif -- cgit v1.2.3