Page 1 of 1 1
Topic Options
#23564 - 2002-06-20 10:05 AM Problem with operator not (unexpected evaluation of expression)
Manfred Ernst Offline
Fresh Scripter

Registered: 2001-11-27
Posts: 10
Hello together,

I found a problem with the operator not:

? 1 and 0 --> 0
? not 0 and not 1 --> 1 !!!!!!!!!
? (not 0) and (not 1) --> 0

Shouldn't the second and third example give the same result? The precedence of the operator "not" is higher than "and".

Is this a bug or am I wrong?

Bye
Manfred Ernst

(MCA: complete subject)

[ 20 June 2002, 10:55: Message edited by: MCA ]

Top
#23565 - 2002-06-20 10:10 AM Re: Problem with operator not (unexpected evaluation of expression)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it seems that it's in kixtart the and which is higher...

{edit}
asked from higher powers (ruud) explanation.
waiting for answer.
{/edit}

[ 20 June 2002, 11:54: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#23566 - 2002-06-20 10:54 AM Re: Problem with operator not (unexpected evaluation of expression)
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Lonkero, you are right it has to deal with the precendence and order of evaluation of operators

Following tabel is an extraction for C language. Language which Ruud is using for KiXtart.

code:
() [] 
not
* /
+ -
shift_left shift_right (bitwise operations)
< <= > =>
= <>
bitwise_and (bitwise operations)
bitwise_exclusive_or (XOR) (bitwise operations)
bitwise_inclusive_or (NOR) (bitwise operations)
and
or

They are evaluating from left to right.
To be sure you doesn't have problems with evaluations use at the right place
parenthesis.
Your examples with parenthesis looks like:
- ((1) and (0)) -> 0
- (not (0 and not (1))) -> 1
- (not 0) and (not 1) -> 0
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#23567 - 2002-06-20 11:05 AM Re: Problem with operator not (unexpected evaluation of expression)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what 'boot (I learned some canadian language <- that means about) this then:
$= 1 and not 1
? $
$=not 0 and not 1
? $

returns:
0
1

why is this?

{edit got it}

it starts the counting from right!
with $=not 0 and not 1
it counts:
not 1 -> 0
0 and 0 -> 0
not 0 -> 1

it brakes them one by one, rather than with precedence.

cheers,

[ 20 June 2002, 11:08: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#23568 - 2002-06-20 11:18 AM Re: Problem with operator not (unexpected evaluation of expression)
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Lonkero,
Are you sure? Just tried it:
code:
$x=1 and not 1
$x ?
$x=not 0 and not 1
$x ?

And I got:
quote:
0
0

Which is what I'd expect.

Top
#23569 - 2002-06-20 11:23 AM Re: Problem with operator not (unexpected evaluation of expression)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yes ridge...
tested with 4.02 and 4.10 build 95
_________________________
!

download KiXnet

Top
#23570 - 2002-06-20 11:47 AM Re: Problem with operator not (unexpected evaluation of expression)
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Lonkero,
It's a bug.

code:
$x=not 0 and not 1
? $x

Returns "0" under KiXtart 4.00, but "1" under KiXtart 4.10 RC3.

It looks like the precedence has changed, and "and" now has a higher precedence than "not".

Top
#23571 - 2002-06-20 11:52 AM Re: Problem with operator not (unexpected evaluation of expression)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
how you have rc3?

I got only 2!
_________________________
!

download KiXnet

Top
#23572 - 2002-06-20 11:54 AM Re: Problem with operator not (unexpected evaluation of expression)
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear Manfred,

Which version was you using? You see it becomes an interesting issue.
greetings
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#23573 - 2002-06-20 11:56 AM Re: Problem with operator not (unexpected evaluation of expression)
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
So it still not a final release.
We think Howard has discover an individual problem.
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#23574 - 2002-06-20 11:59 AM Re: Problem with operator not (unexpected evaluation of expression)
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Oops! Quite right - 4.10 RC2.
Top
#23575 - 2002-06-21 12:05 AM Re: Problem with operator not (unexpected evaluation of expression)
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Already reported as bug

http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=3;t=000322

by Richard,
greetings.

[ 20 June 2002, 12:18: Message edited by: MCA ]
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#23576 - 2002-06-20 01:39 PM Re: Problem with operator not (unexpected evaluation of expression)
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Problem will be fixed in next release. See reported BUG topic.
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#23577 - 2002-06-20 01:41 PM Re: Problem with operator not (unexpected evaluation of expression)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
manfred, this bug will be corrected in release 4.10 (for ensurance, look at that bug post in beta forum) and before that like richard fearless told, if you really need this, it's working in 4.0.
also, placing the brackets will do the job until we get that update.

cheers,
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 476 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.066 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org