Skip to content

Commit

Permalink
Fix fparse
Browse files Browse the repository at this point in the history
  • Loading branch information
singularitti committed Jul 17, 2023
1 parent 5ec4409 commit 4605448
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/fparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ end

fparse(::Type{T}, str::AbstractString) where {T<:Integer} = Base.parse(T, str)
fparse(::Type{Float32}, str::AbstractString) =
Base.parse(Float32, replace(lowercase(str), r"(?<=[^e])(?=[+-])" => "f"))
Base.parse(Float32, replace(lowercase(str), r"(?<=[^E])(?=[+-])"i => "f"))
fparse(::Type{Float64}, str::AbstractString) =
Base.parse(Float64, replace(lowercase(str), r"d"i => "e"))
Base.parse(Float64, replace(lowercase(str), r"D"i => "e"))
function fparse(::Type{Complex{T}}, str::AbstractString) where {T<:AbstractFloat}
if first(str) == '(' && last(str) == ')' && length(split(str, ',')) == 2
re, im = split(str[2:(end - 1)], ','; limit=2)
Expand Down

0 comments on commit 4605448

Please sign in to comment.