mIRC Home    About    Download    Register    News    Help

Print Thread
D
darkman2012
darkman2012
D
hello guys i just have problem with $calc identifier
for what reason this don't work?

Code:
//echo -a substract $calc(900000186448273800000000 - 1)
//echo -a add $calc(900000186448273800000000 + 1)


the $calc identifier don't substract 1 to the 900000186448273800000000 amount or amounts bigges. I have a money system on my bot and when i try to add small amounts to large amounts or small amounts subtract large numbers.


So my question is: this is a bug? i try to do that operation using /inc & /dec commands and not working too. someboy have a fix for that..?

Thanks in advance

Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
mIRC is 32bit and the $calc function is based on that. That means you can only use numbers up to 32bit in size. Anything larger won't work correctly.

Joined: Dec 2002
Posts: 294
D
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 294
Originally Posted By: Riamus2
mIRC is 32bit and the $calc function is based on that. That means you can only use numbers up to 32bit in size. Anything larger won't work correctly.


It appears that mIRC stores numbers as 64-bit (double) floating point numbers.

If that's a correct guess, then integer values will only work reliably up to approximately 15 decimal digits (which is significantly more than a 32-bit integer).

So basically, darkman2012, stick to numbers that are 15 digits or less and you will be fine.

Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
Thanks for the correction. I didn't try to see how large of a number was possible. Either way, it's a limitation and not a bug.

Note that you can get around the limitation by being creative in how you manage large numbers. Things like splitting numbers into 2 smaller parts and then concatenating them once you're done doing your calculations.


Link Copied to Clipboard