mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 42
T
TroyBoy Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Aug 2004
Posts: 42
mIRC 6.16 (dont know about earlier versions) cant calculate this simple multiplication:
$calc(100000000 * 1000 * 0.035) = 3500000000.000001

I tried:
$calc(100000000 * 1000) = 100000000000
$calc(100000000000 * 0.035) = 3500000000.000001
Still cant do it. Seems to be the large number multiplied by a decimal. But still, the result is much smaller, so you wouldnt think it was because of an overflow.

This works though (splitting the calculation so the big number is multiplied by a whole number.
$calc(0.035 * 1000) = 35
$calc(35 * 100000000) = 3500000000

This isnt fixing my problem though, since its in an mIRC script.

I guess I should add that im trying this on a clean install of mirc 6.16 on Win2k.

Last edited by TroyBoy; 22/08/04 02:21 PM.
Joined: Dec 2002
Posts: 252
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 252
solution, bizarre as it seems, multiply the decimal number to make it a whole number, multiply the whole thing out, and divide by that number you multiplied by to make the decimal whole.. I dunno if this is a VC++ error because there is such a thing as floating integers which I encountered the same problem in perl. It looks to be the same type output as what I had gotten in perl. Example.. $calc(100000000000 * (0.035 * 1000) / 1000)


Link Copied to Clipboard