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

Warn or error on every operation mixing Interval and number #568

Closed
Kolaru opened this issue Jul 10, 2023 · 1 comment · Fixed by #590
Closed

Warn or error on every operation mixing Interval and number #568

Kolaru opened this issue Jul 10, 2023 · 1 comment · Fixed by #590
Labels
1.0 Planned for the major 1.0 release enhancement

Comments

@Kolaru
Copy link
Collaborator

Kolaru commented Jul 10, 2023

During triage call we discussed this would be good to avoid possible pitfall.

For example when differentiating using an interval in another package, we have

d/dx (3^x) = ln(3) * 3^x  # Trusting Luca on that

Here ln(3) is no longer correctly rounded, and the guarantee is lost.

Together we would profit from having a mechanism to either disable the warning or turn it into an error.

@Kolaru Kolaru added enhancement 1.0 Planned for the major 1.0 release labels Jul 10, 2023
@OlivierHnt
Copy link
Member

Note that on master we get

ForwardDiff.derivative(x -> 3^x, interval(1))
ERROR: promotion of types Int64 and Interval{Float64} failed to change any arguments

since we have disallowed automatic conversion between Number and Interval. So this is good news at least.

One annoying aspect of such warnings is that im*y yields a warning. One option could be to make a special method for Complex{Bool} that does not throw... But that feels inconsistent.

All in all, this is a matter of where we want to draw the "safety line". The most drastic decision would be to completely disallow mixing of Interval and Number for arithmetic operations. This would be in agreement with the intended removal boolean functions for Interval which are also defined for Number.
Yet, in this scenario im*y would error.
Perhaps this is not so much of an issue if #237 is done since in that case we would define our own ComplexInterval type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0 Planned for the major 1.0 release enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants