Decimals.jl icon indicating copy to clipboard operation
Decimals.jl copied to clipboard

Conversion of scientific floats

Open nielsls opened this issue 4 years ago • 0 comments

Decimals.scinote(str) errors when the number of decimals in the scientific number is higher than the exponent.

julia> x = 1.2345678e6
1.2345678e6

julia> Decimal(x)
ERROR: ArgumentError: can't repeat a string -1 times
Stacktrace:
 [1] repeat(s::String, r::Int64)
   @ Base .\strings\substring.jl:226
 [2] scinote(str::String)
   @ Decimals C:\Users\nls\.julia\packages\Decimals\Sb4j1\src\decimal.jl:37
 [3] parse(#unused#::Type{Decimal}, str::String)
   @ Decimals C:\Users\nls\.julia\packages\Decimals\Sb4j1\src\decimal.jl:4
 [4] Decimal(num::Float64)
   @ Decimals C:\Users\nls\.julia\packages\Decimals\Sb4j1\src\decimal.jl:13
 [5] top-level scope
   @ REPL[164]:1

nielsls avatar Nov 29 '21 12:11 nielsls