Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get decimal portion
Message
De
13/05/2007 16:21:08
 
 
À
13/05/2007 11:20:52
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 7 SP1
Divers
Thread ID:
01225039
Message ID:
01225099
Vues:
10
>>Reza,
>>
>>Try:
>>? 987.230%1
>>? Mod(987.230,1)
>
>Though for negative numbers it won't return the value one would expect. The % operator will return the distance between the next integer on the left of the number and the number itself... so while the decimals for -8.133 may be 0.133, -8.133%1 will be 0.867.

Ín that case, how about how I would solve it (from the head, without testing):

x = 987.230
y = ( x - int( x ) ) * 100

OTOH, one might also consider: mod( abs( x ), 1 ) * 100

But this is not enough if it's 987.231.
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform