>Hi.
>is there a numeric truncate function in VFP as in:
>Truncate(2.347,2) returns 2.34
>Truncate(2.341,2) returns 2.34
>Truncate (78.1297,3) returns 78.129
>Similar to round but without the rounding bit
I think not, but you can use the int() function:
? int(2.347 * 100) / 100
If you need this often, create your UDF:
? truncate(2.347, 2)
function truncate(tnNumber, tnDecimals)
return int(tnNumber * 10 ^ tnDecimals) / 10 ^ tnDecimals
See also floor() - same as int() for positive numbers, but behaviour is different in the case of negative numbers.
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)