Project

General

Profile

Bug #3659

Marshal.load(Marshal.dump(10.0)) => 1.0

Added by nagachika (Tomoyuki Chikanaga) almost 10 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.9.3dev (2010-08-04 trunk 28840) [i686-linux]
Backport:
[ruby-dev:41936]

Description

=begin
trunk で 10.0, 200.0 のように 0 でない桁が1つだけの Float を
Marshal.dump -> load すると桁がなくなってしまいます。

Marshal.load(Marshal.dump(1.0))
=> 1.0
Marshal.load(Marshal.dump(10.0))
=> 1.0
Marshal.load(Marshal.dump(100.0))
=> 1.0
Marshal.load(Marshal.dump(110.0))
=> 110.0

r27774, r27792, r27937 の一連の修正で、w_float がダンプする表現が
100.0 => "100" から 100.0 => "1.e2" のように変化したのに
load 時に利用している ruby_strtod() がこのような表現は "1" までしか読まないためです。

なお ruby_strtod が "1.e2" のような表現を受け付けるようにすればいいかとも思ったのですが
r17072 のコミットログによればこれは意図的なようです。
=end

#1

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r28868.
Tomoyuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

#2

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

  • Status changed from Closed to Assigned
  • Assignee set to yugui (Yuki Sonoda)

=begin

=end

#3

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

  • Status changed from Assigned to Closed
  • Assignee changed from yugui (Yuki Sonoda) to nobu (Nobuyoshi Nakada)

=begin

=end

Also available in: Atom PDF