Skip to content

Commit 2a475d5

Browse files
committed
fix parsed float conversion
1 parent ecf1e6f commit 2a475d5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/conversion.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function Expr_float(x)
116116
if 'f' in x.val
117117
return Base.parse(Float32, replace(x.val, 'f' => 'e'))
118118
end
119-
Base.parse(Float64, x.val)
119+
Base.parse(Float64, replace(x.val, "_" => ""))
120120
end
121121
function Expr_char(x)
122122
val = _unescape_string(x.val[2:prevind(x.val, sizeof(x.val))])

test/parser.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,4 +735,8 @@ end
735735
@test "\"αhelloworldω\"" |> test_expr
736736
end
737737

738+
@testset "conversion of floats with underscore" begin
739+
@test "30.424_876_125_859_513" |> test_expr
740+
end
741+
738742
end

0 commit comments

Comments
 (0)