Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Minus Zero
Message
De
04/02/2005 10:37:59
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00983821
Message ID:
00983859
Vues:
13
This message has been marked as a message which has helped to the initial question of the thread.
Probably the difference between the numbers is very small, for example, one millionth or less. You will sometimes get this type of rounding errors, because numbers stored as real numbers are never 100% exact.

Instead of checking whether A = B, check whether abs(A-B) < 1e-6 (one millionth), for example.

>Hi.
>I have a procedure which parses text files.
>Many times i have to n_Var=Val(Substr(c_Line,x,y))
>At the end of parsing i get two numbers which has to match in order for the file to be acnowledged. Recently while processing a file the programm gave warning that the numbers did not match. Upon further investigation it turned out that the numbers looked the same when ?n_Var, but ?n_Var1-n_Var2 showed -0.
>The only difference between that file and thousands of other files was that the numbers were large in the order of trillions. Still trillions is within FoxPro's range.
>The question is why -0, and how to avoid it.
>
>Thank you.
>Kamil
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform