ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-dev:52176] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
@ 2025-11-04 14:20 mtasaka (Mamoru TASAKA) - ruby-dev 経由
  2025-11-06 11:25 ` [ruby-dev:52177] " nobu (Nobuyoshi Nakada) - ruby-dev 経由
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mtasaka (Mamoru TASAKA) - ruby-dev 経由 @ 2025-11-04 14:20 UTC (permalink / raw)
  To: ruby-dev; +Cc: mtasaka (Mamoru TASAKA)

Issue #21666 has been reported by mtasaka (Mamoru TASAKA).

----------------------------------------
Bug #21666: Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
https://bugs.ruby-lang.org/issues/21666

* Author: mtasaka (Mamoru TASAKA)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-11-04 master 55257b5038) +PRISM [x86_64-linux]
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
With Fedora glibc-2.42.9000-8.fc44 the following test:

https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/spec/ruby/core/math/lgamma_spec.rb#L9

fails like
```
1)
Math.lgamma returns [Infinity, 1] when passed -1 FAILED
Expected [Infinity, -1] == [Infinity, 1]
to be truthy but was false
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:10:in 'block (3 levels) in <top (required)>'
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:3:in '<top (required)>'
```

(With the help from glibc developer: https://bugzilla.redhat.com/show_bug.cgi?id=2412227 )

POSIX.1-2024 says (ref: https://pubs.opengroup.org/onlinepubs/9799919799/functions/lgamma.html )

> If \(x\) is a non-positive integer, a pole error shall occur and 
> lgamma(), lgammaf(), and lgammal() shall return +HUGE_VAL, +HUGE_VALF, and +HUGE_VALL, respectively.

but also says:

> The sign of \( \Gamma(x) \) shall be returned in the external integer signgam. 
> If \(x\) is NaN, -Inf, or a negative integer, the value of signgam is **unspecified**.`

So on this line:
https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/math.c#L1103
when `d` is -1 (or negative integer), the value of `sign` is unspeficied.



-- 
https://bugs.ruby-lang.org/
_______________________________________________
ruby-dev メーリングリスト -- ruby-dev@ml.ruby-lang.org
配信停止は ruby-dev-leave@ml.ruby-lang.org にメールをお送りください。

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-dev:52177] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
  2025-11-04 14:20 [ruby-dev:52176] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44 mtasaka (Mamoru TASAKA) - ruby-dev 経由
@ 2025-11-06 11:25 ` nobu (Nobuyoshi Nakada) - ruby-dev 経由
  2025-11-06 13:36 ` [ruby-dev:52178] " mtasaka (Mamoru TASAKA) - ruby-dev 経由
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: nobu (Nobuyoshi Nakada) - ruby-dev 経由 @ 2025-11-06 11:25 UTC (permalink / raw)
  To: ruby-dev; +Cc: nobu (Nobuyoshi Nakada)

Issue #21666 has been updated by nobu (Nobuyoshi Nakada).


Is this correct?
https://github.com/ruby/ruby/compare/master...nobu:ruby:lgamma-unspecified-values?expand=1

----------------------------------------
Bug #21666: Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
https://bugs.ruby-lang.org/issues/21666#change-115086

* Author: mtasaka (Mamoru TASAKA)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-11-04 master 55257b5038) +PRISM [x86_64-linux]
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
With Fedora glibc-2.42.9000-8.fc44 the following test:

https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/spec/ruby/core/math/lgamma_spec.rb#L9

fails like
```
1)
Math.lgamma returns [Infinity, 1] when passed -1 FAILED
Expected [Infinity, -1] == [Infinity, 1]
to be truthy but was false
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:10:in 'block (3 levels) in <top (required)>'
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:3:in '<top (required)>'
```

