title: #1265 Data truncated from column 'tfidfglobal'. Whats wrong with my query?
body: <p>Well, I'm working on text clustering and I have a problem with saving my tf-idf and tfidfglobal value to my database. So, I'm using a query to calculate the tf-idf value of a word. The data type of tf-idf and tfidfglobal column is <code>Decimal(65,3)</code>, I thought it was the largest length for the <code>Decimal</code> but still have an issue of truncated data.</p>
  
  <p>I have tried to change the data type from <code>Decimal</code> to <code>Text</code> and it works well, one of a row that has truncated data issue has a tifidf value of 2,606.806.</p>
  
  <p>But when the data type is <code>Decimal</code>, it shows a warning of truncated data and the value of tfidf becomes 2.000. </p>
  
  <p>What I need is not a Text data type but a Decimal data type, because I need to do some arithmetic operations with this value. Here is my query:</p>
  
  <pre><code>INSERT INTO features (id_komentar, kata, tf, tfglobal, IDF, tfidf, tfidfglobal) 
      SELECT tf.id_komentar, tf.kata, tf.tf, tfglobal.tfglobal, format(idf.idf, 3) AS idf, 
             format(tf*idf, 3) AS tfidf, format(tfglobal*idf, 3) AS tfidfglobal 
      FROM 
          ((SELECT id_komentar, kata, COUNT(kata) AS tf FROM words GROUP BY id_komentar, kata) tf 
      INNER JOIN 
          (SELECT kata, COUNT(kata) AS tfglobal FROM words GROUP BY kata) tfglobal 
          ON tf.kata = tfglobal.kata 
      INNER JOIN 
          (SELECT kata, format(Log(n/df), 3) AS idf FROM 
          (SELECT kata, COUNT(id_komentar) AS df FROM (SELECT DISTINCT kata, id_komentar FROM words) df 
          GROUP BY kata) df, 
          (SELECT COUNT(id) AS n FROM comments) n
          ) idf ON tfglobal.kata = idf.kata
      ) 
      INNER JOIN 
      (SELECT kata, COUNT(id_komentar) as df FROM 
          (SELECT DISTINCT kata, id_komentar FROM words) df GROUP BY kata) df 
      ON idf.kata = df.kata  
      ORDER BY `tf`.`id_komentar` ASC 
  
  </code></pre>
  
  <p>What's wrong with it? I thought the value 2,606.806 isn't bigger than <code>Decimal(65,3)</code> but I still have a truncated data issue.</p>