Skip to content

type-valued float and real functions #935

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

Closed
stevengj opened this issue Jul 12, 2021 · 0 comments
Closed

type-valued float and real functions #935

stevengj opened this issue Jul 12, 2021 · 0 comments

Comments

@stevengj
Copy link
Contributor

stevengj commented Jul 12, 2021

Since we often treat StaticArrays almost like scalars, it would be nice to have float and real functions that act on the types. i.e.

float(::Type{SArray{S,T,N,L}}) where {S,T,N,L} = SArray{S,float(T),N,L}
real(::Type{SArray{S,T,N,L}}) where {S,T,N,L} = SArray{S,real(T),N,L}

analogous to e.g. float(Int) === Float64 and real(ComplexF32) == Float32 in Base.

Basically float(T) === typeof(float(zero(T))), and similarly for real.

andyferris added a commit that referenced this issue Nov 2, 2021
implement `float` and `real` for `StaticArray` (fix #935)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant