From: nobu.nakada@... Date: 2003-04-21T00:17:27+09:00 Subject: [ruby-dev:20045] Re: Roundoff problem with Float and Marshal なかだです。 At Fri, 18 Apr 2003 23:52:36 +0900, Yukihiro Matsumoto wrote: > |> Interesting. Is this endian safe, i.e. does this work properly on > |> both little endian and big endian machine? > | > |No, unfortunately, and assuming binary format is less portable. > > あ、やっぱり。 [ruby-talk:69702]ではendian-safeだと主張してるようなんですが、 どう見ても思いっきり依存してるような気がします。単にbig endian 用のコードがすっぽり抜けてるだけかも知れませんが、わざわざ IEEE754限定にすることもないと思います。 > |> If it is endian safe, then we can put mantissa bits at the tail of > |> float representation, e.g. "2.3847655 \001\001", to make it work well > |> with older Marshal. > | > |Implemented with "\0" separator. > > これはポータビリティがあるんでしたらこれでいきましょう。 そのはずです。sourceforgeのCompileFarmで試したところでは、シス テムによって[ruby-talk:69753]のように計算結果自体が微妙にずれる ことはありますが、Marshal自体はうまく行くようです。 仮数のビット数を増やしてもいいように、ちょっといじってコミット しました。 -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