title: How to count decimal places of float?
body: <p>I want to check if a float32 has two decimal places or not. My javascript way to do this would look like:</p>
  
  <pre><code>step  := 0.01
  value := 9.99
  
  if int(value/step) % 1 == 0 {
      printf("has two decimal places!")
  }
  </code></pre>
  
  <p>The above example also works. However it will not work when step is incorrect as go then cannot properly cast from float64 to int.</p>
  
  <p>Example:</p>
  
  <pre><code>step  := 0.1
  value := 9.99
  
  if int(value/step) % 1 == 0 {
      printf("has two decimal places!")
  }
  </code></pre>
  
  <p>Compiler Error: <code>constant 9.99 truncated to integer</code></p>
  
  <p>When we use dynamic values it will just return true for every case.</p>
  
  <p><strong>So what is the appropriate way to count decimal places?</strong></p>