-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Interval operations with scalars #71
Comments
Thank you for your feedback! How about using a macro like this: I don't want to let users mix floating-point and interval operations for obvious reasons:
|
That's what I do in my own code. It is better that nothing but still makes the code more obscure than it needs to be.
I do not see the problem with this code as 10. would be “promoted” to the interval [10., 10.] and then the division will be performed. That said, someone way also write
I agree, you would have to guard against these — or define a promotion such as One way to avoid the above two problems while keeping the convenience would be to define a more powerful macro i!(3. * x.powi(3) + 4.5 * x.powi(2) - 1.25) which would be legible and safe. |
Oh, you're right! Maybe I'm already confused by the mixture.
|
Slowly thinking of such a procedural macro (which must be in a separate crate as far as I understand), this macro could also specialize operations where it sees fit. For example, |
One often has to implement expressions such as
and it would be convenient to be able to write
instead of
The text was updated successfully, but these errors were encountered: