[#33567] rational, complex and nuby — Tadayoshi Funaba <tadf@...>

ruby に rational と complex を組みこもうと試していて nuby という派生物

21 messages 2008/02/02

[#33580] Re: cgi.rb再構築案 — "Makoto Kuwata" <kwa@...>

桑田といいます。

17 messages 2008/02/03

[#33611] Solaris で timeout.rb が Segmentation fault する。 — shiiya@...

はじめまして。椎屋と申します。

15 messages 2008/02/06
[#33612] Re: Solaris で timeout.rb が Segmentation fault する。 — Nobuyoshi Nakada <nobu@...> 2008/02/06

なかだです。

[#33613] Re: Solaris で timeout.rb が Segmentation fault する。 — shiiya yoshitaka <shiiya@...> 2008/02/06

椎屋です。反応ありがとうございます。

[#33650] Re: Solaris で timeout.rb が Segmentation fault する。 — Nobuyoshi Nakada <nobu@...> 2008/02/08

なかだです。

[#33652] Re: Solaris で timeout.rb が Segmentation fault する。 — SATOH Fumiyasu <fumiyas@...> 2008/02/08

さとうふみやす @ OSS テクノロジです。

[#33621] EUC-KR <-> UTF-8 transition table — "Park Ji-In" <tisphie@...>

朴 芝印です。

15 messages 2008/02/06

[#33628] encdet.rb — Tanaka Akira <akr@...>

前から考えていたのですが、ファイル先頭の magic comment や

18 messages 2008/02/07

[#33662] rational, complex and mathn — Tadayoshi Funaba <tadf@...>

rational は floor、truncate、ceil、round を定義していません。Numeric

66 messages 2008/02/08
[#33663] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/08

他にも問題、課題はあると思います。すぐに解決できるものと、そうでないも

[#33664] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/08

ひとつ書き忘れました。

[#33707] Re: rational, complex and mathn — Yukihiro Matsumoto <matz@...> 2008/02/12

まつもと ゆきひろです

[#33714] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/12

> 原さんのrationalは導入予定がありますので、この機会にもう一度

[#33727] Re: rational, complex and mathn — Shin-ichiro HARA <sinara@...> 2008/02/13

原です。

[#33761] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/13

> 前にふなばさんと個人的なメールのやりとりで、結局また私がrationalをまと

[#33788] Re: rational, complex and mathn — Shin-ichiro HARA <sinara@...> 2008/02/15

原です。

[#33795] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/15

> > それなりに速くはなるし、単純なところでそれなりに満足していますが、一度、

[#33806] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/16

nurat 0.0.2 を出しました (ついでに nucomp も)。

[#33812] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/16

仕様を確認していきたいと思います。

[#33815] Re: rational, complex and mathn — Yukihiro Matsumoto <matz@...> 2008/02/16

まつもと ゆきひろです

[#33818] Re: rational, complex and mathn — Shin-ichiro HARA <sinara@...> 2008/02/16

原です。

[#33819] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/17

> > new!はRubyで実装しているためにだけ必要なので、Cで実装するな

[#33821] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/17

> Rational() は、1つか2つの引数をとる。

[#33827] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/17

> 実際的に重要な機能が Rational() という名前で固定されるのはクラスの定義

[#33845] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/18

もうあまり手を入れないでおこうと思ったのです、つい手を入れてしまいまし

[#33886] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/21

ちょっと実験してみました。原さんの rational は、かけ算割り算が速いので、

[#33888] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/21

で、考えていたんですが、目的は、最速の rational を作ることではなくて、

[#33903] Re: rational, complex and mathn — Shin-ichiro HARA <sinara@...> 2008/02/22

原です。

[#33905] Re: rational, complex and mathn — "NARUSE, Yui" <naruse@...> 2008/02/22

成瀬です。

[#33908] Re: rational, complex and mathn — Yukihiro Matsumoto <matz@...> 2008/02/22

まつもと ゆきひろです

[#33914] Re: rational, complex and mathn — Tadayoshi Funaba <tadf@...> 2008/02/23

> はい。Complexについても1.9の間に組み込んでよいと思います。

[#33679] bigdecimal — Tadayoshi Funaba <tadf@...>

bigdecimal/math.rb の BigMath は、利用者が include してつかうことを前

23 messages 2008/02/09
[#33680] Re: bigdecimal — Tadayoshi Funaba <tadf@...> 2008/02/09

Integer や Float に比べると、BigDicimal() は、1 や 1.1 を受けつけない、

[#33686] Re: bigdecimal — Tadashi Saito <shiba@...2.accsnet.ne.jp> 2008/02/10

斎藤と申します。

[#33698] Re: bigdecimal — Tadayoshi Funaba <tadf@...> 2008/02/11

> 仮にBigDecimal(1.1)を、(二進小数として)受け付けると、「BigDecimalでは、

[#33705] Re: bigdecimal — Yukihiro Matsumoto <matz@...> 2008/02/12

まつもと ゆきひろです

[#33726] Re: [ruby-cvs:22680] Ruby:r15443 (trunk): * bootstraptest/runner.rb, bootstraptest/test_method.rb, enc/depend, — "U.Nakamura" <usa@...>

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

14 messages 2008/02/13
[#33730] Re: [ruby-cvs:22680] Ruby:r15443 (trunk): * bootstraptest/runner.rb, bootstraptest/test_method.rb, enc/depend, — "NARUSE, Yui" <naruse@...> 2008/02/13

成瀬です。

[#33889] Re: [ ruby-Bugs-17454 ] irb crash while iterating over all objects — Urabe Shyouhei <shyouhei@...>

卜部です。ちょっとお知恵を拝借したく。

22 messages 2008/02/21
[#33892] Re: [ ruby-Bugs-17454 ] irb crash while iterating over all objects — Nobuyoshi Nakada <nobu@...> 2008/02/21

なかだです。

[#33909] Re: [ ruby-Bugs-17454 ] irb crash while iterating over all objects — Urabe Shyouhei <shyouhei@...> 2008/02/22

Nobuyoshi Nakada さんは書きました:

[#36081] Re: [ ruby-Bugs-17454 ] irb crash while iterating over all objects — TOYOFUKU Chikanobu <nobu_toyofuku@...> 2008/09/01

豊福です。

[#36085] Re: [ ruby-Bugs-17454 ] irb crash while iterating over all objects — Yukihiro Matsumoto <matz@...> 2008/09/01

まつもと ゆきひろです

[ruby-dev:33944] Re: [ruby-cvs:22878] Ruby:r15641 (trunk): * string.c (rb_str_chomp_bang): now works on UTF-16.

From: Nobuyoshi Nakada <nobu@...>
Date: 2008-02-29 15:44:39 UTC
List: ruby-dev #33944
なかだです。

At Fri, 29 Feb 2008 22:33:28 +0900 (JST),
matz@ruby-lang.org wrote in [ruby-cvs:22878]:
>   Log:
>     * string.c (rb_str_chomp_bang): now works on UTF-16.
>     
>     * string.c (tr_setup_table): negation should work on non ASCII
>       compatible strings as well.
>     
>     * string.c (rb_str_split_m): awk split should work on non ASCII
>       compatible strings as well.

気づいてない人が多いような気がするので書いておきますが、こういう
用途のためにrb_enc_ascget()というのがあるようです。


Index: string.c
===================================================================
--- string.c	(revision 15645)
+++ string.c	(working copy)
@@ -4447,5 +4447,5 @@ tr_setup_table(VALUE str, char stable[25
     char buf[256];
     struct tr tr;
-    int c;
+    int c, l;
     VALUE table = 0, ptable = 0;
     int i, cflag = 0;
@@ -4454,18 +4454,7 @@ tr_setup_table(VALUE str, char stable[25
     tr.gen = tr.now = tr.max = 0;
     
-    if (RSTRING_LEN(str) > 1) {
-	if (rb_enc_asciicompat(enc)) {
-	    if (RSTRING_PTR(str)[0] == '^') {
-		cflag = 1;
-		tr.p++;
-	    }
-	}
-	else {
-	    c = rb_enc_codepoint(RSTRING_PTR(str), RSTRING_END(str), enc);
-	    if (c == '^') {
-		cflag = 1;
-		tr.p+=rb_enc_codelen(c, enc);
-	    }
-	}
+    if (RSTRING_LEN(str) > 1 && rb_enc_ascget(tr.p, tr.pend, &l, enc) == '^') {
+	cflag = 1;
+	tr.p += l;
     }
     if (first) {
@@ -4859,6 +4848,7 @@ rb_str_split_m(int argc, VALUE *argv, VA
 	    }
 	    else {
-		if (str_strlen(spat, enc2) == 1 &&
-		    rb_enc_codepoint(RSTRING_PTR(spat), RSTRING_END(spat), enc2) == ' ') {
+		int l;
+		if (rb_enc_ascget(RSTRING_PTR(spat), RSTRING_END(spat), &l, enc2) == ' ' &&
+		    RSTRING_LEN(spat) == l) {
 		    awk_split = Qtrue;
 		}
@@ -5299,14 +5289,13 @@ rb_str_chomp_bang(int argc, VALUE *argv,
 	    enc = rb_enc_get(str);
 	    if (rb_enc_mbminlen(enc) > 1) {
-		len = str_strlen(str, enc);
-		pp = rb_enc_nth(p, e, len-1, enc);
+		pp = rb_enc_left_char_head(p, e-rb_enc_mbminlen(enc), enc);
 		if (rb_enc_is_newline(pp, e, enc)) {
 		    e = pp;
-		    len--;
 		}
-		if (len > 0) {
-		    p = rb_enc_nth(p, e, len-1, enc);
-		    if (rb_enc_codepoint(p, e, enc) == '\r') {
-			pp = e = p;
+		pp = e - rb_enc_mbminlen(enc);
+		if (pp >= p) {
+		    pp = rb_enc_left_char_head(p, pp, enc);
+		    if (rb_enc_ascget(pp, e, 0, enc) == '\r') {
+			e = pp;
 		    }
 		}
@@ -5314,5 +5303,5 @@ rb_str_chomp_bang(int argc, VALUE *argv,
 		    return Qnil;
 		}
-		len = pp - RSTRING_PTR(str);
+		len = e - RSTRING_PTR(str);
 		STR_SET_LEN(str, len);
 	    }


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

In This Thread

Prev Next