473,387 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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?

Feb 15 '06 #1
2 19506
>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"

Feb 16 '06 #2
(os*****@012.net.il) writes:
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"


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, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Feb 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Christian Christmann | last post by:
Hi, just a general question. Which data type is more precise for large values: float or double? Thank you. Chris
2
by: Goran | last post by:
Hi! I need to convert from a unsigned char array to a float. I don't think i get the right results in the program below. unsigned char array1 = { 0xde, 0xc2, 0x44, 0x23}; //I'm not sure in...
6
by: Dave win | last post by:
Hi all: I'm confused with the expression "(float *())". Book says that this is a cast. But, I have no idea of this expr. why could this expr ignore the variable??? Thanx!!!
13
by: Michele Guidolin | last post by:
Hello to everybody. I'm doing some benchmark about a red black Gauss Seidel algorithm with 2 dimensional grid of different size and type, I have some strange result when I change the computation...
10
by: pavithra.eswaran | last post by:
Hi, I would like to convert a single precision hexadecimal number to floating point. The following program seems to work fine.. But I do not want to use scanf. I already have a 32 bit hexadecimal...
3
by: Neils Christoffersen | last post by:
Hey all, I wrote on Friday asking for some help moving a common subclass field up to the base class (original post and followup included below). This entails storing whole numbers inside float...
2
by: Chucker | last post by:
Hi Community, I think I can store Binary Data in SQL Server but when I try to retrieve it, I always only get one byte. I think I stored my Binary Data in SQL Server in a Colum of Type Image....
9
by: billmiami2 | last post by:
I was playing around with the new SQL 2005 CLR functionality and remembered this discussion that I had with Erland Sommarskog concerning performance of scalar UDFs some time ago (See "Calling...
116
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.