-
Notifications
You must be signed in to change notification settings - Fork 1
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
Ban infinite dividends #69
Comments
Infinite-by-infinite division is well-behaved but also uninteresting; it's a conditional subtraction. I could add nicher constraints than Finite<T> and Natural<T> but I prefer to keep it simple ™️ to the extent that it is possible. |
I've prototyped a new approach using (#95). It seems a bit annoying to maintain, but otherwise viable. I could, perhaps, reduce it to just |
I've had other ideas too. Like, I could strengthen the input guarantee such that only well-behaved divisions are allowed, basically hoisting all preconditions. That might be convoluted in another way, but I don't want to dismiss the idea just yet. |
I basically want the I8(-128).quotient(Nonzero(-1)) == I8.exactly(IXL(-128) / IXL(-1)) Division is just a weird operation where almost all inputs are valid. Sigh. |
Back to the original post: divisions of infinite dividends are useless; a blanket ban is a viable alternative. |
This rewrite introduces safe division protocol requirements with proper division semantics. I'm sure these methods can be derived from unsafe requirements, but this is a good place to start. I'll may consider unsafe requirements if the overhead of safety cannot be optimized away. Something, something, sufficiently smart compiler.
Banning infinite dividends seems like the simplest solution to (#68). It would also mean that all safe division inputs are well-behaved. Infinite dividends would be banned by setting the type to Finite<T>. Imagine the following with some conveniences:
The text was updated successfully, but these errors were encountered: