[#20320] Apollo.exeでsingleton_method_addedが効かない — Kazuhiro Yoshida <moriq@...>
もりきゅうです。
5 messages
2003/06/03
[#20335] 1.8 gsub — "H.Suzuki" <hsuzux@...>
hsuzu といいます。
7 messages
2003/06/08
[#20347] 1.8.0 preview3 schedule — matz@... (Yukihiro Matsumoto)
まつもと ゆきひろです
14 messages
2003/06/14
[#20357] Re: 1.8.0 preview3 schedule
— Koji Arai <JCA02266@...>
2003/06/16
新井です。
[#20358] Re: 1.8.0 preview3 schedule
— matz@... (Yukihiro Matsumoto)
2003/06/17
まつもと ゆきひろです
[#20360] Re: 1.8.0 preview3 schedule
— Koji Arai <JCA02266@...>
2003/06/17
新井です。
[#20362] [Oniguruma] quoting substring — kkosako@...
PerlとJavaの正規表現で実現されている
7 messages
2003/06/18
[#20389] Re: [Oniguruma] quoting substring
— Tanaka Akira <akr@...17n.org>
2003/06/19
In article <5FD2F0CF7F5D7F44B00F36870B9E78B508DE5040@SBG-EX4>,
[#20395] Re: [Oniguruma] quoting substring
— Tanaka Akira <akr@...17n.org>
2003/06/20
In article <87u1aloqtq.fsf@serein.a02.aist.go.jp>,
[#20374] case sensitivity of the names of environment variables — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
5 messages
2003/06/19
[#20379] locale and Marshal — Masao Mutoh <mutoh@...>
むとうです。
11 messages
2003/06/19
[#20381] Re: locale and Marshal
— matz@... (Yukihiro Matsumoto)
2003/06/19
まつもと ゆきひろです
[#20392] [BigDecimal] proposal to change specification — "Tadashi Saito" <shiba@...2.accsnet.ne.jp>
斎藤と申します。
25 messages
2003/06/20
[#20407] Re: [BigDecimal] proposal to change specification
— "Shigeo Kobayashi" <shigeo@...>
2003/06/22
小林です。
[#20412] Re: In 1.8.0 nil.to_s is not the same as "" — nobu.nakada@...
なかだです。
5 messages
2003/06/23
[#20416] ruby 1.8.0 preview3 — matz@... (Yukihiro Matsumoto)
まつもと ゆきひろです
11 messages
2003/06/23
[#20422] [BUG] SEGV on Alpha (Re: ruby 1.8.0 preview3)
— Minero Aoki <aamine@...>
2003/06/23
青木です。
[#20424] Re: [BUG] SEGV on Alpha (Re: ruby 1.8.0 preview3)
— matz@... (Yukihiro Matsumoto)
2003/06/23
まつもと ゆきひろです
[#20445] Re: *.soの autoload(PR#504) — nobu.nakada@...
なかだです。
13 messages
2003/06/24
[#20450] Re: *.soの autoload(PR#504)
— matz@... (Yukihiro Matsumoto)
2003/06/25
まつもと ゆきひろです
[#20451] Re: *.soの autoload(PR#504)
— Minero Aoki <aamine@...>
2003/06/25
青木です。
[#20454] Re: *.soのautoload(PR#504)
— nobu.nakada@...
2003/06/25
なかだです。
[#20455] Re: *.soのautoload(PR#504)
— Minero Aoki <aamine@...>
2003/06/25
青木です。
[#20457] Re: *.soのautoload(PR#504)
— matz@... (Yukihiro Matsumoto)
2003/06/25
[#20447] [BigDecimal] renaming proposal — "Tadashi Saito" <shiba@...2.accsnet.ne.jp>
斎藤です。
47 messages
2003/06/24
[#20598] Re: [BigDecimal] renaming proposal
— "Shigeo Kobayashi" <shigeo@...>
2003/07/10
小林です、またまたまとめて。
[#20600] Re: [BigDecimal] renaming proposal
— matz@... (Yukihiro Matsumoto)
2003/07/10
まつもと ゆきひろです
[#20621] Re: [BigDecimal] renaming proposal
— "Shigeo Kobayashi" <shigeo@...>
2003/07/11
小林@MAILチェック中です。
[#20628] Re: [BigDecimal] renaming proposal
— "Shigeo Kobayashi" <shigeo@...>
2003/07/11
小林です。
[#20648] Re: [BigDecimal] 標準添付案 [Re: Re: [BigDecimal] renaming proposal]
— "Shigeo Kobayashi" <shigeo@...>
2003/07/13
小林です。
[#20649] Re: [BigDecimal] 標準添付案
— "Shigeo Kobayashi" <shigeo@...>
2003/07/13
小林です。
[#20692] Re: [BigDecimal] 標準添付案 [Re: Re: [BigDecimal] renaming proposal]
— "Shigeo Kobayashi" <shigeo@...>
2003/07/16
小林です。
[#20462] 原因不明のSEGV — "yamamoto madoka" <dan@...2.so-net.ne.jp>
山本ともうします。
15 messages
2003/06/26
[#20473] Re: 原因不明のSEGV
— "yamamoto madoka" <dan@...2.so-net.ne.jp>
2003/06/27
山本です。
[#20474] Re: 原因不明のSEGV
— nobu.nakada@...
2003/06/27
なかだです。
[ruby-dev:20397] Re: locale and Marshal
From:
Masao Mutoh <mutoh@...>
Date:
2003-06-21 00:45:49 UTC
List:
ruby-dev #20397
むとうです。 On Fri, 20 Jun 2003 12:34:53 +0900 Tanaka Akira <akr@m17n.org> wrote: > In article <1056041498.240245.12121.nullmailer@picachu.netlab.jp>, > matz@ruby-lang.org (Yukihiro Matsumoto) writes: > > > known problemです。sprintf(3)を使わずに(localeに影響されずに) > > 浮動小数点数を文字列化する手段がなかなか手に入らないので。 > > 逆は自前のstrtod(3)を用意することで対応したのですが。 > > ふと、思いついたのですが、(思いついただけですが) > localeconv(3) を使って decimal_point を得て、sprintf の結果を > decimal_point から "." に書き換えてしまうとか。 なるほど。せっかくですので上記を実装してみました。添付します。 #2バイト以上のdecimal_pointには対応してませんが。 -- .:% Masao Mutoh<mutoh@highway.ne.jp>
Attachments (1)
marshal.patch
(909 Bytes, text/x-diff)
--- marshal.c 2003-06-06 18:24:59.000000000 +0900
+++ marshal.c.new 2003-06-21 09:36:52.000000000 +0900
@@ -14,6 +14,7 @@
#include "rubyio.h"
#include "st.h"
#include "util.h"
+#include <locale.h>
#include <math.h>
#ifdef HAVE_FLOAT_H
@@ -278,7 +279,7 @@
struct dump_arg *arg;
{
char buf[100];
-
+
if (isinf(d)) {
if (d < 0) strcpy(buf, "-inf");
else strcpy(buf, "inf");
@@ -292,10 +293,20 @@
}
else {
int len;
+ int i;
+ struct lconv *lc;
+ lc = localeconv();
/* xxx: should not use system's sprintf(3) */
sprintf(buf, "%.*g", FLOAT_DIG, d);
len = strlen(buf);
+ if (lc->decimal_point[0] != '.'){
+ for (i=0; i<len; i++) {
+ if (buf[i] == lc->decimal_point[0]){
+ buf[i] = '.';
+ }
+ }
+ }
w_bytes(buf, len + save_mantissa(d, buf + len), arg);
return;
}