Behavior of float datatype in sql express 2008

  • Hi,

    Float datatype behaves different in sql express 2008.

    Inserted,stored and displayed values from query are different for large values.

    EX:

    Inserted

    12345678902.45

    123456789023.45

    1234567890234.45

    12345678902345.45

    123456789023456.45

    1234567890234567.45

    Stored

    12345678902.45

    123456789023.45

    1234567890234.45

    12345678902345.449

    123456789023456.44

    1234567890234567.5

    Result of query

    12345678902.45

    123456789023.45

    1234567890234.45

    12345678902345.4

    123456789023456

    1.23456789023457E+15

    why is that? I am not able to understand how round up is done.Is there any explanation for this? And what is the exact difference between float and decimal? Which is better for usage?

    Thank you

  • Float is approximate data type. do not store the exact values specified for many numbers; they store an extremely close approximation of the value.

    more details are available at - http://msdn.microsoft.com/en-in/library/ms187912%28v=sql.105%29.aspx

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply