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

correctly parse integer types in readdlm. fixes #9289 #10560

Merged
merged 1 commit into from
Mar 20, 2015

Conversation

tanmaykm
Copy link
Member

Continued from #9316

  • Separate colval method for Integers.
  • Used tryparse_internal methods instead of float64_isvalid.
  • Modified tryparse_internal to be able to parse a section of a string (avoids unnecessary SubString creation).
  • If return array is of Any type, try parsing as the most common types (Int, Bool and Float64) before falling back to SubString. The previous behavior was to try Float64 only.

There is no significant impact on performance with this change.

@@ -87,7 +86,7 @@ function tryparse_internal(::Type{BigInt}, s::AbstractString, base::Int, raise::
z = BigInt()
err = ccall((:__gmpz_set_str, :libgmp),
Int32, (Ptr{BigInt}, Ptr{UInt8}, Int32),
&z, SubString(s,i), base)
&z, bytestring(SubString(s,i,endpos)), base)
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe ccall converts to ByteString automatically.

Used tryparse methods instead of float64_isvalid.
If return array is of Any type, try parsing as Int, Bool and Float64 before falling back to substring.
JeffBezanson added a commit that referenced this pull request Mar 20, 2015
correctly parse integer types in readdlm. fixes #9289
@JeffBezanson JeffBezanson merged commit e1d6e56 into JuliaLang:master Mar 20, 2015
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