-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add checked_add
and checked_sub
#152
Comments
BTW, if checked arithmetic becomes the default and the overflow-safe promotion rules are added in the future, I think that using the |
BTW, the integer types of Rust have The removal of One option is to add the |
Originally posted by @timholy in #209 (comment)
Originally posted by @kimikage in #209 (comment) However, I am interested in Cassette.jl. I think the injection is useful in end user codes. If checked arithmetic is needed only for development/debugging and not for the final code, I think that the default arithmetic can be the current wrapping arithmetic. It might be also a good idea for CheckedArithmetic.jl to use Cassette.jl. However, in that case, it is better to separate the interface and implementation into separate packages. As you know, I have concerns about the In the future (Julia v2.0?), I hope that handling |
Cassette is cool technology but beware of the compile-time latency. Conceptually it's not very different from img1checked, img2checked = reinterpret(N0f8Checked, img), reinterpret(N0f8Checked, img)
imgdiff = img1checked-img2checked which would be a more "surgical" approach to checked-aware recompilation (though perhaps less easy to automate). While catching issues during development is of course a good idea, don't forget the interactive convenience of visualizing |
The original purpose of this issue was achieved by PR #190, but I reopened this just for discussion. |
Oh, I think you could leave this closed if you want. As you say, you fixed it! 🎉 Having checked arithmetic is great, I'm just pointing out that it doesn't solve all the problems that I think we might want to address. |
It may be better to open the topic in the Discourse or Zulip. 😄 |
I will close this issue by moving the discussion place in this repository to issue #227. |
As the first measure against #41, I want to add
checked_add
andchecked_sub
(andchecked_neg
,checked_abs
) so that we can tryCheckedArithmetic
.I think it is better to support
checked_mul
at the same time as or after the optimization of current multiplication implements. Addingchecked_mul
implies introducing unchecked mul, i.e. breaking changes.The text was updated successfully, but these errors were encountered: