.1 - Some symbols/operators/signs aside from configured arithmetic ones crashes the bot.
<BotUser> CALC 10\2 <DB> BotUser: Illegal operation! * DB has quit ("Caught SIG_SEGV! Aborting connection. Uptime: 0 hours, 0 mins") <BotUser> CALC 10:2 <DB> BotUser: Illegal operation! * DB has quit ("Caught SIG_SEGV! Aborting connection. Uptime: 1 hour, 24 mins") <BotUser> CALC 10x2 <DB> BotUser: Illegal operation! * DB has quit ("Caught SIG_SEGV! Aborting connection. Uptime: 1 hour, 24 mins") <BotUser> CALC 10÷2 <DB> BotUser: Illegal operation! * DB has quit ("Caught SIG_SEGV! Aborting connection. Uptime: 0 hours, 15 mins")
.2 - Values other than numeric ones crashes the bot.
<BotUser> CALC a + b <DB> BotUser: Illegal operation! * DB has quit ("Caught SIG_SEGV! Aborting connection. Uptime: 0 hours, 0 mins")
.3 - If value is missing crashes the bot or misbehaves.
<BotUser> CALC 10/ <DB> BotUser: Division by zero error! * DB has quit ("Caught SIG_SEGV! Aborting connection. Uptime: 0 hours, 1 min") <BotUser> CALC 10x <DB> BotUser: Illegal operation! * DB has quit ("Caught SIG_SEGV! Aborting connection. Uptime: 0 hours, 1 min") <BotUser> CALC 10+ <DB> 10.000000 <BotUser> CALC 10* <DB> 0.000000
.4 - Some valid symbols/operators/signs leads users to think they are available but not functioning.
Examples showing operations with 'percentage' and 'multiplication dot'.
<BotUser> CALC 10%2 <DB> 0.000000 <BotUser> CALC 10.2 <DB> 10.200000
.5 - FEATURE ACCOMMODATION: Better accepting spaces between the values and operator (i.e. y + z), not only y+z, because it's common users typing it with spaces - and functioning :)
<BotUser> CALC 10/2 <DB> 5.000000 <BotUser> CALC 10 / 2 <DB> 10.000000 <BotUser> CALC 10+2 <DB> 12.000000 <BotUser> CALC 10 + 2 <DB> 10.000000 <BotUser> etc <DB> BotUser et cetera, and other things, and so on...
Well, I could go on with examples but this command indeed sucks ... resources.
The amount of bugs and misbehaving on this function makes me conclude probably better to build it all from scratch.
If anyone willing in going further, from the 4 arithmetic calculations to at least computing some of the basic math operations and make the whole feature as a module, that would be great.
Well, I do plan on adding Lua scripting, and then just letting Lua deal with doing the maths. [#2] covered that idea.
Related
Bugs: #2
Last edit: onefang 2014-05-07