Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Geting the decimal part of a number
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00939304
Message ID:
00939916
Views:
11
>>>>I'm trying to find a function in VFP8 that will return the decimal part of a number. eg 89.55 Should return 55
>>>
>>>
>>>Hi Luc,
>>>
>>>Would this do it for you?
>>>
>>>x=89.55
>>>
>>>? MOD(x,INT(x))
>>>
>>>Ken
>>
>>Another way to do the same :)
>>
>>x=89.55
>>? x%1  && return 0.55
>>
>Kool!

To get only the decimal part without "0.", you have to wrap it in a less kool way :)
? RIGHT(STR(x%1,4,2),2)  && return "55"
? VAL(RIGHT(STR(x%1,4,2),2))  && return 55
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Previous
Reply
Map
View

Click here to load this message in the networking platform