Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

parse underscores #26

Closed
gdkrmr opened this issue Oct 28, 2018 · 2 comments · Fixed by #74
Closed

parse underscores #26

gdkrmr opened this issue Oct 28, 2018 · 2 comments · Fixed by #74

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

barucden added a commit to barucden/Decimals.jl that referenced this issue Oct 17, 2024
Fixes JuliaMath#26:
```julia
julia> dec"10_000.000_000_1"
10000.0000001
```
barucden added a commit to barucden/Decimals.jl that referenced this issue Oct 17, 2024
Fixes JuliaMath#26:
```julia
julia> dec"10_000.000_000_1"
10000.0000001
```
@barucden barucden mentioned this issue Oct 17, 2024
barucden added a commit to barucden/Decimals.jl that referenced this issue Oct 17, 2024
Fixes JuliaMath#26:
```julia
julia> dec"10_000.000_000_1"
10000.0000001
```
barucden added a commit to barucden/Decimals.jl that referenced this issue Oct 21, 2024
Fixes JuliaMath#26:
```julia
julia> dec"10_000.000_000_1"
10000.0000001
```
barucden added a commit to barucden/Decimals.jl that referenced this issue Oct 25, 2024
Fixes JuliaMath#26:
```julia
julia> dec"10_000.000_000_1"
10000.0000001
```
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants