support reinterpret from UIntX to Fixed{IntX, N}
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
首先阅读链接位置的 src/fixed.jl 中的 reinterpret 方法,并复现报告的 Julia 示例。将提议的 UIntX 到 Fixed{IntX, N} 的行为与现有的双重 reinterpret 方法进行比较。当预期的 reinterpret 形式能够正常工作且不会出现报告的 leaf-primitive 错误,并且覆盖相关整数类型时,即可视为完成。
由索引模型根据 Issue 内容生成。
描述
Currently if you have a UInt16 that you want to reinterpret as a signed fixed-point number the reinterpret method here doesn't apply, so you get an error:
julia> reinterpret(Fixed{Int16, 15}, 0x8123)
ERROR: bitcast: target type not a leaf primitive type
Stacktrace:
[1] reinterpret(::Type{FixedPointNumbers.Fixed{Int16,15}}, ::UInt16) at ./essentials.jl:155
[2] eval(::Module, ::Any) at ./boot.jl:235
Is it worth having another reinterpret method to handle this, or is it safer to have the user double-reinterpret? (e.g. reinterpret(Fixed{Int16, 15}, reinterpret(Int16, 0x8123)))
One proposed method would be:
function Base.reinterpret(::Type{Fixed{T,f}}, x::Unsigned) where {T <: Signed,f}
reinterpret(Fixed{T, f}, reinterpret(T, x))
end
Or we could even drop the requirement the x subtypes Unsigned if we want to reinterpret more broadly.
- 主要语言
- Julia
- 星标
- 95
- 派生
- 38
- 平均合并
- 16 小时 31 分钟
- 30 天内合并 PR
- 9
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
JuliaMath/FixedPointNumbers.jl 的其他 Issue
-
bug
难度 5/5 一周以上 新手友好度 35/100
JuliaMath/FixedPointNumbers.jl#343 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 62/100
JuliaMath/FixedPointNumbers.jl#342 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
JuliaMath/FixedPointNumbers.jl#337 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 42/100
JuliaMath/FixedPointNumbers.jl#331 · 7 条评论 ·
维护者通常 1 天内回复
-
needs comments
难度 3/5 1-2 天 新手友好度 68/100
JuliaMath/FixedPointNumbers.jl#318 · 1 条评论 ·
维护者通常 1 天内回复
查看 JuliaMath/FixedPointNumbers.jl 的全部 Issue
相似的 Issue
-
add-on doc enhancement
难度 2/5 1-3 小时 新手友好度 72/100
JuliaGraphics/ColorTypes.jl#344 · 1 条评论 ·
维护者通常 1 天内回复
-
`enzymexla.linalg.lu` lowering fails for a tall matrix: the permutation is built with the pivot type未关闭
难度 2/5 1-3 小时 新手友好度 78/100
EnzymeAD/Enzyme-JAX#3286 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 90/100
SciML/LinearSolve.jl#1359 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
EnzymeAD/ReactantNitro.jl#13 ·
-
难度 1/5 1 小时以内 新手友好度 78/100
epiforecasts/BVDOutbreakSize#1009 ·
维护者通常 1 天内回复