title: Scaling range of values with negative numbers
body: <p>How can I scale a set of values to fit a new range if they include negative numbers?</p>
  
  <p>For example, I have a set of numbers (-10, -9, 1, 4, 10) which have to scaled to a range [0 1], such that -10 maps to 0, and 10 maps to 1.</p>
  
  <p>The regular method for an arbitrary number 'x' would be:
   (x - from_min) * (to_max - to_min) / (from_max - from_min) + to_min</p>
  
  <p>but this does not work for negative numbers. Any help is appreciated. Thanks!!</p>