-
Notifications
You must be signed in to change notification settings - Fork 79
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
Clingo only supports 32 bit ints even through it uses a 64 bit model #89
Comments
This is intended. Supporting 64 bit integers would greatly increase memory consumption. |
Thank you for the clarification! Is that limitation documented somewhere? I couldn't find any mention in https://www.mat.unical.it/aspcomp2013/files/ASP-CORE-2.03b.pdf. Would it make sense to add a warning in gringo when numbers overflow or underflow? |
I can't remember that we put it anywhere. Our guide could be a good place to add this information.
It might help, but it is not that easy to implement. A lot of places in the code would have to be adjusted. And the C/C++ language does not make it easy to check for these overflows. |
Okay, I thought this could be added to the parser but I thought that without knowing how things are implemented. thanks for the clarifications. For now, I clamp all numbers to max int 32 when I generate ASP programs. |
Be careful when you use arithmetic in your program. Numbers might still overflow. If you do not need to use arithmetic, you could as well use strings, e.g., 1 becomes "1". |
I am going to mark this question with the enhancement label. In the future I might implement better handling of overflows. But don't expect anything soon. |
I would appreciate 64bit ints. perhaps with a switch as an argument or compilation option. |
There is no way to simply increase the size of the numbers supported by clingo. |
I would also like to suggest arbitrary large integers. I understand that deviating from 32 bit ints will impact performance but could there be a separate notation for bigints or a cli argument that enables big ints? |
Supporting big integers on the grounder side would be possible without sacrificing (much) performance. The solving part only supports minimize/sum constraints over 32 bit integers. Big integer constraints would have to be supported additionally because the performance hit would be noticeable. Another difficult part would be to expose them via the API. Then, there are also license issues. The gmp is GPL but there are (slower) MIT alternatives. I'll keep these things in mind but don't expect anything to happen soon. |
@rkaminsk thanks for quick response |
Hi @rkaminsk, in theory, if I/someone were to create a fork with 64 bit numbers (not biginter), could you please comment on some assumptions/questions?
|
@kherud: I am currently working on this. I decided to add biginter support because this has the nice side effect that operations no longer overflow. Since this is a big change, integration into the system will still take some time. |
Clingo version says that it uses a 64 bit address model
However, large numbers start to wrap around.
Is this intended behavior? I couldn't find any documentation for this.
The text was updated successfully, but these errors were encountered: