SciRuby / statsample

A suite for basic and advanced statistics on Ruby.
https://github.com/sciruby/statsample
BSD 3-Clause "New" or "Revised" License
95 stars 29 forks source link

Array:mean method bug #44

Closed IsmailM closed 8 years ago

IsmailM commented 8 years ago

Firstly the following seems to be a bug

require 'statsample'
[1, 2].mean => 1

This should be 1.5...

See https://github.com/SciRuby/statsample/blob/master/lib/statsample.rb#L62

i.e. That section should be

def mean
  self.sum.to_f / size
end
agarie commented 8 years ago

Thanks for reporting, @IsmailM. Can you open a pull request with that fix?