Sha256: 900e39d7e87624bf3285e9ad608a2172fc6a218c4694a7ac863207c29f0de3d9
Contents?: true
Size: 366 Bytes
Versions: 4
Compression:
Stored size: 366 Bytes
Contents
require 'rubygems' require 'interpolate' points = { 0.000 => 0, 0.427 => 1, 1.200 => 2, 3.420 => 3, 27.50 => 4, 45.20 => 5, 124.4 => 6, } zones = Interpolation.new(points) values = [ -20.2, 0.234, 65.24, 9.234, 398.4, 4000 ] values.each do |value| zone = zones.at(value).floor puts "A value of #{value} falls into zone #{zone}" end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
interpolate-0.2.3 | examples/zones.rb |
interpolate-0.2.1 | examples/zones.rb |
interpolate-0.2.0 | examples/zones.rb |
interpolate-0.2.2 | examples/zones.rb |