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 sin/cos and (/) behavior #60

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

fix sin/cos and (/) behavior #60

wants to merge 2 commits into from

Conversation

massma
Copy link

@massma massma commented May 23, 2020

This hopefully resolves #59 by constraining the infimum in cos to [0, pi).

It also changes (/) to improve behavior with zero end points (see #19 ). Before:

> 1.0 / (0.0 ... 1.0)
Infinity ... Infinity
> 1.0 / (-1.0 ... 0.0)
-Infinity ... Infinity

After:

> 1.0 / (0.0 ... 1.0)
1.0 ... Infinity
> 1.0 / (-1.0 ... 0.0)
-Infinity ...-1.0

For what it's worth, the new behavior is consistent with the Multiple Precision Floating-Point Interval (MPFI) library. Because there might be opinions, I didn't touch 1 / singleton 0.0 (e.g., #47), but MPFI does return whole for that, rather than an exception.

Also do you have any interest in defining recip in terms of (/)? I thought there might be a reason recip is defined as is, but if not, redefining recip would fix #53.

Finally, I am a novice to Haskell so all of this might benefit from a second set of eyes.

Thanks for the help and putting together this package!

Adam

EDIT: I am leaving this pull request open for now, but I also have a branch going:

https://github.com/massma/intervals/tree/adam-fork

of some (possibly opinionated and novice) changes I made to address the bugs I needed to for my application. So far this branch fixes #19, #47, #53, #59, #61. If you want any of these updates to be incorporated into intervals just let me know: I am happy to filter and edit the branch according to your preferences, and submit a fresh pull request!

@massma massma changed the title fix sin/cos behavior: constrain infimum to [0, pi) fix sin/cos and (/) behavior May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant