title: Rounding to an arbitrary number of significant digits
body: <p>How can you round <em>any</em> number (not just integers > 0) to N significant digits?</p>
  
  <p>For example, if I want to round to three significant digits, I'm looking for a formula that could take:</p>
  
  <p>1,239,451 and return 1,240,000</p>
  
  <p>12.1257 and return 12.1</p>
  
  <p>.0681 and return .0681</p>
  
  <p>5 and return 5</p>
  
  <p>Naturally the algorithm should not be hard-coded to only handle N of 3, although that would be a start.</p>