From: Ayumu Aizawa Date: 2014-05-11T07:40:35+09:00 Subject: [ruby-core:62517] Re: [ruby-trunk - Bug #7395] [Assigned] Negative numbers can't be primes by definition --001a11c3066816c62804f9136798 Content-Type: text/plain; charset=ISO-8859-1 Endo-san Your opinion seems right. IMHO, I think Rdoc should be updated. This method should evaluate the number is prime number or not. It should not refer the number is composite number or not. We may have to confirm Yugui's intention anyway. Luckily I'm going to meet her on Wed, so I will ask her about this issue. Shibata-san I will add information to NEWS, once change was accepted by Yugui. 2014-05-10 9:20 GMT+09:00 : > Issue #7395 has been updated by Yusuke Endoh. > > Status changed from Closed to Assigned > > Read the rdoc carefully: > > > Returns true if +self+ is a prime number, false for a composite. > > By definition, a composite number can be also a positive integer greater > than 1. > > http://mathworld.wolfram.com/CompositeNumber.html > > Thus, > > 1.prime? #=> false > 0.prime? #=> false > (-1).prime? #=> false > > looks all buggy (or undefined behavior) to me. > If we can change the spec, it would be good to raise an exception, return > nil, or at least update the rdoc. > Anyway, the maintainer (Yugui) should treat this, I think. > > -- > Yusuke Endoh > > ---------------------------------------- > Bug #7395: Negative numbers can't be primes by definition > https://bugs.ruby-lang.org/issues/7395#change-46651 > > * Author: Zachary Scott > * Status: Assigned > * Priority: Normal > * Assignee: Yuki Sonoda > * Category: lib > * Target version: current: 2.2.0 > * ruby -v: 2.0.0 > * Backport: > ---------------------------------------- > from github: > https://github.com/ruby/ruby/pull/187 > > By definition, a prime number can be a positive integer greater than 1. > > http://mathworld.wolfram.com/PrimeNumber.html > > ---Files-------------------------------- > prime_refute_negative_numbers.patch (1.16 KB) > > > -- > https://bugs.ruby-lang.org/ > --001a11c3066816c62804f9136798 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Endo-san

Your opinion seems = right.

IMHO, I think Rdoc should be updated.
=
This method should evaluate the number is prime number or not.
It should not refer the number is composite number or not.

We may have to confirm Yugui's intention anyway.
Luc= kily I'm going to meet her on Wed, so I will ask her about this issue.<= /div>

Shibata-san
I will add information to NEWS, o= nce change was accepted by Yugui.

2014-05-10 9:20 GMT+09:00 <mame@tsg.ne.jp>:
Issue #7395 has been updated by Yusuke Endoh= .

Status changed from Closed to Assigned

Read the rdoc carefully:

> Returns true if +self+ is a prime number, false for a composite.

By definition, a composite number can be also a positive integer greater th= an 1.

http://mathworld.wolfram.com/CompositeNumber.html

Thus,

=A0 1.prime? #=3D> false
=A0 0.prime? #=3D> false
=A0 (-1).prime? #=3D> false

looks all buggy (or undefined behavior) to me.
If we can change the spec, it would be good to raise an exception, return n= il, or at least update the rdoc.
Anyway, the maintainer (Yugui) should treat this, I think.

--
Yusuke Endoh <mame@tsg.ne.jp>

----------------------------------------
Bug #7395: Negative numbers can't be primes by definition
https://bugs.ruby-lang.org/issues/7395#change-46651

* Author: Zachary Scott
* Status: Assigned
* Priority: Normal
* Assignee: Yuki Sonoda
* Category: lib
* Target version: current: 2.2.0
* ruby -v: 2.0.0
* Backport:
----------------------------------------
from github:
https:/= /github.com/ruby/ruby/pull/187

By definition, a prime number can be a positive integer greater than 1.

http://mathworld.wolfram.com/PrimeNumber.html

---Files---------------------= -----------
prime_refute_negative_numbers.patch (1.16 KB)


--
https://bugs.ruby= -lang.org/

--001a11c3066816c62804f9136798--