Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Truncating a numeric value
Message
From
27/10/1999 01:36:24
 
 
To
26/10/1999 22:55:24
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00282036
Message ID:
00282078
Views:
32
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform