/tmp/log
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1aa67cb1d3
commit
be5524ae41
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
Fri Apr 12 00:34:17 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
||||
|
||||
* 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 <eban@ruby-lang.org>
|
||||
|
||||
* io.c (remain_size): IO#read returns "" if file.size == 0.
|
||||
|
1
MANIFEST
1
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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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\
|
||||
|
88
missing/acosh.c
Normal file
88
missing/acosh.c
Normal file
@ -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 <errno.h>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
|
||||
/* 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<<DBL_MANT_DIG/2)
|
||||
#if BIG_CRITERIA_BIT > 0
|
||||
#define BIG_CRITERIA (1.0*BIG_CRITERIA_BIT)
|
||||
#else
|
||||
#define BIG_CRITERIA (1.0*(1<<DBL_MANT_DIG/4)*(1<<(DBL_MANT_DIG/2+1-DBL_MANT_DIG/4)))
|
||||
#endif
|
||||
#define SMALL_CRITERIA_BIT (1<<(DBL_MANT_DIG/3))
|
||||
#if SMALL_CRITERIA_BIT > 0
|
||||
#define SMALL_CRITERIA (1.0/SMALL_CRITERIA_BIT)
|
||||
#else
|
||||
#define SMALL_CRITERIA (1.0*(1<<DBL_MANT_DIG/4)*(1<<(DBL_MANT_DIG/3+1-DBL_MANT_DIG/4)))
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ACOSH
|
||||
double
|
||||
acosh(x)
|
||||
double x;
|
||||
{
|
||||
if (x < 1)
|
||||
x = -1; /* NaN */
|
||||
else if (x == 1)
|
||||
return 0;
|
||||
else if (x > 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<<DBL_MANT_DIG/5))) {
|
||||
double x2 = z * z;
|
||||
z *= 1 + x2 * (-1.0/6.0 + x2 * 3.0/40.0);
|
||||
}
|
||||
else if (z > 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
|
Loading…
x
Reference in New Issue
Block a user