On Fri, Oct 28, 2016 at 3:53 PM, Jérémy Béjanin
<jeremy.beja...@gmail.com> wrote:
> I've noticed that parsing a string representing a real number yields a real
> number, but parsing a string representing a complex number yields an
> expression that must subsequently be evaluated. Is there a reason for that
> behaviour? I'd like to avoid that behaviour considering I am reading
> user-inputted data.
>
> ```julia
> julia> typeof(parse("1.60254+3im"))
> Expr
>
> julia> typeof(parse("1.60254"))
> Float64
> ```

Do no use `parse(::String)` to parse numbers. It is for parsing
generic julia code. Use `parse(Float64, str)` to parse a floating
point number.

I don't think we have a parsing function for complex number likely
because there isn't a universal standard.

Reply via email to