Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Truncating a numeric value
Message
De
27/10/1999 01:36:24
 
 
À
26/10/1999 22:55:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00282036
Message ID:
00282078
Vues:
31
>Is there any pre-defined function in VFP that allows the truncation of a decimal. For example if I want to get 0.465 from 0.4655? Any form of help is appreciated.
>

The ROUND() function is one approach, but .4655 will round up with the default behavior.

You could create a function as a UDF():
FUNCTION TruncateDecimal
LPARAMETER nNumberToTrunc, nPrecisionToRightOfDecimal
RETURN INT(nNumberToTrunc * (10^nPrecisionToRightOfDecimal)) / (10^nPrecisionToRightOfDecimal)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform