-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
parse(Rational{Int},string) #18328
Comments
One might also consider supporting parsing decimals this way. |
Related to this (re: @TotalVerb): @Ismael-VC and I came up with this a while ago, for parsing decimal literals exactly:
|
This is a good start, but I don't think it handles the cases where the denominator overflows but the whole number can still fit in a |
As an example: julia> R"0.0000000000000000005"
-5//8446744073709551616 I suspect it will be easier (if maybe slightly less performant) to parse as |
A macro don't have to be type stable for performance. It is evaluated before type infrerence. |
@ivarne It's not a matter of performance. I suspect most use cases for |
I made some improvements, to account for the fact that the parsed string could be an integer (like "1", with no "/" character), and allowing BigInts.
|
There is something blocking this? Today I was surprised by the lack of a |
Looks like nobody has particularly tried. Care to make a PR? There seems to be several possible drafts above |
Updated version of the code I posted above for Julia 1:
But note the following issues:
Should we parse |
Can do it, probably, I just need to know if splitting over '/' is reasonable, or there some special notation case I should consider. I believe implementing a generic method |
We can use |
(I was surprised that Edit: It's
|
Do you want to take over this @cossio? I offer because you seem better prepared and I am finishing my PhD (so time is short), but if not, I think this is small enough to not cause any problems for me. |
I don't have time for the PR right now, so feel free to do it. |
Seems #44550 implemented this |
Currently
parse(Rational{Int}, string)
is not implemented. I think it could be implemented like this:The text was updated successfully, but these errors were encountered: