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

What should be the string format for rational numbers? #1

Open
peteroupc opened this issue Jan 18, 2016 · 2 comments
Open

What should be the string format for rational numbers? #1

peteroupc opened this issue Jan 18, 2016 · 2 comments

Comments

@peteroupc
Copy link
Owner

This library includes an ERational class for arbitrary-precision rational numbers, but doesn't include a way to create an ERational from a string like the other classes EInteger, EDecimal, and EFloat. This is because I'm not sure what format to accept for strings representing rational numbers. Here is a possible idea:

["("] [-] Number "/" [-] Number [")"]

Note that parentheses appear here because Ruby, at least, writes rational number strings this way. How do other languages and popular libraries parse rational number strings? Would it be good to use a string format that combines all of those formats?

@peteroupc
Copy link
Owner Author

peteroupc commented Jul 30, 2018

Repeating this issue.

This library includes an ERational class for arbitrary-precision rational numbers, but [as of Jan. 18, 2016] doesn't include a way to create an ERational from a string like the other classes EInteger, EDecimal, and EFloat. This is because I'm not sure what format to accept for strings representing rational numbers. Here is a possible idea:

["("] [-] Number "/" [-] Number [")"]

Note that parentheses appear here because Ruby, at least, writes rational number strings this way. How do other languages and popular libraries parse rational number strings? Would it be good to use a string format that combines all of those formats?

@Happypig375
Copy link
Contributor

["("] [-] Number "/" [-] Number [")"]

This would be good but also spaces should be allowed between these 7 components. The built-in types allow spaces before and after the number, whereas the current ERational.FromString does not. This should be changed.

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

No branches or pull requests

2 participants