If any of the New methods receives a significant figure param outside the acceptable range the library will trigger a panic.
This makes the library unsuitable as-is for use cases that involve user input. From a consumer standpoint, this could be worked around by making a wrapper function that returns an error if the input isn't valid - but I think it would be cleaner to not have the library panic.
However, changing New to return an error will break the Libraries API, would you accept a PR for this?
You are correct that the API is unsuitable for arbitrary input. That is intentional. Just as you’d need to validate input to integer division, you need to validate input to this API.
If any of the
New
methods receives a significant figure param outside the acceptable range the library will trigger a panic.This makes the library unsuitable as-is for use cases that involve user input. From a consumer standpoint, this could be worked around by making a wrapper function that returns an error if the input isn't valid - but I think it would be cleaner to not have the library panic.
However, changing New to return an error will break the Libraries API, would you accept a PR for this?