mIRC Home    About    Download    Register    News    Help

Print Thread
#145351 22/03/06 03:22 AM
Joined: Mar 2006
Posts: 8
A
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Mar 2006
Posts: 8
Code:
poo {
  var %string
  while ( 1 !isin %string ) {
    var -s %string = %string $+ 1
    inc -s %string
  }
}
 


* Set %string to 22222222222222221
* Inc %string to 22222222222222220

#145352 23/03/06 08:46 PM
Joined: Nov 2004
Posts: 148
D
Vogon poet
Offline
Vogon poet
D
Joined: Nov 2004
Posts: 148
Yes, it looks weird.... Maybe it has to do with limitation on number (Too big to fit into INT or what ever....)

#145353 24/03/06 09:49 PM
Joined: Aug 2005
Posts: 128
S
Vogon poet
Offline
Vogon poet
S
Joined: Aug 2005
Posts: 128
This is not an /inc bug. It is just cos mirc limits numbers. The biggest number mirc can handle is $str(9,17).
1 with 17 zeros after it is already too big (18 characters). Any operation you perform in this number will not work
Code:
//var %number = $str(9,17)
inc %number
echo -a :: %number (reached biggest number, mirc can't handle operations on it)
inc %number
echo -a inc 1: %number
echo -a +1 : $calc(%number + 1)
echo -a -1 : $calc(%number - 1)

Result:
Quote:

:: 100000000000000000 (reached biggest number, mirc can't handle operations on it)
inc 1: 100000000000000000
+1 : 100000000000000000
-1 : 100000000000000000

As you can see, you could increase number $str(9,17) with 1, but not with 2. This is cos 1 followed by 18 zeros is the biggest number that mirc can get/store/whatever.
However, $calc(1000000000000000000000000000000000000000000000*5000) has a length of 49, which differs of length of $calc(1000000000000000000000000000000000000000000000) which is 45, so it still performs some operations on bigger numbers, just that it doesn't perform them as it should.

Edit: I guess i was a bit wrong about $str(9,17) cos i see it can't handle $str(2,17) but it can handle $str(9,17)

Last edited by stefys99; 24/03/06 09:51 PM.

Link Copied to Clipboard