From: Mahadev Ittina Date: 2009-11-22T05:04:47+09:00 Subject: Finding the closest value from a matrix I have a matrix that looks something like this 85 90 100 125 150 175 8 1.183 1.118 1.006 0.805 0.671 0.575 10 1.847 1.744 1.57 1.256 1.047 0.897 12 2.659 2.511 .. .. ... ... 16 ... ... .. ... ... .. Say, I have a value of 1.1, I want it to automatically choose the closest bigger value i.e. 1.118 and say 8 mm diameter at 90 mm spacing. How can this be implemented? I thought of creating hashes. but it seems too complicated. If anyone is wondering about the formula it goes like this. value = 2 x area of circle / spacing -- Posted via http://www.ruby-forum.com/.