title: Data truncated for column 'x'
body: <p>I am trying to get the distance between two points, that works fine, but what I am having issues with are these warning messages:</p>
  
  <blockquote>
    <p>Data truncated for column 'x' at row 32<br>
    Data truncated for column 'x' at row 82<br>
    Data truncated for column 'x' at row 89</p>
  </blockquote>
  
  <p>This is the function I have created:</p>
  
  <pre><code>CREATE FUNCTION `GetDistance`(`lat1` numeric(10, 7), `lon1` numeric(10, 7), `lat2` numeric(10, 7), `lon2` numeric(10, 7))
  RETURNS decimal(10,7)
  BEGIN 
        DECLARE x decimal(10, 7);
        DECLARE pi decimal(21, 20);
        SET pi = 3.14159265358979323846;
        SET x  = round(sin(lat1 * pi / 180)
          * sin(lat2 * pi / 180)
          + cos(lat1 * pi / 180)
          * cos(lat2 * pi / 180)
          * cos((lon2 * pi / 180) - (lon1 * pi / 180)), 7);
      SET x = round(atan((sqrt( 1- power( x, 2))) / x), 7);
      RETURN round((1.852 * 60.0 * ((x / pi) * 180)) / 1.609344, 7);
  END
  </code></pre>
  
  <p>Here are the two columns for <code>lat1</code>, <code>lon1</code> and <code>lat2</code>, <code>lon2</code></p>
  
  <pre><code>CREATE TABLE `world_cities` (
      `latitude` DECIMAL(10,7) NULL DEFAULT NULL,
      `longitude` DECIMAL(10,7) NULL DEFAULT NULL,
  )
  </code></pre>
  
  <p>Here are the max/min values:</p>
  
  <pre><code>"max(latitude)"     "min(latitude)"     "max(longitude)"     "min(longitude)"
  "82.4833330"        "-54.9333330"       "180.0000000"        "-179.9833333"
  </code></pre>
  
  <p>So, what is causing this warning message?</p>
  
  <p>Here is the query calling the function:</p>
  
  <pre><code>SELECT city, region, population, latitude, longitude,
  GetDistance(@lat, @lon, latitude, longitude) as dist
  FROM world_cities
  WHERE MBRContains(LineString(Point(@lat + @kmRange / 111.1, @lon + @kmRange / (111.1 / COS(RADIANS(@lat)))), Point(@lat - @kmRange / 111.1, @lon - @kmRange / (111.1 / COS(RADIANS(@lat))))), location)
  and city_id != @city_id
  order By dist;
  </code></pre>