mIRC Homepage
Posted By: OrFeAsGr $calc bugs? - 07/03/16 12:06 PM
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
Posted By: Khaled Re: $calc bugs? - 07/03/16 02:17 PM
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.
Posted By: OrFeAsGr Re: $calc bugs? - 08/03/16 01:28 PM
I see smile We don't want slow mIRC! Good choice smile
© mIRC Discussion Forums