in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

mis-identification of float data type as double

Last post 06-24-2009 9:49 AM by Chew. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-24-2009 8:33 AM

    • Chew
    • Top 75 Contributor
    • Joined on 06-23-2009
    • Posts 18

    mis-identification of float data type as double

    Hi there

    I have discovered a problem (with a work-around) when using SQLite and Visual Studio (I'm using C#)2005 sp1.

    Replication of problem:

    Create a new dataset in a Mobile Device project and add a table adapter from an SQLite database. The table should have a float field.

    Evidence:

    Check the data type of the float field by selecting the float field in the dataset (XSD) diagram. You will see in Properties that the field has been mis-identified as double.

    This also happens with the Insert SQL: select the TableAdapter of the table with the float field, go to properties and expand the InsertCommand property. Click the ellipsis on the Parameters Collection and examine the properties of the float field(s). They are mis-identified as double.

    Workaround (fairly obvious but for the uninitiated...)

    Change the datatype where it is shown incorrectly to the required type.

    I chose Decimal.

     

    Please let me know if this post needs editing.

    Cheers

    Chew

  • 06-24-2009 9:02 AM In reply to

    Re: mis-identification of float data type as double

    This was to conform with Sql Server, see this link:

    http://msdn.microsoft.com/en-us/library/ms173773.aspx

    According to that, real is considered single-precision, while float can be either single or double-precision based on the specified mantissa value when declaring the size of the float.  The default value when just "float" is declared is 53 bits, which is a double.

    Admittedly I don't currently parse the mantissa bits if specified and just default all floats to "double".

     

  • 06-24-2009 9:49 AM In reply to

    • Chew
    • Top 75 Contributor
    • Joined on 06-23-2009
    • Posts 18

    Re: mis-identification of float data type as double

    Thanks Robert.

    Yes I can see why you made that decision.

Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems