Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Faster (0 - num) or (num * -1)
Message
From
20/11/2003 13:15:31
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00851967
Message ID:
00851976
Views:
12
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform