Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using == vs =
Message
De
06/11/2015 04:41:49
Walter Meester
HoogkarspelPays-Bas
 
 
À
06/11/2015 04:31:10
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01627149
Message ID:
01627157
Vues:
61
>>Is there any gotcha using == as a standard?
>
>The gotchas I know of are kind of obsolete:
>
>- when comparing datetimes, where one is coming from a table and one a variable assigned a datetime(), one of them may contain milliseconds and the other not; used to be a problem in VFP 5 or 6, then datetimes lost the milliseconds. That is the format still supports them, but is not stored. They are now always rounded to whole seconds. Still you may hit a table written with one of these older versions and hit those hidden milliseconds (they were never displayed, but you could subtract two seemingly identical datetimes and get a number between -1 and 1).
>
>- comparing floating numbers is unreliable; it actually works but not as expected. Display value of a number is rounded to set("decimals") or whatever way it is formatted; internally it's an IEEE number with 15.5 significant digits. So 7.99...98 may not be equal to 8.0...001 even though both may display as 8.00.
>
>- in collating sequences other than machine, uppercase equals lowercase in ordinary comparison but not in ==
>SET COLLATE TO "MACHINE"
>?"A"="a", "A"=="a"
>SET COLLATE TO "GENERAL"
>?"A"="a", "A"=="a"
>also some character combinations may be treated as equal when they are not or you may get some weird ordering:
>SET COLLATE TO "czech"
>?"ch">"c"
>
>That's pretty much all the weird cases I can remember.

Thanks Dragan.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform