Project

General

Profile

Bug #11606

Prime.prime? should throw error on invalid inputs

Added by chaitanyav (NagaChaitanya Vellanki) about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:71120]

Description

irb(main):003:0> Prime.prime?(1,3)
=> false
irb(main):004:0> Prime.prime?(1.3)
=> false
irb(main):005:0> Prime.prime?(20.3)
=> true

Prime.prime? converts floating point numbers to integer to determine if they are prime. A prime by definition is a integer > 1. Will include a patch for this.

Associated revisions

Revision 48773664
Added by marcandre (Marc-Andre Lafortune) about 4 years ago

  • lib/prime.rb: Add basic argument checking to Prime.prime? [Bug #11606]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 52201
Added by marcandre (Marc-Andre Lafortune) about 4 years ago

  • lib/prime.rb: Add basic argument checking to Prime.prime? [Bug #11606]

Revision 52201
Added by marcandre (Marc-Andre Lafortune) about 4 years ago

  • lib/prime.rb: Add basic argument checking to Prime.prime? [Bug #11606]

Revision 52201
Added by marcandre (Marc-Andre Lafortune) about 4 years ago

  • lib/prime.rb: Add basic argument checking to Prime.prime? [Bug #11606]

Revision 52201
Added by marcandre (Marc-Andre Lafortune) about 4 years ago

  • lib/prime.rb: Add basic argument checking to Prime.prime? [Bug #11606]

Revision 52201
Added by marcandre (Marc-Andre Lafortune) about 4 years ago

  • lib/prime.rb: Add basic argument checking to Prime.prime? [Bug #11606]

History

#1

Updated by marcandre (Marc-Andre Lafortune) about 4 years ago

  • Status changed from Open to Closed

Applied in changeset r52201.


  • lib/prime.rb: Add basic argument checking to Prime.prime? [Bug #11606]

Updated by marcandre (Marc-Andre Lafortune) about 4 years ago

Totally agree. I hope you'll find my fix acceptable.
Thanks for creating the issue

Also available in: Atom PDF