Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databases1. In c++ (or any other language) I'm copying bit by bit to a double variable dob_var. 2. If I copy dob_var to dob_var2 which is also a double I do not lose information. 3. This implies that the same would be when copying to a data base, but when I write dob_var to an sql server float field (same size as a double variable = 64 bit) it sometimes loses information. e.g. when value=1E-320. It is true that SQL float is valid until 1E-308 but so is a C++ double. Any comments?
Post Follow-up to this message>From microsoft.com: "Double data type A fundamental data type that holds double-precision floating-point numbers. It's stored as a 64-bit number ranging in value from approximately -1.797E308 to -4.940E-324 (negative), from 4.94E-324 to 1.797E308 (positive), and 0." And form SQL Server when trying to commit 4.94E-320: "The supplied value is not a valid instance of data type float"
Post Follow-up to this message(osafren@012.net.il) writes: > "Double data type > A fundamental data type that holds double-precision floating-point > numbers. It's stored as a 64-bit number ranging in value from > approximately -1.797E308 to -4.940E-324 (negative), from 4.94E-324 to > 1.797E308 (positive), and 0." > > And form SQL Server when trying to commit 4.94E-320: > "The supplied value is not a valid instance of data type float" I don't know really where you found that documentation. Books Online for SQL Server says: float [ ( n ) ] Is a floating point number data with the following valid values: -1.79E + 308 through -2.23E - 308, 0 and 2.23E -308 through 1.79E + 308. n is the number of bits used to store the mantissa of the float number in scientific notation and thus dictates the precision and storage size. n must be a value from 1 through 53. The default value of n is 53. -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pr...oads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodin...ions/books.mspx
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread