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

Add a toNumericString method #76

Closed
wants to merge 1 commit into from

Conversation

BackEndTea
Copy link

This method guarantees the output is numeric (or an exception is thrown).

Our code base still has some 'old' code where numeric strings are expected, and calculations are done with them. By having a method which guarantees the output is numeric, we can continue doing math with that.

This method guarantees the output is numeric (or an exception is thrown)
@BenMorel
Copy link
Member

BenMorel commented Oct 8, 2023

Hi, I fail to see the value in this PR:

  • for BigDecimal, you haven't provided an example of a BigDecimal value that would fail the is_numeric() test, and have fallen back to artifically creating an invalid object with reflection to test this
  • for BigRational, it's already quite easy to test if the rational number can be converted to a numeric string: just convert toBigDecimal() an catch a potential exception

@BenMorel
Copy link
Member

Closing due to lack of feedback.

@BenMorel BenMorel closed this Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants