help...

Just starting out? Need help? Post your questions and find answers here.
shu7734
User
User
Posts: 30
Joined: Thu May 15, 2008 5:53 am

help...

Post by shu7734 »

bb.l=(64<<5/2)%65

Debug bb


result is 49

In Visual C++ Or Perl Or Other language

#include "stdafx.h"
#include <stdio.h>


int _tmain(int argc, _TCHAR* argv[])
{
int aa=0;
aa=(64<<5/2)%65;
printf("%d",aa);
return 0;
}

result is 61
Win7X64 Purebasic5.22x86DEMO
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: help...

Post by gnozal »

Code: Select all

bb.l=(64<<5/2)%65 ;-> 49
Debug bb
; same as
bb.l=((64<<5)/2)%65 ;-> 49
Debug bb
; because '<<' has priority over '/'
bb.l=(64<<(5/2))%65 ;-> 61
Debug bb
From PB manual :

Code: Select all

  Priority Level |     Operators
  ---------------+---------------------
       8 (high)  |      ~, -
       7         |    <<, >>, %, !
       6         |       |, &
       5         |       *, /
       4         |       +, -
       3         | >, >=, <, <=, =, <>
       2         |       Not
       1 (low)   |  And, Or, XOr
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
shu7734
User
User
Posts: 30
Joined: Thu May 15, 2008 5:53 am

Re: help...

Post by shu7734 »

thanks ,i tride add the (),and know it,Why are you(purebasic) different from the others

I have been accustomed to so use the << and /



so sorry for my poor english
Win7X64 Purebasic5.22x86DEMO
Post Reply