
Issue #21110 has been updated by herwin (Herwin W). nobu (Nobuyoshi Nakada) wrote in #note-3:
At least, `Float` should be distinguished only by its value, not its object ID
Bigint has similar behaviour: ``` ruby Marshal.dump([2**64, 2**64]) #=> "\x04\b[\al+\n\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00l+\n\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00" Marshal.dump([n=2**64, n]) #=> "\x04\b[\al+\n\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00@\x06" ``` ---------------------------------------- Misc #21110: Should Marshal.dump always use object links for repeated Float values? https://bugs.ruby-lang.org/issues/21110#change-111807 * Author: andrykonchin (Andrew Konchin) * Status: Open ---------------------------------------- I've noticed (during the downstreaming ruby/spec in https://github.com/ruby/ruby/pull/12679) that a repeated Float value may be dumped "directly"/"immediately" without an object link on x86 architecture, and with a link in other cases. It seems it depends on whether Float is `Flonum` or not. amd64: ```ruby Marshal.dump([0.0, 0.0]) # => "\x04\b[\af\x060@\x06", where @\x06 is an object link ``` i686: ```ruby Marshal.dump([0.0, 0.0]) # => "\x04\b[\af\x060f\x060", so f\x060 is dumped twice ``` Both dumps are loaded correctly, so it seems there is no any compatibility issue. Should dumping be consistent and don't depend on architecture? From https://github.com/ruby/ruby/pull/12679#discussion_r1937116017 -- https://bugs.ruby-lang.org/