From: "Eregon (Benoit Daloze) via ruby-core" Date: 2025-02-03T13:08:09+00:00 Subject: [ruby-core:120870] [Ruby master Misc#21110] Should Marshal.dump always use object links for repeated Float values? Issue #21110 has been updated by Eregon (Benoit Daloze). IMO Marshal should not depend on obscure implementation details like Flonum, i.e. Float whether fitting in a Flonum or not should be dumped the same with Marshal. What do others think? ---------------------------------------- Misc #21110: Should Marshal.dump always use object links for repeated Float values? https://bugs.ruby-lang.org/issues/21110#change-111743 * 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 objct 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? -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/