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

fix parse(ComplexF64, "inf") #31615

Merged
merged 2 commits into from
Apr 12, 2019
Merged

fix parse(ComplexF64, "inf") #31615

merged 2 commits into from
Apr 12, 2019

Conversation

stevengj
Copy link
Member

@stevengj stevengj commented Apr 4, 2019

I noticed that the parsing code in #24713 was getting confused by the i in "inf" when parsing a purely real infinity. This PR fixes that and adds some more tests for floating-point values.

Probably could be backported?

@stevengj stevengj added complex Complex numbers bugfix This change fixes an existing bug labels Apr 4, 2019
@StefanKarpinski StefanKarpinski added backport 1.0 triage This should be discussed on a triage call labels Apr 4, 2019
@StefanKarpinski
Copy link
Member

I've added backport labels and triage to discuss but maybe the latter is unnecessary since this seems like a straightforward bugfix so long as it applies.

@StefanKarpinski StefanKarpinski removed the triage This should be discussed on a triage call label Apr 11, 2019
@JeffBezanson
Copy link
Member

Seems to have relevant failures on windows.

@mbauman
Copy link
Member

mbauman commented Apr 11, 2019

Test failures from the windows buildbots look highly relevant. For example:

Error During Test at C:\cygwin\home\Administrator\buildbot\worker-tabularasa\tester_win64\build\share\julia\test\parse.jl:299
  Test threw exception
  Expression: n === parse(ComplexF64, s)
  ArgumentError: cannot parse " nan" as Float64

@stevengj
Copy link
Member Author

stevengj commented Apr 11, 2019

@mbauman, is that a Windows bug? On my Mac I get:

julia> parse(Float64, " nan")
NaN

We should definitely be consistent across platforms here.

@mbauman
Copy link
Member

mbauman commented Apr 11, 2019

I'm just copy-pasting the error message from the buildbots. I don't know anything more.

@GregPlowman
Copy link
Contributor

On Windows 10 with Julia 1.1.0 I get this:

Julia-1.1.0> parse(Float64, "nan")
NaN

Julia-1.1.0> parse(Float64, "nan ")
NaN

Julia-1.1.0> parse(Float64, " nan")
ERROR: ArgumentError: cannot parse " nan" as Float64
Stacktrace:
 [1] _parse_failure(::Type, ::String, ::Int64, ::Int64) at .\parse.jl:370 (repeats 2 times)
 [2] #tryparse_internal#349 at .\parse.jl:366 [inlined]
 [3] tryparse_internal at .\parse.jl:364 [inlined]
 [4] #parse#350 at .\parse.jl:376 [inlined]
 [5] parse(::Type{Float64}, ::String) at .\parse.jl:376
 [6] top-level scope at none:0

@stevengj
Copy link
Member Author

stevengj commented Apr 12, 2019

Sounds like a bug in on jl_strtod_c in strtod.c, which is called on Windows because it doesn't have strtod_l (though it does have _strtod_l… not sure why we don't call that? edit: @tknopp explained in #5928 (comment) that mingw doesn't/didn't have _strtod_l).

Seems like the bug dates to #5988 in Julia 0.3.

@stevengj
Copy link
Member Author

stevengj commented Apr 12, 2019

added a bugfix for windows strtod

@stevengj
Copy link
Member Author

AppVeyor is now passing. Travis Linux x86 failures (in zillions of tests) look unrelated. win32 buildbot timeout looks unrelated.

Note that this PR does not need to be squashed — it's two commits that fix two bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug complex Complex numbers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants