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

numElements returns zero for empty Intervals #301

Merged
merged 5 commits into from
May 24, 2022

Conversation

bogovicj
Copy link
Contributor

Changes the implementation of Intervals.numElements so that it returns zero "empty" Intervals
Where an Interval is "empty" if its max(d) < min(d) for any d

If we agree, then this definition should be documented.

see #300

@tpietzsch
Copy link
Member

Looks good to me.
I would maybe change the a>0 : a ? 0 constructs to Math.max(a,0).

@bogovicj bogovicj marked this pull request as ready for review April 12, 2022 18:11
@bogovicj
Copy link
Contributor Author

@tpietzsch

The latest push adds changes to the behavior of Intervals.union, fixing its behavior for empty intervals.
I called the methods with the old behavior unionUnsafe.

Alternatively, we could call the new methods unionSafe, and leave the old methods untouched and un-renamed.

@tischi
Copy link

tischi commented May 10, 2022

@tpietzsch could this be merged now?

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.

4 participants