You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Two issues, but both require new type parameters to
InfExtended
, which could become:Firstly,
C
for "compact" is a boolean. Whenfalse
thenF = InfFlag
andflag
represents whether the value is finite, positive infinity or negative infinity, as is the current implementation (or will be after #4). Whentrue
thenF = Nothing
and we usetypemax(T)
andtypemin(T)
to represent infinity in thefinitevalue
. This is "compact" becausesizeof(InfExtended{T, true, ...}) == sizeof(T)
, at the expense of losing two finite values fromT
.C
be? Perhapstrue
wheneverT
is a bits type, andfalse
otherwise?InfExtended(T, :compact=>true)
? Or justInfExtended(T, true)
?Secondly
S
for "signed" is a boolean. Whentrue
then both positive and negative infinity are allowed values. Whenfalse
then only positive infinity is allowed. HenceS
should be true wheneverT
is a signed type.S
is whether or notT
is a signed type.issigned(T)
which controls its behaviour.The text was updated successfully, but these errors were encountered: