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

Adjust claims about the power of parse(Complex...) #25877

Merged
merged 2 commits into from
Feb 5, 2018

Conversation

traktofon
Copy link
Contributor

The statement

parse(Complex{T}, string) can parse complex numbers in common formats

is a bit exaggerating. Arguably one of the more common complex number output formats is that used by Fortran, which is of the form "(real, imag)". The current implementation of parse fails to parse this:

julia> parse(Complex{Float64}, "(1.0, 2.0)")
ERROR: ArgumentError: cannot parse "(1.0, 2.0)" as Float64

On version 0.7.0-DEV.3712.

The statement
> `parse(Complex{T}, string)` can parse complex numbers in common formats
is a bit exaggerating. Arguably one of the more common complex number output formats is that used by Fortran, which is of the form "(real, imag)". The current implementation of `parse` fails to parse this:
```
julia> parse(Complex{Float64}, "(1.0, 2.0)")
ERROR: ArgumentError: cannot parse "(1.0, 2.0)" as Float64
```
@ararslan ararslan added domain:docs This change adds or pertains to documentation domain:complex Complex numbers labels Feb 4, 2018
@stevengj
Copy link
Member

stevengj commented Feb 4, 2018

The NEWS file doesn't generally list all of the features the standard library doesn't have...

It doesn't say all common formats. I would just change it to say "several common formats" if you insist on qualifying this.

@traktofon
Copy link
Contributor Author

How about "some common formats"? For me that would be a more accurate statement of the current abilities.

@StefanKarpinski
Copy link
Sponsor Member

We could also just implement parse(Complex{Float64}, "(1.0, 2.0)").

@stevengj
Copy link
Member

stevengj commented Feb 5, 2018

@StefanKarpinski, in #22250 it was decided not to allow Fortran format. I didn't think it makes sense to parse Fortran-style complex numbers if we can't even parse Fortran-style real numbers (e.g. 1.0D+00).

@traktofon
Copy link
Contributor Author

Thanks @stevengj for pointing out #22250, I hadn't seen that one. I agree that without support for parsing Fortran doubles, adding support for Fortran complex numbers doesn't make sense. Would it make sense to reference #22250 from the NEWS.md directly? Or is it policy to only reference PRs?

@stevengj
Copy link
Member

stevengj commented Feb 5, 2018

Usually we reference the PR that closes the issue, especially (as it does in this case) when the PR links to the issue that it addresses.

@stevengj stevengj merged commit eb94b8c into JuliaLang:master Feb 5, 2018
@traktofon
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:complex Complex numbers domain:docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants