Skip to content

Commit

Permalink
primes: error for bad start-stop range
Browse files Browse the repository at this point in the history
* OpenBSD version prints an error if start>stop, which seems better than silently exiting
* Also, remove redundant comments when the POD contains duplicate info
  • Loading branch information
mknos authored Jan 8, 2024
1 parent 7a47926 commit 98d3277
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions bin/primes
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ License: perl
=cut


# primes - generate primes
# Written for the PPT initiative by Jonathan Feinberg.
# The algorithm was substantially modified by Benjamin Tilly.
# See docs for license.
use strict;
#use integer; # faster, but cuts the maxint down
$|++;
Expand All @@ -37,6 +33,7 @@ for ($start, $end) {
s/^\s*\+?(\d{1,10}).*/$1/ || die "$0: $_: illegal numeric format\n";
$_ > 2**32 - 1 && die "$0: $_: Numerical result out of range\n";
}
die "$0: start value must be less than stop value\n" if ($end < $start);
primes ($start, $end);
exit 0;

Expand Down

0 comments on commit 98d3277

Please sign in to comment.