title: SQL floats aren't the same as C# Doubles, how can I deal with values of Infinity?
body: <p>Clearly it's not quite true that <a href="https://stackoverflow.com/a/122536/529618">SQL floats are the same as C# Doubles</a>, as they can't hold values of Infinity.</p>
  
  <p>I have a very straightforward mathematical model that deals with probabilities and return periods. </p>
  
  <p>When </p>
  
  <p><code>Double Probability = 0d</code>, </p>
  
  <p>then by definition:</p>
  
  <p><code>Double ReturnPeriod = Double.PositiveInfinity</code></p>
  
  <p>When these properties are mapped to float parameters for an Insert command, I get an error at the DataService level as I try to execute the procedure:</p>
  
  <blockquote>
    <p>The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 134 ("@RETURNPERIOD"): The supplied value is not a valid instance of data type float. Check the source data for invalid values. An example of an invalid value is data of numeric type with scale greater than precision.</p>
  </blockquote>
  
  <p>How can I resolve this? I don't want to resort to anything absurd like changing the schema to store a string representation of the ReturnPeriods, or to add a secondary column for every single float to store whether it's +Inf, -Inf, or NaN.</p>
  
  <p>Old 2006 posts like <a href="http://connect.microsoft.com/SQLServer/feedback/details/239674/storing-ieee-754-floats-in-sql-server-2005-nan-infinity" rel="nofollow noreferrer">this one</a> aren't really helping me out.</p>