(With the help from glibc developer: https://bugzilla.redhat.com/show_bug.cgi?id=2412227 )

POSIX.1-2024 says (ref: https://pubs.opengroup.org/onlinepubs/9799919799/functions/lgamma.html )

> If \(x\) is a non-positive integer, a pole error shall occur and 
> lgamma(), lgammaf(), and lgammal() shall return +HUGE_VAL, +HUGE_VALF, and +HUGE_VALL, respectively.

but also says:

> The sign of \( \Gamma(x) \) shall be returned in the external integer signgam. 
> If \(x\) is NaN, -Inf, or a negative integer, the value of signgam is **unspecified**.`

So on this line:
https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/math.c#L1103
when `d` is -1 (or negative integer), the value of `sign` is unspeficied.



-- 
https://bugs.ruby-lang.org/
_______________________________________________
ruby-dev メーリングリスト -- ruby-dev@ml.ruby-lang.org
配信停止は ruby-dev-leave@ml.ruby-lang.org にメールをお送りください。

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-dev:52178] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
  2025-11-04 14:20 [ruby-dev:52176] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44 mtasaka (Mamoru TASAKA) - ruby-dev 経由
  2025-11-06 11:25 ` [ruby-dev:52177] " nobu (Nobuyoshi Nakada) - ruby-dev 経由
@ 2025-11-06 13:36 ` mtasaka (Mamoru TASAKA) - ruby-dev 経由
  2025-11-06 13:55 ` [ruby-dev:52179] " mtasaka (Mamoru TASAKA) - ruby-dev 経由
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mtasaka (Mamoru TASAKA) - ruby-dev 経由 @ 2025-11-06 13:36 UTC (permalink / raw)
  To: ruby-dev; +Cc: mtasaka (Mamoru TASAKA)

Issue #21666 has been updated by mtasaka (Mamoru TASAKA).


>  https://github.com/ruby/ruby/compare/master...nobu:ruby:lgamma-unspecified-values?expand=1

Thank you. I've checked the above change and as far as I read the specification (POSIX) this is correct.

----------------------------------------
Bug #21666: Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
https://bugs.ruby-lang.org/issues/21666#change-115089

* Author: mtasaka (Mamoru TASAKA)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-11-04 master 55257b5038) +PRISM [x86_64-linux]
* Backport: 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED
----------------------------------------
With Fedora glibc-2.42.9000-8.fc44 the following test:

https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/spec/ruby/core/math/lgamma_spec.rb#L9

fails like
```
1)
Math.lgamma returns [Infinity, 1] when passed -1 FAILED
Expected [Infinity, -1] == [Infinity, 1]
to be truthy but was false
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:10:in 'block (3 levels) in <top (required)>'
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:3:in '<top (required)>'
```

(With the help from glibc developer: https://bugzilla.redhat.com/show_bug.cgi?id=2412227 )

POSIX.1-2024 says (ref: https://pubs.opengroup.org/onlinepubs/9799919799/functions/lgamma.html )

> If \(x\) is a non-positive integer, a pole error shall occur and 
> lgamma(), lgammaf(), and lgammal() shall return +HUGE_VAL, +HUGE_VALF, and +HUGE_VALL, respectively.

but also says:

> The sign of \( \Gamma(x) \) shall be returned in the external integer signgam. 
> If \(x\) is NaN, -Inf, or a negative integer, the value of signgam is **unspecified**.`

So on this line:
https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/math.c#L1103
when `d` is -1 (or negative integer), the value of `sign` is unspeficied.



-- 
https://bugs.ruby-lang.org/
_______________________________________________
ruby-dev メーリングリスト -- ruby-dev@ml.ruby-lang.org
配信停止は ruby-dev-leave@ml.ruby-lang.org にメールをお送りください。

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-dev:52179] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
  2025-11-04 14:20 [ruby-dev:52176] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44 mtasaka (Mamoru TASAKA) - ruby-dev 経由
  2025-11-06 11:25 ` [ruby-dev:52177] " nobu (Nobuyoshi Nakada) - ruby-dev 経由
  2025-11-06 13:36 ` [ruby-dev:52178] " mtasaka (Mamoru TASAKA) - ruby-dev 経由
@ 2025-11-06 13:55 ` mtasaka (Mamoru TASAKA) - ruby-dev 経由
  2025-11-06 14:44 ` [ruby-dev:52180] " mtasaka (Mamoru TASAKA) - ruby-dev 経由
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mtasaka (Mamoru TASAKA) - ruby-dev 経由 @ 2025-11-06 13:55 UTC (permalink / raw)
  To: ruby-dev; +Cc: mtasaka (Mamoru TASAKA)

Issue #21666 has been updated by mtasaka (Mamoru TASAKA).


To be sure, I will try building and run test with Fedora glibc-2.42.9000-8.fc44 (after applying the above PR)

----------------------------------------
Bug #21666: Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
https://bugs.ruby-lang.org/issues/21666#change-115090

* Author: mtasaka (Mamoru TASAKA)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-11-04 master 55257b5038) +PRISM [x86_64-linux]
* Backport: 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED
----------------------------------------
With Fedora glibc-2.42.9000-8.fc44 the following test:

https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/spec/ruby/core/math/lgamma_spec.rb#L9

fails like
```
1)
Math.lgamma returns [Infinity, 1] when passed -1 FAILED
Expected [Infinity, -1] == [Infinity, 1]
to be truthy but was false
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:10:in 'block (3 levels) in <top (required)>'
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:3:in '<top (required)>'
```

(With the help from glibc developer: https://bugzilla.redhat.com/show_bug.cgi?id=2412227 )

POSIX.1-2024 says (ref: https://pubs.opengroup.org/onlinepubs/9799919799/functions/lgamma.html )

> If \(x\) is a non-positive integer, a pole error shall occur and 
> lgamma(), lgammaf(), and lgammal() shall return +HUGE_VAL, +HUGE_VALF, and +HUGE_VALL, respectively.

but also says:

> The sign of \( \Gamma(x) \) shall be returned in the external integer signgam. 
> If \(x\) is NaN, -Inf, or a negative integer, the value of signgam is **unspecified**.`

So on this line:
https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/math.c#L1103
when `d` is -1 (or negative integer), the value of `sign` is unspeficied.



-- 
https://bugs.ruby-lang.org/
_______________________________________________
ruby-dev メーリングリスト -- ruby-dev@ml.ruby-lang.org
配信停止は ruby-dev-leave@ml.ruby-lang.org にメールをお送りください。

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-dev:52180] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
  2025-11-04 14:20 [ruby-dev:52176] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44 mtasaka (Mamoru TASAKA) - ruby-dev 経由
                   ` (2 preceding siblings ...)
  2025-11-06 13:55 ` [ruby-dev:52179] " mtasaka (Mamoru TASAKA) - ruby-dev 経由
@ 2025-11-06 14:44 ` mtasaka (Mamoru TASAKA) - ruby-dev 経由
  2025-11-29  4:01 ` [ruby-dev:52186] " nagachika (Tomoyuki Chikanaga) - ruby-dev 経由
  2025-12-08 22:30 ` [ruby-dev:52188] " k0kubun (Takashi Kokubun) - ruby-dev 経由
  5 siblings, 0 replies; 7+ messages in thread
From: mtasaka (Mamoru TASAKA) - ruby-dev 経由 @ 2025-11-06 14:44 UTC (permalink / raw)
  To: ruby-dev; +Cc: mtasaka (Mamoru TASAKA)

Issue #21666 has been updated by mtasaka (Mamoru TASAKA).


Okay, lgamma testsuite now seems good after applying https://github.com/ruby/ruby/pull/15076 with Fedora glibc-2.42.9000-8.fc44

----------------------------------------
Bug #21666: Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
https://bugs.ruby-lang.org/issues/21666#change-115092

* Author: mtasaka (Mamoru TASAKA)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-11-04 master 55257b5038) +PRISM [x86_64-linux]
* Backport: 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED
----------------------------------------
With Fedora glibc-2.42.9000-8.fc44 the following test:

https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/spec/ruby/core/math/lgamma_spec.rb#L9

fails like
```
1)
Math.lgamma returns [Infinity, 1] when passed -1 FAILED
Expected [Infinity, -1] == [Infinity, 1]
to be truthy but was false
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:10:in 'block (3 levels) in <top (required)>'
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:3:in '<top (required)>'
```

(With the help from glibc developer: https://bugzilla.redhat.com/show_bug.cgi?id=2412227 )

POSIX.1-2024 says (ref: https://pubs.opengroup.org/onlinepubs/9799919799/functions/lgamma.html )

> If \(x\) is a non-positive integer, a pole error shall occur and 
> lgamma(), lgammaf(), and lgammal() shall return +HUGE_VAL, +HUGE_VALF, and +HUGE_VALL, respectively.

but also says:

> The sign of \( \Gamma(x) \) shall be returned in the external integer signgam. 
> If \(x\) is NaN, -Inf, or a negative integer, the value of signgam is **unspecified**.`

