Skip to content

Commit

Permalink
No need for zero?, 0.0 == 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Oct 15, 2011
1 parent 09430e3 commit d344f04
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/combinatorics/extensions/math.rb
Expand Up @@ -169,7 +169,7 @@ def Math.subfactorial(n)
#
def Math.factorial(x=1)
if x >= 1 then pi(1..x)
elsif x.zero? then 1
elsif x == 0 then 1
else
raise(RangeError,"x must be non-negative")
end
Expand Down
2 changes: 1 addition & 1 deletion spec/choose/cardinality_spec.rb
Expand Up @@ -42,7 +42,7 @@
end

it "should return 0 for subject.cardinality(1, 0)" do
subject.cardinality(1, 0).should be_zero
subject.cardinality(1, 0).should == 0
end

it "should return 1 for subject.cardinality(1, 1)" do
Expand Down
2 changes: 1 addition & 1 deletion spec/extensions/math_spec.rb
Expand Up @@ -74,7 +74,7 @@
end

it "should return 0 for subfactorial(1)" do
subject.subfactorial(1).should be_zero
subject.subfactorial(1).should == 0
end

it "should return 1 for subfactorial(2)" do
Expand Down
2 changes: 1 addition & 1 deletion spec/permute/cardinality_spec.rb
Expand Up @@ -42,7 +42,7 @@
end

it "should return 0 for subject.cardinality(1, 0)" do
subject.cardinality(1, 0).should be_zero
subject.cardinality(1, 0).should == 0
end

it "should return 1 for subject.cardinality(1, 1)" do
Expand Down

0 comments on commit d344f04

Please sign in to comment.