Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

SQL Server float data type
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?


Report this thread to moderator Post Follow-up to this message
Old Post
safren
02-15-06 04:23 PM


Re: SQL Server float data type
>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"


Report this thread to moderator Post Follow-up to this message
Old Post
osafren@012.net.il
02-16-06 08:24 AM


Re: SQL Server float data type
(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

Report this thread to moderator Post Follow-up to this message
Old Post
Erland Sommarskog
02-17-06 12:25 PM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 05:28 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006