diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2024-07-26 11:10:39 -0400 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2024-08-02 18:26:26 +0900 |
| commit | 7048fbdf59509e4f52eff56d7c044ed28eb67727 (patch) | |
| tree | d452f89f73b5cee9128b6d9a903b9b99cb14edcd /test/ruby/test_rubyoptions.rb | |
| parent | 0cc98ae353fd231bcd0e704c251198abc4406247 (diff) | |
Fix floor when ndigits is large
[Bug #20654]
This commit fixes Integer#floor and Float#floor when the number is
negative and ndigits is large such that 10**ndigits is a bignum.
Previously, it would return 0 in such cases. However, this would cause
unexpected behaviour such as:
puts -1.floor(-5) # => -100000
puts -1.floor(-10) # => -10000000000
puts -1.floor(-20) # => 0
This commit changes the last result so that it will return
-100000000000000000000.
Diffstat (limited to 'test/ruby/test_rubyoptions.rb')
0 files changed, 0 insertions, 0 deletions
