Open matthewleon opened 6 years ago
There are multiple options here, I guess:
simply document the current behavior (I have no idea what happens)
clamp
the integer argument to the maximum range (2..36?)
Follow a similar approach as in https://github.com/purescript/purescript-integers/pull/19 and only allow certain arguments.
for 1, from what I've seen, weird things happen :)
I'd say adopt 2 and offer 3 as an alternative API. The perf hit should be negligible considering the other things that this lib does.
Agreed - thanks!
Actually, the underlying lib does handle weird bases, and documents what happens with them. Probably worth just repeating that documentation.
Example:
toBase
will accept negativeInt
s as parameters. It would be nice for comments to address the behavior in this case.