Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Faster (0 - num) or (num * -1)
Message
From
20/11/2003 13:29:11
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00851967
Message ID:
00851982
Views:
13
even your own test confirms on my computer my reslt
0 - number is faster

0.841 for the first
0.792 for the seconds test


>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
>
>
Previous
Reply
Map
View

Click here to load this message in the networking platform