Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Negative number of fractional bits

未关闭
#311 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
活跃
技术栈
julia
领域
data

调研方向

首先检查现有的 Fixed 类型,以及将 fractional-bit 参数限制为非负值的方法。比较演示的负位行为,并确定 package 应该泛化 Fixed,还是引入单独的 scaled-integer 类型;完成此任务需要确定设计方案,并为所请求的类型提供受支持的行为。

由索引模型根据 Issue 内容生成。

描述

add-on enhancement

With Fixed we can reduce the number of fractional bits to trade range for precision:

julia> Fixed{Int8, 2} .|> (typemin, typemax, eps)
(-32.0Q5f2, 31.75Q5f2, 0.25Q5f2)

julia> Fixed{Int8, 1} .|> (typemin, typemax, eps)
(-64.0Q6f1, 63.5Q6f1, 0.5Q6f1)

julia> Fixed{Int8, 0} .|> (typemin, typemax, eps)
(-128.0Q7f0, 127.0Q7f0, 1.0Q7f0)

However, currently support stops here. It would be useful to have a

julia> Fixed{Int8, -1} .|> (typemin, typemax, eps)
(-256.0Q8f-1, 254.0Q8f-1, 2.0Q8f-1)

and all the other types with a negative number of fractional bits available, when range demands are high, precision demands are low and you want to distribute the available values uniformly in the range or want to use integer arithmetic (so floating points are not an option).

This would not really match the packet's name as they are not really fixed-point numbers (with the "point" being outside of the represented bits). On the other hand, an implementation of these numbers (scaled integers) seems to be completely identical in representing the type (struct) and should cover both positive and negative numbers of fractional bits if some methods are generalized or their domain restrictions are relaxed.

So what would these scaled integers be? Would they use a slightly generalized version of Fixed, would they be a ScaledInteger within the FixedPointNumbers.jl package or would they be the topic of a ScaledIntegers.jl package?

主要语言
Julia
星标
95
派生
38
平均合并
1 天 7 分钟
30 天内合并 PR
4

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

JuliaMath/FixedPointNumbers.jl 的其他 Issue

查看 JuliaMath/FixedPointNumbers.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。