Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -0,0 +1,6 @@
def map_range(a, b, s)
af, al, bf, bl = a.first, a.last, b.first, b.last
bf + (s - af)*(bl - bf).quo(al - af)
end
(0..10).each{|s| puts "%s maps to %g" % [s, map_range(0..10, -1..0, s)]}

View file

@ -0,0 +1,3 @@
(0..10).each do |s|
puts "%s maps to %s" % [s, map_range(0..10, -1..0, s)]
end

View file

@ -1,9 +0,0 @@
def map_range(a, b, s)
af, al, bf, bl = a.first, a.last, b.first, b.last
bf + (s - af).*(bl - bf).quo(al - af)
end
11.times do |s|
s *= 1.0 # force floating point
print s, " maps to ", map_range((0..10), (-1..0), s), "\n"
end