Skip to content

Questions about symmetry #23

@JeffreySarnoff

Description

@JeffreySarnoff

(a) Why is there no need for StaticFloat32 or StaticInt32?

(b) Why is StaticInt idempotency & etc. defined

StaticInt(N::Int) = StaticInt{N}()
StaticInt(N::Integer) = StaticInt(convert(Int, N))
StaticInt(::StaticInt{N}) where {N} = StaticInt{N}()
StaticInt(::Val{N}) where {N} = StaticInt{N}()

while StaticFloat64 idempotentcy & etc is defined

(::Type{T})(x::Integer) where {T<:StaticFloat64} = StaticFloat64(x)
(::Type{T})(x::AbstractFloat) where {T<:StaticFloat64} = StaticFloat64(x)

# this line added to prevent stack overflow:  `StaticFloat64(static(1.0))` 
(::Type{T})(::StaticFloat64{N}) where {N, T<:StaticFloat64} = StaticFloat64{N}()
# this line added to match handling of `StaticInt(::Val{N})`
(::Type{T})(::Val{N}) where {N, T<:StaticFloat64} = StaticFloat64{float(N)}()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions