Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Geting the decimal part of a number
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00939304
Message ID:
00939916
Vues:
12
>>>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform