Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 1st Apr 2010 16:42
Hi guys

Where's the not operation? In DBC you could use ! (ex. if a!b then bla), but DBP doesn't recognize it anymore. I don't want to use <> because that's 7 times slower than !.

Thanks, TheComet

Jaeg
20
Years of Service
User Offline
Joined: 16th Mar 2006
Location: Indiana
Posted: 1st Apr 2010 16:45
Did you try '!=' ? I know it works in C++ can't remember if it does in DBP There is also !(A=B) in some languages

If you get mad and want to type something nasty about another person do this-Type what you want to say in the box then press ctrl-a and hit delete then type what you should say.
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 1st Apr 2010 17:25
Did you tried for example:


Where there is a will, there is a way.
I often edit my posts, that`s who i am
Dia
21
Years of Service
User Offline
Joined: 16th Jan 2005
Location:
Posted: 1st Apr 2010 18:21
F1=Help Main menu -> Principles -> operators -> Boolean Operators

AND, OR, XOR and NOT

The built in help is your friend

This is not the Sig you are looking for....
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 1st Apr 2010 18:32 Edited at: 1st Apr 2010 18:35


I was intruigued by this so I thought I'd investigate.

I knocked this up in a hurry, and run it a few times; but it appears to show that using <> is around 50% faster than using Not

>edit<
Huge error in code making silly results, my kids distracting me with endless calls for passwords, punctures fixing, drinks making etc. sorry.

Fixed now, results not as severe as first thought, but it is still faster to use <> over not

empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 1st Apr 2010 18:57
it should read "if not (a=555)" because of the operator precedence

and while we squeeze milliseconds
Latch
20
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 8th Apr 2010 23:38
NOT is boolean? Is there a binary NOT?

8 bit as an example:

a = 5 = 00000101
NOT a = 11111010

Maybe this NOT is binary. In the context of the code above, the test doesn't really make sense in terms of speed if the case is that NOT is switching to the opposite bits. This of course would have more overhead than testing for inequality.

Try printing
a=555
print bin$(a)
print bin$(NOT a)

and see what you get or try printing

print bin$(a=555)
print bin$(NOT (a=555))

In the first case of the second set, if a does not equal 555 then, the binary value will be 32 zeros

In the second case, if the binary value is not 1 , which would be a test for inequality, but instead is -1 (all bits on) then NOT is a binary operator and the tests by PROF and empty aren't fair comparisons for the speed of NOT against <> .

Enjoy your day.

Login to post a reply

Server time is: 2026-07-26 15:31:21
Your offset time is: 2026-07-26 15:31:21