title: Laravel float variable changing value when adding to database
body: <p><strong>Theory</strong></p>
  
  <p>I have quite a comprehensive coordinates list (Latitude and Longitude to 7 decimal places), which I want to continually add to. In order to stop data duplication, for each coordinate that's trying to be be inputted, I want to check the database to see if the latitude and longitude exist, on the same row.</p>
  
  <p><strong>Check to see if coordinates exist</strong></p>
  
  <pre><code> $coordinate = DB::table('coordinates')
              -&gt;where('lat', '=', $geocode-&gt;getLatitude())
              -&gt;where('lng', '=', $geocode-&gt;getLongitude())
              -&gt;count();
  </code></pre>
  
  <p><strong>Migration</strong></p>
  
  <pre><code>Schema::create('coordinates', function(Blueprint $table)
          {
              $table-&gt;increments('id');
              $table-&gt;float('lat', 10, 7);
              $table-&gt;float('lng', 10, 7);
              $table-&gt;timestamps();
          });
  </code></pre>
  
  <p>When the user's address is converted, I have noticed that when <code>dd()</code> the latitude variable, it comes out as:</p>
  
  <p><code>float(53.7960957)</code> from the code <code>dd($geocode-&gt;getLatitude());</code></p>
  
  <p>When I try to add it afterwards to the database, by removing the <code>dd()</code>, the actual decimal that's added into the database is <code>53.7960968</code> - A completely different location when we're talking about coordinates! </p>
  
  <p>Why is the decimal changing from echoing on my screen, to adding to the database?</p>
  
  <p>Do I need to convert it to a float before adding? How can I resolve this?</p>