[#16732] sharing sub-regexp — Tanaka Akira <akr@...17n.org>

Oniguruma についてひとつ要望があります。

51 messages 2002/04/03
[#16744] Re: sharing sub-regexp — "K.Kosako" <kosako@...> 2002/04/04

Tanaka Akiraさんの<hvopu1hxfyd.fsf@coulee.a02.aist.go.jp>から

[#16746] Re: sharing sub-regexp — matz@... (Yukihiro Matsumoto) 2002/04/04

まつもと ゆきひろです

[#16753] Re: sharing sub-regexp — Tanaka Akira <akr@...17n.org> 2002/04/04

In article <1017890618.302241.17865.nullmailer@ev.netlab.jp>,

[#16755] Re: sharing sub-regexp — "K.Kosako" <kosako@...> 2002/04/05

Tanaka Akiraさんの<hvo7knn93ug.fsf@coulee.a02.aist.go.jp>から

[#16756] Re: sharing sub-regexp — Tanaka Akira <akr@...17n.org> 2002/04/05

In article <20020405044506.D4784349@helium.ruby-lang.org>,

[#16822] Re: sharing sub-regexp — "K.Kosako" <kosako@...> 2002/04/10

Tanaka Akiraさんの<hvopu1e4omy.fsf@coulee.a02.aist.go.jp>から

[#16831] Re: sharing sub-regexp — Tanaka Akira <akr@...17n.org> 2002/04/10

In article <20020410025054.C8DF0915@helium.ruby-lang.org>,

[#16863] Re: sharing sub-regexp — Tanaka Akira <akr@...17n.org> 2002/04/11

In article <hvor8lnchak.fsf@coulee.a02.aist.go.jp>,

[#16877] Re: sharing sub-regexp — Shugo Maeda <shugo@...> 2002/04/12

前田です。

[#16887] Re: sharing sub-regexp — Tanaka Akira <akr@...17n.org> 2002/04/12

In article <87pu15z80q.wl@studly.priv.netlab.jp>,

[#16909] Regexp#to_s — Shugo Maeda <shugo@...> 2002/04/15

前田です。

[#16912] Re: Regexp#to_s — Tanaka Akira <akr@...17n.org> 2002/04/15

In article <87g01x1e6m.wl@studly.priv.netlab.jp>,

[#16931] Re: Regexp#to_s — Kazuhiro NISHIYAMA <zn@...> 2002/04/16

西山和広です。

[#16934] Re: Regexp#to_s — Tanaka Akira <akr@...17n.org> 2002/04/16

In article <20020416180631.988E.ZN@mbf.nifty.com>,

[#16938] Re: Regexp#to_s — Shugo Maeda <shugo@...> 2002/04/17

前田です。

[#16939] Re: Regexp#to_s — Tanaka Akira <akr@...17n.org> 2002/04/17

In article <87u1qaj0xe.wl@studly.priv.netlab.jp>,

[#16947] Re: Regexp#to_s — Shugo Maeda <shugo@...> 2002/04/18

前田です。

[#16950] Re: Regexp#to_s — matz@... (Yukihiro Matsumoto) 2002/04/18

まつもと ゆきひろです

[#16951] Re: Regexp#to_s — Tanaka Akira <akr@...17n.org> 2002/04/18

In article <1019116103.420173.12691.nullmailer@picachu.netlab.jp>,

[#16960] Re: Regexp#to_s — nobu.nakada@... 2002/04/18

なかだです。

[#16761] StringIO — tadf@...

ふなばです。

43 messages 2002/04/05
[#16786] Re: StringIO — nobu.nakada@... 2002/04/08

なかだです。

[#16802] Re: StringIO — tadf@... 2002/04/09

ふなばです。

[#16803] Re: StringIO — nobu.nakada@... 2002/04/09

なかだです。

[#16804] Re: StringIO — tadf@... 2002/04/09

ふなばです。

[#17221] Re: StringIO — Wakou Aoyama <wakou@...> 2002/05/30

青山です。

[#17230] Re: StringIO — matz@... (Yukihiro Matsumoto) 2002/05/30

まつもと ゆきひろです

[#17231] Re: StringIO — Tanaka Akira <akr@...17n.org> 2002/05/30

In article <1022740594.117106.6073.nullmailer@picachu.netlab.jp>,

[#17233] IO#size — Shugo Maeda <shugo@...> 2002/05/30

前田です。

[#17239] Re: IO#size — Tanaka Akira <akr@...17n.org> 2002/05/31

In article <874rgqdt3x.wl@studly.priv.netlab.jp>,

[#17253] Re: IO#size — Wakou Aoyama <wakou@...> 2002/05/31

青山です。

[#16790] Ruby Shim — "Akinori MUSHA" <knu@...>

 1.7 early access kit という仮称で提案した構想ですが、先ほど

27 messages 2002/04/08
[#16796] Re: Ruby Shim — Koji Arai <JCA02266@...> 2002/04/08

新井です。

[#16833] math.c 1.10 — "U.Nakamura" <usa@...>

こんにちは、なかむら(う)です。

23 messages 2002/04/11
[#16834] Re: math.c 1.10 — matz@... (Yukihiro Matsumoto) 2002/04/11

まつもと ゆきひろです

[#16869] Makefiles dependency — nobu.nakada@...

なかだです。

17 messages 2002/04/12

[ruby-dev:16864] Re: math.c 1.10

From: nobu.nakada@...
Date: 2002-04-11 18:37:24 UTC
List: ruby-dev #16864
なかだです。

At Fri, 12 Apr 2002 01:54:23 +0900,
OZAWA -Crouton- Sakuro wrote:
> > > acosh がなくて、asinhなどがあるというのは考えにくいんで、こ
> > > れら全部をひとつのファイル(missing/acos.c)に入れて、
> 
> ファイル名、acos.cでいいんですか?
> archyp.c くらいにはしといたほうがいいんじゃないかと。

たしかにそっちのほうが適切っぽいんですが、AC_REPLACE_FUNCSだと
関数名をそのままファイル名にしちゃうんですよね。こういう感じか
なぁ。

それはそうと、アルゴリズム事典を発掘して確認してみたら、思いっ
きり間違ってました。これでだいたい最低精度は12桁くらいです。


Index: Makefile.in
===================================================================
RCS file: /cvs/ruby/src/ruby/Makefile.in,v
retrieving revision 1.32
diff -u -2 -p -r1.32 Makefile.in
--- Makefile.in	2002/04/02 06:48:41	1.32
+++ Makefile.in	2002/04/11 18:13:33
@@ -169,4 +169,7 @@ alloca.@OBJEXT@: $(srcdir)/missing/alloc
 	$(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/alloca.c
 
+archyp.@OBJEXT@: $(srcdir)/missing/archyp.c
+	$(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/archyp.c
+
 crypt.@OBJEXT@: $(srcdir)/missing/crypt.c
 	$(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/crypt.c
@@ -174,4 +177,7 @@ crypt.@OBJEXT@: $(srcdir)/missing/crypt.
 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
Index: configure.in
===================================================================
RCS file: /cvs/ruby/src/ruby/configure.in,v
retrieving revision 1.116
diff -u -2 -p -r1.116 configure.in
--- configure.in	2002/04/11 10:02:59	1.116
+++ configure.in	2002/04/11 17:58:03
@@ -309,5 +309,8 @@ AC_CHECK_FUNCS(fmod killpg drand48 rando
 	      getpgrp setpgrp getpgid setpgid getgroups getpriority getrlimit\
 	      dlopen sigprocmask sigaction _setjmp setsid telldir seekdir fchmod\
-	      mktime timegm cosh sinh tanh)
+	      mktime timegm cosh sinh tanh acosh asinh atanh)
+case $ac_cv_func_acosh$ac_cv_func_asinh$ac_cv_func_atanh in
+*no*) AC_LIBOBJ(archyp);;
+esac
 AC_STRUCT_TIMEZONE
 AC_CACHE_CHECK(for struct tm.tm_gmtoff, rb_cv_member_struct_tm_tm_gmtoff,
Index: missing/archyp.c
===================================================================
RCS file: archyp.c
diff -N archyp.c
--- /dev/null	Thu Jan  1 09:00:00 1970
+++ archyp.c	Fri Apr 12 03:16:10 2002
@@ -0,0 +1,88 @@
+/**********************************************************************
+
+  archyp.c -
+
+  $Author$
+  $Date$
+  created at: Fri Apr 12 03:05:29 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


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread