Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why the calculate not exact?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00666025
Message ID:
00666157
Vues:
19
I think this is the normal floating point internal storage problem. That little '...' line just before the 'v20=' line means that the values are changing in other code. If you change your store 0 to be store 5.23, the problem manifests.

Michale, computers don't store exact floating point numbers, so you can run into this very easily. You have to work around it by rounding after adding .005 or some such code.

Alan


>Hi!
>
>>>
>But I use vf5.0 ,Could you give me some advice?
><<
>
>No idea - I tested also in Visual FoxPro 05.00.00.0415 for Windows - no problem:
SET DECI to 2
>local v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20
>store 0 to v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20
>v20=v1+v2+v3+v4+v5+v6+v7+v8+v9+v10+v11+v12+v13+v14+v15+v16+v17+v18+v19
>? STR(v20,30,18)
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform