Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bugs with literal double-precision floating-point number
Message
 
 
À
24/11/2003 15:28:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00852922
Message ID:
00853155
Vues:
20
Fabio,

><snip>

I'm curious as to why you always snip out the parts of my replies that ask questions and/or point out the errors in your "bug" reports?

From two posts back, where did you get this value from: ±2.22507385850720125967091E-308?

>http://babbage.cs.qc.edu/courses/cs341/IEEE-754references.html

Please run this code in your instance of SQL
create table #fabio1 ( dp1 float )

insert into #fabio1 values ( 2.2250738585072014E-308 )
insert into #fabio1 values ( 2.2250738585072015E-308 ) -- invalid value
insert into #fabio1 values ( 2.22507385850720141E-308 ) -- invalid value
insert into #fabio1 values ( 2.22507385850720125967091E-308 ) -- invalid value

insert into #fabio1 values ( -2.2250738585072014E-308 )
insert into #fabio1 values ( -2.2250738585072015E-308 ) -- invalid value
insert into #fabio1 values ( -2.22507385850720141E-308 ) -- invalid value
insert into #fabio1 values ( -2.22507385850720125967091E-308 ) -- invalid value

insert into #fabio1 values ( 1.7976931348623157E+308 )
insert into #fabio1 values ( 1.7976931348623158E+308 ) -- invalid value
insert into #fabio1 values ( 1.79769313486231571E+308 ) -- invalid value
insert into #fabio1 values ( 1.79769313486231571123456E+308 ) -- invalid value

insert into #fabio1 values ( -1.7976931348623157E+308 )
insert into #fabio1 values ( -1.7976931348623158E+308 ) -- invalid value
insert into #fabio1 values ( -1.79769313486231571E+308 ) -- invalid value
insert into #fabio1 values ( -1.79769313486231571123456E+308 ) -- invalid value

select * from #fabio1
and tell us if you consider there to be 9 bugs or no bugs or some other number of bugs.

Did you happen to notice the footnote to the Decimal Range column that says: Your least significant digits may differ. ?

>You read the BOL, i use SQL Server.

Am I to read the above comment to say that I don't actually use SQL sever? Well Fabio, this is just another instance where you are wrong. Believe it or not, I actually used the currently running instance of SQL2000 on my machine to run and test the above code.

Let me quote another section of the SQL BOL, which directly addresses a lot of your numerical error threads the bold emphasis is mine:

mk:@MSITStore:C:\Program%20Files\Microsoft%20SQL%20Server\80\Tools\Books\acdata.chm::/ac_8_con_03_6mht.htm

Using float and real Data
The float and real data types are known as approximate data types. The behavior of float and real follows the IEEE 754 specification on approximate numeric data types.

Approximate numeric data types do not store the exact values specified for many numbers; they store an extremely close approximation of the value. For many applications, the tiny difference between the specified value and the stored approximation is not noticeable. At times, though, the difference becomes noticeable. Because of the approximate nature of the float and real data types, do not use these data types when exact numeric behavior is required, such as in financial applications, in operations involving rounding, or in equality checks. Instead, use the integer, decimal, money, or smallmoney data types.

Avoid using float or real columns in WHERE clause search conditions, especially the = and <> operators. It is best to limit float and real columns to > or < comparisons.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform