Skip to content

Commit

Permalink
Merge branch 'master' of github.com:clbustos/statsample
Browse files Browse the repository at this point in the history
Updating upstream
  • Loading branch information
clbustos committed Dec 13, 2014
2 parents a9f73dd + 0e55992 commit 5fbbcae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/statsample.rb
Expand Up @@ -241,7 +241,7 @@ def self.nice(s,e) # :nodoc:
min = reverse ? e : s
max = reverse ? s : e
span=max-min
return [s, e] if (!span or (span.respond_to? :infinite? and span.infinite?))
return [s, e] if (span == 0 or (span.respond_to? :infinite? and span.infinite?))

step=10**((Math::log(span).quo(Math::log(10))).round - 1).to_f
out=[(min.quo(step)).floor * step, (max.quo(step)).ceil * step]
Expand Down
7 changes: 7 additions & 0 deletions test/test_histogram.rb
Expand Up @@ -100,6 +100,13 @@ class StatsampleHistogramTestCase < MiniTest::Unit::TestCase
assert_equal(2,h.sum(1,4))

end
should "not raise exception when all values equal" do
assert_nothing_raised do
a = [5,5,5,5,5,5].to_scale
h=Statsample::Graph::Histogram.new(a)
h.to_svg
end
end

end
end

0 comments on commit 5fbbcae

Please sign in to comment.