
Issue #19713 has been reported by bannable (Joe Truba). ---------------------------------------- Bug #19713: Off-by-one error when computing very large Integer numbers https://bugs.ruby-lang.org/issues/19713 * Author: bannable (Joe Truba) * Status: Open * Priority: Normal * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- Ruby computes this Elliptic Curve result incorrectly when using Integer operations, but has the correct result when using Rational: ``` a = 154476802108746166441951315019919837485664325669565431700026634898253202035277999 b = 36875131794129999827197811565225474825492979968971970996283137471637224634055579 c = 4373612677928697257861252602371390152816537558161613618621437993378423467772036 int = a / (b + c) + b / (a + c) + c / (a + b) a = a.to_r rational = a / (b + c) + b / (a + c) + c / (a + b) puts [RUBY_VERSION, int == 4, rational == 4].join(' ') ``` Unfortunately, I'm not sure how to minimize this to something simpler than an EC computation. ## Actual ``` ➜ ~ asdf local ruby latest && ruby foo.rb 3.2.1 false true ➜ ~ asdf local ruby 3.1.3 && ruby foo.rb 3.1.3 false true ➜ ~ ``` ## Expected ``` ➜ ~ asdf local ruby latest && ruby foo.rb 3.2.1 true true ➜ ~ asdf local ruby 3.1.3 && ruby foo.rb 3.1.3 true true ➜ ~ ``` -- https://bugs.ruby-lang.org/