|
Home > Archive > Microsoft SQL Server forum > February 2006 > SQL Server float data type
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
SQL Server float data type
|
|
| safren 2006-02-15, 11:23 am |
| 1. 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?
| |
| osafren@012.net.il 2006-02-16, 3:24 am |
| >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"
| |
| Erland Sommarskog 2006-02-17, 7:25 am |
| (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
|
|
|
|
|