lib/pg_histogram/histogram.rb
# rounds to the nearest bucket_size increment
# can optionally pass :up or :down to always round in one direction
rounds to the nearest bucket_size increment
can optionally pass :up or :down to always round in one direction
rounds to the nearest bucket_size increment can optionally pass : up or : down to always round in one direction
def round_to_increment(num, direction = nil)
      return 0 if num.nil?
      round_method = ROUND_METHODS_BY_DIRECTION[direction]
      denominator = 1 / bucket_size
      (num * denominator).send(round_method) / denominator.to_f
    end
def round_to_increment ( num , direction = nil ) return 0 if num . nil? round_method = ROUND_METHODS_BY_DIRECTION [ direction ] denominator = 1 / bucket_size ( num * denominator ) . send ( round_method ) / denominator . to_f end
rounds to the nearest bucket_size increment
can optionally pass :up or :down to always round in one direction
rounds to the nearest bucket_size increment can optionally pass : up or : down to always round in one direction
num
<not_specific>
direction
<not_specific>