mIRC Home    About    Download    Register    News    Help

Print Thread
#256988 07/03/16 12:06 PM
Joined: Feb 2015
Posts: 243
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Hello!!
Last night i was playing around with $calc out of boredom. And i noticed that mIRC returns 0 for some calculations that are not equal to 0 . For example divide a number by 0 (N / 0) doesn't really result to 0 (meaning it is not possible in math),although i don't know if returning something different would be suitable for scripts that might depend on it.
Also when i did 500 ^ 500 mIRC returned 0 again. As well as for other numbers raised in big or bigger numbers.
mIRC :3
-OrFeAsGr

Last edited by OrFeAsGr; 07/03/16 12:12 PM.
OrFeAsGr #256989 07/03/16 02:17 PM
Joined: Dec 2002
Posts: 5,421
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,421
Thanks for your bug reports. These behaviours are by design. When you try to make $calc() perform operations that result in an error, such as divide by zero or an overflow, it returns zero and allows the script to continue running.

When it comes to large calculations, most programming languages are limited in the size of the values that they can calculate, depending on the data types they are using for the calculation. mIRC supports a double value for floating point calculations. In order to support arbitrary precision floating point calculations, mIRC would need to use an external library. Such a library would be far slower than normal calculations and would only be usable in specific situations, such as within $calc(), and nowhere else in mIRC.

Khaled #257020 08/03/16 01:28 PM
Joined: Feb 2015
Posts: 243
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
I see smile We don't want slow mIRC! Good choice smile


Link Copied to Clipboard