<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/numeric.c, 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) f4f728b319086eea3db6e9909fb9c849c276f813: [Backport #21680]</title>
<updated>2025-11-30T00:45:51+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2025-11-30T00:45:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bc21e4d40daeb962699340162547e0fb2b50107f'/>
<id>bc21e4d40daeb962699340162547e0fb2b50107f</id>
<content type='text'>
	[PATCH] [Bug #21680] Fix (base**power_of_two).digits(base) bug (#15144)

	Fix wrong condition in base multiplying loop.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[PATCH] [Bug #21680] Fix (base**power_of_two).digits(base) bug (#15144)

	Fix wrong condition in base multiplying loop.
</pre>
</div>
</content>
</entry>
<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>Use free with ruby_dtoa</title>
<updated>2023-12-07T17:23:02+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2023-12-07T03:29:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0c3593b6573b4186c980fb4ea7635bf95261c749'/>
<id>0c3593b6573b4186c980fb4ea7635bf95261c749</id>
<content type='text'>
In ae0ceafb0c0d05cc80623b525070255e3abb34ef ruby_dtoa was switched to
use malloc instead of xmalloc, which means that consumers should be
using free instead of xfree. Otherwise we will artificially shrink
oldmalloc_increase_bytes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In ae0ceafb0c0d05cc80623b525070255e3abb34ef ruby_dtoa was switched to
use malloc instead of xmalloc, which means that consumers should be
using free instead of xfree. Otherwise we will artificially shrink
oldmalloc_increase_bytes.
</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>[DOC] Fix the argument name in the Numeric#step doc</title>
<updated>2023-10-15T04:47:58+00:00</updated>
<author>
<name>Kouhei Yanagita</name>
<email>yanagi@shakenbu.org</email>
</author>
<published>2023-10-14T22:51:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5cb76754ab7fbe90cbbbe1bc526011c3a28fd1cb'/>
<id>5cb76754ab7fbe90cbbbe1bc526011c3a28fd1cb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #19926] Fix Range#size for ranges with a Rational endpoint</title>
<updated>2023-10-14T02:22:42+00:00</updated>
<author>
<name>Kouhei Yanagita</name>
<email>yanagi@shakenbu.org</email>
</author>
<published>2023-10-13T23:50:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b28c1d2c5644c726bba60cd35ce9313da6e86a4f'/>
<id>b28c1d2c5644c726bba60cd35ce9313da6e86a4f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[DOC] Missing comment markers</title>
<updated>2023-09-27T07:18:05+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-09-27T07:18:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=50520cc1930331bccdb94730e17ddc01798f2be0'/>
<id>50520cc1930331bccdb94730e17ddc01798f2be0</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</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>[DOC] Don't suppress autolinks</title>
<updated>2023-08-13T19:47:12+00:00</updated>
<author>
<name>BurdetteLamar</name>
<email>burdettelamar@yahoo.com</email>
</author>
<published>2023-08-13T19:20:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3080cf3decf18c72c1fc608c112048fff0614c9b'/>
<id>3080cf3decf18c72c1fc608c112048fff0614c9b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
