title: Why is casting from float to varchar being rounded in SQL Server?
body: <p>The following SQL,</p>
  <pre><code>declare @a as float, @b as float
  
  select @a=1.353954 , @b=1.353956
  select 
  CAST(@a as VARCHAR(40)) AS a_float_to_varchar ,
  CAST(@b as VARCHAR(40)) AS b_float_to_varchar
  </code></pre>
  <p>results in</p>
  <pre><code>a_float_to_varchar                       b_float_to_varchar
  ---------------------------------------- ----------------------------------------
  1.35395                                  1.35396
  </code></pre>
  <p>based on <em><a href="http://msdn.microsoft.com/en-us/library/ms173773.aspx" rel="nofollow noreferrer">'float' and 'real' (Transact-SQL)</a></em>.</p>
  <p>Float has a precision of 15 digits, so I am not sure why the number is being rounded when converted to varchar.</p>