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

parse underscores #26

Open
gdkrmr opened this issue Oct 28, 2018 · 2 comments
Open

parse underscores #26

gdkrmr opened this issue Oct 28, 2018 · 2 comments

Comments

@gdkrmr
Copy link

gdkrmr commented Oct 28, 2018

Underscores are not parsed correctly:

julia> decimal("10_000")
ERROR: ArgumentError: invalid BigInt: "10_000"
Stacktrace:
 [1] macro expansion at ./gcutils.jl:87 [inlined]
 [2] tryparse_internal(::Type{BigInt}, ::String, ::Int64, ::Int64, ::Int64, ::Bool) at ./gmp.jl:257
 [3] #parse#333(::Nothing, ::Function, ::Type{BigInt}, ::String) at ./parse.jl:225
 [4] parse at ./parse.jl:225 [inlined]
 [5] parameters at /home/gkraemer/.julia/packages/Decimals/GlFbH/src/decimal.jl:22 [inlined]
 [6] parse(::Type{Decimal}, ::String) at /home/gkraemer/.julia/packages/Decimals/GlFbH/src/decimal.jl:6
 [7] decimal(::String) at /home/gkraemer/.julia/packages/Decimals/GlFbH/src/decimal.jl:10
 [8] top-level scope at none:0

julia> big"10_000"
10000
@tinybike
Copy link
Member

@gdkrmr Hm, how are underscores supposed to be processed? I haven't seen underscores used in numbers before.

@gdkrmr
Copy link
Author

gdkrmr commented Nov 11, 2018

You can use underscores in numbers for better readability

julia> i = 1_000
1000

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

No branches or pull requests

2 participants