Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document results of calling functions with negative bases #14

Open
matthewleon opened this issue Mar 12, 2018 · 4 comments
Open

document results of calling functions with negative bases #14

matthewleon opened this issue Mar 12, 2018 · 4 comments

Comments

@matthewleon
Copy link
Contributor

Example: toBase will accept negative Ints as parameters. It would be nice for comments to address the behavior in this case.

@sharkdp
Copy link
Collaborator

sharkdp commented Mar 12, 2018

There are multiple options here, I guess:

  1. simply document the current behavior (I have no idea what happens)

  2. clamp the integer argument to the maximum range (2..36?)

  3. Follow a similar approach as in Add conversions to a different base, fixes #17, fixes #18 purescript/purescript-integers#19 and only allow certain arguments.

@matthewleon
Copy link
Contributor Author

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.

@sharkdp
Copy link
Collaborator

sharkdp commented Mar 12, 2018

Agreed - thanks!

@matthewleon
Copy link
Contributor Author

Actually, the underlying lib does handle weird bases, and documents what happens with them. Probably worth just repeating that documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants