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

Relax AbstractFloat to Real #58

Open
aplavin opened this issue Jan 12, 2025 · 3 comments
Open

Relax AbstractFloat to Real #58

aplavin opened this issue Jan 12, 2025 · 3 comments

Comments

@aplavin
Copy link
Contributor

aplavin commented Jan 12, 2025

There are quite some Julia packages that provide numbers <: Real but not <: AbstractFloat. Currently, one cannot use them with SkyCoords:

julia> using SkyCoords, MonteCarloMeasurements

julia> ICRSCoords(1±0.1, 0±0.1)
StackOverflow

Can we relax the constraints in SkyCoords to <: Real? I'll be happy to make a PR for that.

@cgarling
Copy link
Member

I am not very familiar with this package but I would guess that AbstractFloat is necessary because of the mod2pi call in the constructor, which given (for example) an integer argument would return a floating point value, therefore changing the type of the first argument.

SkyCoords tries to convert arguments to a common floating point type when constructed from generic reals, but if float() style conversion is not implemented for the alternate type this will not help.

@aplavin
Copy link
Contributor Author

aplavin commented Jan 13, 2025

Number types like MonteCarloMeasurements support all kinds of math (+/mod/...). They just subtype Real and not AbstractFloat, while the latter is currently required by SkyCoords.

@aplavin
Copy link
Contributor Author

aplavin commented Jan 13, 2025

@mileslucas @giordano wdyt?

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

2 participants