<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_integer.rb, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>merge revision(s) 3a7b9ca93b91dcc086b9ac8b9957e59268f9493b: [Backport #21217]</title>
<updated>2025-04-07T12:19:10+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2025-04-07T12:19:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a67e9e41846cdadad9bb2d9e9d10223c52253898'/>
<id>a67e9e41846cdadad9bb2d9e9d10223c52253898</id>
<content type='text'>
	Fix `Integer.sqrt` to never exceed actual value

	`Integer.sqrt` uses `sqrt(3)` from libm for small values.
	This method must return a value less than or equal to the actual integer
	square root, but libm's sqrt does not always guarantee that.

	This change corrects that by decrementing the result if necessary.

	Fixes [Bug #21217]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix `Integer.sqrt` to never exceed actual value

	`Integer.sqrt` uses `sqrt(3)` from libm for small values.
	This method must return a value less than or equal to the actual integer
	square root, but libm's sqrt does not always guarantee that.

	This change corrects that by decrementing the result if necessary.

	Fixes [Bug #21217]
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #20654] Fix floor and ceil when ndigits is large (#11277)</title>
<updated>2024-07-30T16:05:09+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-07-30T16:05:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0922afa95b3e390876cbea7f78d3d93d979f27d4'/>
<id>0922afa95b3e390876cbea7f78d3d93d979f27d4</id>
<content type='text'>
* 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) # =&gt; -100000
    puts -1.floor(-10) # =&gt; -10000000000
    puts -1.floor(-20) # =&gt; 0

This commit changes the last result so that it will return
-100000000000000000000.

* 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) # =&gt; 100000
    puts 1.ceil(-10) # =&gt; 10000000000
    puts 1.ceil(-20) # =&gt; 0

This commit changes the last result so that it will return
100000000000000000000.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* 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) # =&gt; -100000
    puts -1.floor(-10) # =&gt; -10000000000
    puts -1.floor(-20) # =&gt; 0

This commit changes the last result so that it will return
-100000000000000000000.

* 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) # =&gt; 100000
    puts 1.ceil(-10) # =&gt; 10000000000
    puts 1.ceil(-20) # =&gt; 0

This commit changes the last result so that it will return
100000000000000000000.</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #17037] Improve accuracy of division near precision limits</title>
<updated>2023-11-29T11:16:36+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-11-29T11:16:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8e93bf8e1fbac73b677c333b19a8b55ae9daddc3'/>
<id>8e93bf8e1fbac73b677c333b19a8b55ae9daddc3</id>
<content type='text'>
When dividing near the precision limit of `double`, use Bignum
division to get rid of rounding errors.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When dividing near the precision limit of `double`, use Bignum
division to get rid of rounding errors.
</pre>
</div>
</content>
</entry>
<entry>
<title>Rewrite Integer#times in Ruby (#8388)</title>
<updated>2023-09-07T17:57:52+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2023-09-07T17:57:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5b5ae3d9e064e17e2a7d8d21d739fcc62ae1075c'/>
<id>5b5ae3d9e064e17e2a7d8d21d739fcc62ae1075c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #19349] Respect `#to_int` of `base` argument</title>
<updated>2023-08-31T07:49:58+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-01-18T01:30:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c45176dbca2bd082cb199e9411e4dfc5ec162352'/>
<id>c45176dbca2bd082cb199e9411e4dfc5ec162352</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Separate test for `Kernel#Integer` with `base` argument</title>
<updated>2023-08-31T07:49:57+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-01-18T01:25:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=24b2bb465f6847e5d5df1845e022c940fdf63f48'/>
<id>24b2bb465f6847e5d5df1845e022c940fdf63f48</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix Integer#ceildiv to respect #coerce (#7118)</title>
<updated>2023-01-22T09:53:02+00:00</updated>
<author>
<name>Kouhei Yanagita</name>
<email>yanagi@shakenbu.org</email>
</author>
<published>2023-01-22T09:53:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=20a85ab6119964d1ff129f9c6676fa2a7b2a2be4'/>
<id>20a85ab6119964d1ff129f9c6676fa2a7b2a2be4</id>
<content type='text'>
Fixes [Bug #19343]</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes [Bug #19343]</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #19323] Raise `RangeError` instead of integer overflow</title>
<updated>2023-01-08T11:54:48+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-01-08T11:54:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1cdf8ab07b24ebd16e93621957196e8b1d67f2ba'/>
<id>1cdf8ab07b24ebd16e93621957196e8b1d67f2ba</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #18998] Honor `#to_str` next to `#to_int` in `Kernel#Integer`</title>
<updated>2022-10-20T06:35:31+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2022-10-20T05:07:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=7563604fb868d87057733f52d780d841fc1ab6bb'/>
<id>7563604fb868d87057733f52d780d841fc1ab6bb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add Numeric#ceildiv and Integer#ceildiv</title>
<updated>2022-08-12T06:57:52+00:00</updated>
<author>
<name>Kouhei Yanagita</name>
<email>yanagi@shakenbu.org</email>
</author>
<published>2022-05-27T06:46:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4165fd0e763439421296fbc95d754ad53e6ae84f'/>
<id>4165fd0e763439421296fbc95d754ad53e6ae84f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
