title: How to get the integer and fractional part of a decimal number as two integers in Arduino or C?
body: <p>How do I convert 30.8365146 into two integers, 30 and 8365146, for example, in Arduino or C?</p>
  
  <p>This problem faces me when I try to send <a href="http://en.wikipedia.org/wiki/Global_Positioning_System" rel="nofollow">GPS</a> data via <a href="http://en.wikipedia.org/wiki/XBee" rel="nofollow">XBee</a> series 1 which don't allow to transmit fraction numbers, so I decided to split the data into two parts. How can I do this?</p>
  
  <p>I have tried something like this:</p>
  
  <pre><code>double num=30.233;
  int a,b;
  
  a = floor(num); 
  b = (num-a) * pow(10,3);
  </code></pre>
  
  <p>The output is <code>30</code> and <code>232</code>! The output is not 30 and 233. Why and how can I fix it?</p>