diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2024-07-26 11:10:53 -0400 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2024-08-02 18:26:26 +0900 |
| commit | 7fc6448ec7f7505ca5772af0a60ee780c321492c (patch) | |
| tree | c921386da7cc206a36cfb6bcf24bcb5579024576 /spec/ruby/core/array/include_spec.rb | |
| parent | 7048fbdf59509e4f52eff56d7c044ed28eb67727 (diff) | |
Fix ceil when ndigits is large
[Bug #20654]
This commit fixes Integer#ceil and Float#ceil 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.ceil(-5) # => 100000
puts 1.ceil(-10) # => 10000000000
puts 1.ceil(-20) # => 0
This commit changes the last result so that it will return
100000000000000000000.
Diffstat (limited to 'spec/ruby/core/array/include_spec.rb')
0 files changed, 0 insertions, 0 deletions
