Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support signed/unsigned reals, and a compact representation #6

Open
cjdoris opened this issue Jun 2, 2020 · 0 comments
Open

Support signed/unsigned reals, and a compact representation #6

cjdoris opened this issue Jun 2, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@cjdoris
Copy link
Owner

cjdoris commented Jun 2, 2020

Two issues, but both require new type parameters to InfExtended, which could become:

InfExtended{T<:Real, C, S, F}
  flag :: F
  finitevalue :: T
  ...
end

Firstly, C for "compact" is a boolean. When false then F = InfFlag and flag represents whether the value is finite, positive infinity or negative infinity, as is the current implementation (or will be after #4). When true then F = Nothing and we use typemax(T) and typemin(T) to represent infinity in the finitevalue. This is "compact" because sizeof(InfExtended{T, true, ...}) == sizeof(T), at the expense of losing two finite values from T.

  • What should the default C be? Perhaps true whenever T is a bits type, and false otherwise?
  • Make this default an overloadable function, so packages can define it for their own types?
  • How can we let the user choose? Perhaps InfExtended(T, :compact=>true)? Or just InfExtended(T, true)?

Secondly S for "signed" is a boolean. When true then both positive and negative infinity are allowed values. When false then only positive infinity is allowed. Hence S should be true whenever T is a signed type.

  • Clearly the default for S is whether or not T is a signed type.
  • Do we ever let the user choose? I'm thinking no, but we could have a function issigned(T) which controls its behaviour.
@cjdoris cjdoris self-assigned this Jun 2, 2020
@cjdoris cjdoris added the enhancement New feature or request label Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant