$calc(N/0) should return an error message, not 0
mIRC 6.15 (and all others AFAIK)
$calc(a + b) also gives 0
would indeed be nice if it gives an error
I don't think so. To be consistent, identifiers should only halt the script with an error if there's wrong syntax. In all other cases, it depends on what the identifier does and what's the kind of parameters entered. $calc(1/0) deals with numbers, so I can't see a problem with it returning 0 in this case.
What I don't like are identifiers like $calc(), $int() and $abs() that return 0 when not only numbers are entered. In this case, I think they should return $null, since there should be no place for anything other than numbers (and operators, in $calc()'s case). For example, $calc(a/0) should return $null, in my opinion.
I agree. It might be nice to get a warning rather than an error (i.e. the script isn't halted, it just (optionally?) prints something to the status). I can't remember if there is anything else like this in mIRC already.
The onus should be on the scripter to make sure his/her script does not cause an error - they should make the effort to avoid such conditions as division by zero. If it were reported as an error it might help in debugging.
see it from thy other site
if you run you Microsoft calculator
you can not add any text the are only Numbers from 0 to 9
0 is the error msg (a + b is 0) (1 + 2 is 3) , =)
Personally I think division by 0 or any operation on invalid input should simply return $false. That way those who don't want to treat it differently from 0 can use if ($calc(whatever)) without any change and those that want to check can use if ($calc(whatever) != $false). However it should still behave the same with things like $calc(123abc) returning '123' since it's great to use as a $parseNum().
0 is the error msg (a + b is 0) (1 + 2 is 3) , =)
in that case, think of a and b as variables
mathematically, until a variable is assigned a value, it has a value of zero.