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

Fix #7387, operations between ranges and non-real numbers #7425

Merged
merged 1 commit into from
Jul 1, 2014

Conversation

simonster
Copy link
Member

This seems pretty trivial, but it occurs to me that it would be nice to have generic fallbacks for these functions for all AbstractArrays so that it's not necessary to reimplement them for user-defined types. In that case we would presumably want to use similar instead of comprehensions, but then there's the problem of getting the element type right, which is ultimately related to how we decide to handle #7258. So for now, I'm punting on that and just making the minimal change to fix this issue.

@kmsquire
Copy link
Member

I'm wondering if it would be reasonable to construct a new range instead of an array... Thoughts?

@simonster
Copy link
Member Author

There are already more specific methods that construct a new range for +/-/* with a real, so these methods would only be called for !(Number <: Real). At present we couldn't actually construct ranges involving complex numbers, since StepRange needs <, which is not defined for Complex, and FloatRange is restricted to reals. There are also other issues with expanding ranges to non-reals: the colon operator is only well-defined for complex if angle(step) == angle(stop-start), and I don't know enough abstract algebra to say what should happen for other number types.

simonster added a commit that referenced this pull request Jul 1, 2014
Fix #7387, operations between ranges and non-real numbers
@simonster simonster merged commit 5d8c8ab into master Jul 1, 2014
@simonster simonster deleted the sjk/7387 branch July 1, 2014 18:18
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

Successfully merging this pull request may close these issues.

2 participants