Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get decimal portion
Message
From
13/05/2007 16:21:08
 
 
To
13/05/2007 11:20:52
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 7 SP1
Miscellaneous
Thread ID:
01225039
Message ID:
01225099
Views:
20
>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform