Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SET DECIMALS has no affect in Visual FoxPro executable -
Message
De
04/01/2005 07:42:56
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
04/01/2005 07:20:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00974042
Message ID:
00974044
Vues:
24
>I have a legacy Visual FoxPro 6.0 application where I need to do a simple multiplication where one of the terms have more than 4 significant digits. I have tried the following code, but this has no affect whatsoever:
>
> local nLabor as double
> local nCaseMix as double
> local nLaborComponent as double
>
> set decimals to 8
>
> nLabor = 0.76775
> nCaseMix = 3807.07
>
> nLaborComponent = nLabor * nCaseMix
>
>At the Visual FoxPro command prompt, nLaborComponent will correctly be computed as 3186.25. When compiled to an executable, 3186.59 is the result (what you would get if nLabor were rounded to 0.7678).
>
>Is there a way to address this in native Visual FoxPro? If not I will try to write a simple DLL to handle the basic arithmetic.

How does it result as something over 3100???
I think this is mdot thing. Prefix your variables with m. or choose an empty workspace. Field takes precedence and its rounding.

nLaborComponent = m.nLabor * m.nCaseMix

PS: set decimals have no effect on calculation, only display. Correct result is 2922.8779925.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform