title: No instance for (Floating Int)
body: <p>I am learning Haskell. I have created function which returns multiplication table up to 'n' in base 'b'. Numbers are padded to 'w' digits. As the last step, I want to compute 'w' automatically. Why does this not compile?</p>
  
  <pre><code>-- Number of digits needed for the multiplication table n*n in base 'base'
  nOfDg :: Int -&gt; Int-&gt; Int 
  nOfDg n base = 1 + floor ( logBase base (n*n)) 
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>No instance for (Floating Int)
       arising from a use of `logBase' at C:\haskel\dgnum.hs:4:24-38
     Possible fix: add an instance declaration for (Floating Int)
     In the first argument of `floor', namely `(logBase b (n * n))'
     In the second argument of `(+)', namely `floor (logBase b (n * n))'
     In the expression: 1 + floor (logBase b (n * n))
  </code></pre>