So on this line:
https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/math.c#L1103
when `d` is -1 (or negative integer), the value of `sign` is unspeficied.



-- 
https://bugs.ruby-lang.org/
_______________________________________________
ruby-dev メーリングリスト -- ruby-dev@ml.ruby-lang.org
配信停止は ruby-dev-leave@ml.ruby-lang.org にメールをお送りください。

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-dev:52186] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
  2025-11-04 14:20 [ruby-dev:52176] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44 mtasaka (Mamoru TASAKA) - ruby-dev 経由
                   ` (3 preceding siblings ...)
  2025-11-06 14:44 ` [ruby-dev:52180] " mtasaka (Mamoru TASAKA) - ruby-dev 経由
@ 2025-11-29  4:01 ` nagachika (Tomoyuki Chikanaga) - ruby-dev 経由
  2025-12-08 22:30 ` [ruby-dev:52188] " k0kubun (Takashi Kokubun) - ruby-dev 経由
  5 siblings, 0 replies; 7+ messages in thread
From: nagachika (Tomoyuki Chikanaga) - ruby-dev 経由 @ 2025-11-29  4:01 UTC (permalink / raw)
  To: ruby-dev; +Cc: nagachika (Tomoyuki Chikanaga)

Issue #21666 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED to 3.2: REQUIRED, 3.3: DONE, 3.4: REQUIRED

