kalker crashes or bugs out for certain `base` values
Closed this issue · 1 comments
screaminglineage commented
When entering large numbers as the base (seems to be 50 and above), kalker crashes if the calculation result gets too big.
>> base 50
>> 99*99
thread 'main' panicked at 'index out of bounds: the len is 36 but the index is 46', kalk/src/radix.rs:36:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
For base 0
, it just crashes with a division by 0 error.
>> base 0
>> 1+1
thread 'main' panicked at 'attempt to calculate the remainder with a divisor of zero', kalk/src/radix.rs:35:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Also when entering base 1
, it seems to go into an infinite loop for any calculation.
It would probably be best to simply not accept these values as valid bases at all.
PaddiM8 commented
It should now give you an error if you provide an invalid base. Thanks!