Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to calculate the maximum value of REAL and FLOAT datatype?

0 views
Skip to first unread message

3 Head Mumkey

unread,
Dec 16, 1999, 3:00:00 AM12/16/99
to
The MSSQL 6.5 show that
"real" dataype is 4 bytes and
"float" datatype is 8 bytes,

I don't understand the meaning of maximum precision values,

I get the following text from the MSSQL help file!!

The precision of the float datatype uses less storage space for
different ranges of precision. For example, consider the following
declaration of float (n):

Declare @mf float(n)

These are the ranges of precision values permitted.

Where n = Version 6.0 and earlier Version 6.5
1-7 real, 4 bytes real, 4 bytes
8-15 float, 8 bytes real, 4 bytes
16-23 float, 8 bytes real, 4 bytes
24-53 float, 8 bytes float, 8 bytes


Can anyone tell me that what's the actual range of real dataype and float?
I don't understand why a 4 bytes real datatype can store a value over 32767
???

Thanks alot!!!


BPMargolin

unread,
Dec 16, 1999, 3:00:00 AM12/16/99
to
Integers and reals (floats) are stored completely differently. Reals are
stored with an exponent and mantissa. Many introduction to computer books
will discuss physical storage of integers vs. reals; you might want to pick
one up or search on the Web for a fuller explanation.

SQL Server 7.0 has not changed the definition of the real and float data
types, so the following is from the SQL Server 7.0 Books Online:

float
Floating precision number data from -1.79E + 308 through 1.79E + 308.

real
Floating precision number data from -3.40E + 38 through 3.40E + 38.


3 Head Mumkey <lucky_...@263.com> wrote in message
news:839hr0$ipd$1...@hfc.pacific.net.hk...

0 new messages