ruby_3_3 commit:c4b88915540eb4603cbd8a3f72733ece85ad1799 merged revision(s) commit:c5bd4acd30320a8e180ce9fcb24acdab4e10c73a.

----------------------------------------
Bug #21666: Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
https://bugs.ruby-lang.org/issues/21666#change-115350

* Author: mtasaka (Mamoru TASAKA)
* Status: Closed
* ruby -v: ruby 3.5.0dev (2025-11-04 master 55257b5038) +PRISM [x86_64-linux]
* Backport: 3.2: REQUIRED, 3.3: DONE, 3.4: REQUIRED
----------------------------------------
With Fedora glibc-2.42.9000-8.fc44 the following test:

https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/spec/ruby/core/math/lgamma_spec.rb#L9

fails like
```
1)
Math.lgamma returns [Infinity, 1] when passed -1 FAILED
Expected [Infinity, -1] == [Infinity, 1]
to be truthy but was false
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:10:in 'block (3 levels) in <top (required)>'
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:3:in '<top (required)>'
```

(With the help from glibc developer: https://bugzilla.redhat.com/show_bug.cgi?id=2412227 )

POSIX.1-2024 says (ref: https://pubs.opengroup.org/onlinepubs/9799919799/functions/lgamma.html )

> If \(x\) is a non-positive integer, a pole error shall occur and 
> lgamma(), lgammaf(), and lgammal() shall return +HUGE_VAL, +HUGE_VALF, and +HUGE_VALL, respectively.

but also says:

> The sign of \( \Gamma(x) \) shall be returned in the external integer signgam. 
> If \(x\) is NaN, -Inf, or a negative integer, the value of signgam is **unspecified**.`

So on this line:
https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/math.c#L1103
when `d` is -1 (or negative integer), the value of `sign` is unspeficied.



-- 
https://bugs.ruby-lang.org/
_______________________________________________
ruby-dev メーリングリスト -- ruby-dev@ml.ruby-lang.org
配信停止は ruby-dev-leave@ml.ruby-lang.org にメールをお送りください。

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-dev:52188] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
  2025-11-04 14:20 [ruby-dev:52176] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44 mtasaka (Mamoru TASAKA) - ruby-dev 経由
                   ` (4 preceding siblings ...)
  2025-11-29  4:01 ` [ruby-dev:52186] " nagachika (Tomoyuki Chikanaga) - ruby-dev 経由
@ 2025-12-08 22:30 ` k0kubun (Takashi Kokubun) - ruby-dev 経由
  5 siblings, 0 replies; 7+ messages in thread
From: k0kubun (Takashi Kokubun) - ruby-dev 経由 @ 2025-12-08 22:30 UTC (permalink / raw)
  To: ruby-dev; +Cc: k0kubun (Takashi Kokubun)

Issue #21666 has been updated by k0kubun (Takashi Kokubun).

Backport changed from 3.2: REQUIRED, 3.3: DONE, 3.4: REQUIRED to 3.2: REQUIRED, 3.3: DONE, 3.4: DONE

ruby_3_4 commit:1adfd3ec401e7a09e1e3e61708592b202a3f8277 merged revision(s) commit:c5bd4acd30320a8e180ce9fcb24acdab4e10c73a.

----------------------------------------
Bug #21666: Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44
https://bugs.ruby-lang.org/issues/21666#change-115498

* Author: mtasaka (Mamoru TASAKA)
* Status: Closed
* ruby -v: ruby 3.5.0dev (2025-11-04 master 55257b5038) +PRISM [x86_64-linux]
* Backport: 3.2: REQUIRED, 3.3: DONE, 3.4: DONE
----------------------------------------
With Fedora glibc-2.42.9000-8.fc44 the following test:

https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/spec/ruby/core/math/lgamma_spec.rb#L9

fails like
```
1)
Math.lgamma returns [Infinity, 1] when passed -1 FAILED
Expected [Infinity, -1] == [Infinity, 1]
to be truthy but was false
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:10:in 'block (3 levels) in <top (required)>'
/builddir/build/BUILD/ruby-3.5.0_20251103.2332git4001e81a8e-build/ruby-3.5.0-4001e81a8e/spec/ruby/core/math/lgamma_spec.rb:3:in '<top (required)>'
```

(With the help from glibc developer: https://bugzilla.redhat.com/show_bug.cgi?id=2412227 )

POSIX.1-2024 says (ref: https://pubs.opengroup.org/onlinepubs/9799919799/functions/lgamma.html )

> If \(x\) is a non-positive integer, a pole error shall occur and 
> lgamma(), lgammaf(), and lgammal() shall return +HUGE_VAL, +HUGE_VALF, and +HUGE_VALL, respectively.

but also says:

> The sign of \( \Gamma(x) \) shall be returned in the external integer signgam. 
> If \(x\) is NaN, -Inf, or a negative integer, the value of signgam is **unspecified**.`

So on this line:
https://github.com/ruby/ruby/blob/cdcb490d2bceb4ff8d6fce349047a2b722e6ae87/math.c#L1103
when `d` is -1 (or negative integer), the value of `sign` is unspeficied.



-- 
https://bugs.ruby-lang.org/
_______________________________________________
ruby-dev メーリングリスト -- ruby-dev@ml.ruby-lang.org
配信停止は ruby-dev-leave@ml.ruby-lang.org にメールをお送りください。

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-12-08 22:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-04 14:20 [ruby-dev:52176] [Ruby Bug#21666] Math.lgamma(-1).should == [infinity_value, 1] fails with Fedora glibc-2.42.9000-8.fc44 mtasaka (Mamoru TASAKA) - ruby-dev 経由
2025-11-06 11:25 ` [ruby-dev:52177] " nobu (Nobuyoshi Nakada) - ruby-dev 経由
2025-11-06 13:36 ` [ruby-dev:52178] " mtasaka (Mamoru TASAKA) - ruby-dev 経由
2025-11-06 13:55 ` [ruby-dev:52179] " mtasaka (Mamoru TASAKA) - ruby-dev 経由
2025-11-06 14:44 ` [ruby-dev:52180] " mtasaka (Mamoru TASAKA) - ruby-dev 経由
2025-11-29  4:01 ` [ruby-dev:52186] " nagachika (Tomoyuki Chikanaga) - ruby-dev 経由
2025-12-08 22:30 ` [ruby-dev:52188] " k0kubun (Takashi Kokubun) - ruby-dev 経由

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).