Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A little confused with RAND()
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01392453
Message ID:
01392454
Vues:
70
>Hi,
>
>Here is an example and the results with question inline:
>
>
>SET DECIMALS TO 6
>ldBaseDate = {^1900-01-01}
>ldCurrDate = DATE()
>RAND(ldCurrDate - ldBaseDate)
>nTest = RAND()
>
>? nTest    &&    This shows 0.031874
>
>nTest = INT(nTest * 1000000)
>? nTest    &&    This however shows 31873
>
>
>Why the number 0.031874 turns into 31873 when multiplied by 1000000?
>
>UPDATE: As soon as I posted, I think I get it. The number 0.031874 is actually something like 0.0318738 and is only showing 6 decimal numbers. But the INT() truncates it. Right?

Yes, INT() truncates all digits after decimal point
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform