title: Counting the number of decimal places in pascal
body: <p>I just started studying pascal and I have to do a pascal program as homework.
  I made it but I don't know <strong>how to count the number of decimal places in a real number</strong> (the number of digit after the ".").</p>
  
  <p>I need it just to format well a real number (like <code>write(real:0:dec)</code> where <code>dec</code> is the number of decimal digit i don't know how to know). I'd like to do that because i don't want it in scientific notation or with many unnecessary zeros.</p>
  
  <p>For example if a real number is 1.51 (x) and I write writeln(x:0:4); or WriteLn(Format('%*.*f', [0, 4, x])); it will show 1.5100 but I want it to be just 1.51; and if the number is like 1.513436, it will show only 1.5134 . So I would make it like writeln(x:0:dec); with something that makes dec the number of decimal digits of x.</p>