title: floor double by decimal place
body: <p>i want to floor a double by its decimal place with variable decimal length (in iphone sdk).</p>
  
  <p>here some examples to show you what i mean</p>
  
  <pre><code>NSLog(@"%f",[self floorMyNumber:34.52462 toPlace:2); // should return 34.52
  NSLog(@"%f",[self floorMyNumber:34.52662 toPlace:2); // should return 34.52
  
  NSLog(@"%f",[self floorMyNumber:34.52432 toPlace:3); // should return 34.524
  NSLog(@"%f",[self floorMyNumber:34.52462 toPlace:3); // should return 34.524
  
  NSLog(@"%f",[self floorMyNumber:34.12462 toPlace:0); // should return 34.0
  NSLog(@"%f",[self floorMyNumber:34.92462 toPlace:0); // should return 34.0
  </code></pre>
  
  <p>any ideas how to do this?</p>
  
  <h2>solution</h2>
  
  <pre><code>-(double)floorNumberByDecimalPlace:(float)number place:(int)place {
      return (double)((unsigned int)(number * (double)pow(10.0,(double)place))) / (double)pow(10.0,(double)place);
  }
  </code></pre>