mcabbott / mcabbott/InTheRed.jl
Error from very large & small numbers
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 4
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
julia> [1.0876169274012003e-296
2.8590377617020347e-194
3.983626798390652e188
6.198941844352751e306 ]
4-element Vector{Float64}:
1.0876169274012003e-296 # ┝
2.8590377617020347e-194 # ┝
3.983626798390652e188 # ┝
6.198941844352751e306 # Error showing value of type Vector{Float64}:
ERROR: InexactError: Int64(Inf)
Stacktrace:
[1] Int64
@ ./float.jl:994 [inlined]
[2] convert
@ ./number.jl:7 [inlined]
[3] _round_convert
@ ./rounding.jl:480 [inlined]
[4] round
@ ./rounding.jl:479 [inlined]
[5] round(::Type{Int64}, x::Float64)
@ Base ./rounding.jl:477
[6] print_matrix_row(io::IOContext{…}, X::AbstractVector, A::Vector{…}, i::Int64, cols::Vector{…}, ::Tuple{…}, idxlast::Int64)
@ InTheRed ~/.julia/dev/InTheRed/src/InTheRed.jl:367
[7] _print_matrix(io::IOContext{…}, X::AbstractVecOrMat, pre::String, sep::Tuple{…}, post::String, hdots::String, vdots::String, ddots::String, hmod::Int64, vmod::Int64, rowsA::UnitRange{…}, colsA::UnitRange{…})
@ Base ./arrayshow.jl:213
[8] print_matrix(io::IOContext{…}, X::AbstractVector{…}, pre::String, sep::String, post::String, hdots::String, vdots::String, ddots::String, hmod::Int64, vmod::Int64)
@ InTheRed ~/.julia/dev/InTheRed/src/InTheRed.jl:329
[9] print_matrix
@ ~/.julia/dev/InTheRed/src/InTheRed.jl:327 [inlined]
[10] print_array
@ ./arrayshow.jl:358 [inlined]
[11] show(io::IOContext{Base.TTY}, ::MIME{Symbol("text/plain")}, X::Vector{Float64})
@ Base ./arrayshow.jl:399
julia> big.(ans)
4-element Vector{BigFloat}:
1.087616927401200285018319568545486814502889178064027059196542505850344809969077e-296 # ┝
2.859037761702034670545107230554641025787116350396484878711277131613590027864639e-194 # ┝
3.983626798390652253889328433303519879822437273521670606883129696293955010257162e+188 # ┝
6.198941844352751018891366080023220524260710929766619002117628826897026284271671e+306 # ┝━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the error with the numeric vector shown in the issue, then read InTheRed.jl around print_matrix_row and print_matrix, especially the round conversion at line 367. Done means the vector prints successfully without InexactError while preserving informative formatting for both very small and very large values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100