Sha256: 755e18af36b58b6f8cb078fc04aab7c8dd635a3b0f04f85a2e437cb4bbc82b24
Contents?: true
Size: 540 Bytes
Versions: 23
Compression:
Stored size: 540 Bytes
Contents
class Array class << self # # +fill_float(end_value, start_value = 0.0, step = 1.0)+ # # fill a blank newly created array with +Float+ numbers which will range # from +start_value+ to +end_value+ in steps of +step+ # MINIMUM_STEP = 1e-32 def fill_float(end_value, start_value = 0.0, step = 1.0) raise ArgumentError.new("step too small") unless step.abs > MINIMUM_STEP res = new ev = end_value - step start_value.step(ev, step).each { |f| res << f } res end end end
Version data entries
23 entries across 23 versions & 1 rubygems