Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Faster (0 - num) or (num * -1)
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00851967
Message ID:
00851976
Vues:
13
Testing, it seems a little bit faster do it with Num = Num*-1
RAND(-1)
lnSeconds = SECONDS()
FOR I=1 TO 1000000
   Num = RAND()*-1
ENDFOR
WAIT WINDOW TRANSFORM(SECONDS()-lnSeconds)   
*** Getting 1.255 as Averange (Celeron 1G, 128 MB)
RAND(-1)
lnSeconds = SECONDS()
FOR I=1 TO 1000000
   Num = 0-RAND()
ENDFOR
WAIT WINDOW TRANSFORM(SECONDS()-lnSeconds)   
*** Getting 1.40 as Averange (same PC)
HTH
>hi,
>just a quick query as to what is the fastest way to get a negative of a >specified number.
>is it
x = 7
x * (-1)
OR
x = 7
0 - x
Apoya a Visual FoxPro usandolo legalmente
--
¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º
Espartaco Palma Martínez
SysOp PortalFox
http://www.portalfox.com
esparta@portalfox.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform