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

Incorrect bitwidth when scope 0 int #274

Closed
nmacedo opened this issue May 2, 2024 · 0 comments
Closed

Incorrect bitwidth when scope 0 int #274

nmacedo opened this issue May 2, 2024 · 0 comments
Assignees
Labels
Milestone

Comments

@nmacedo
Copy link
Contributor

nmacedo commented May 2, 2024

Currently, when the scope for ints is set to 0, integer atoms are not created in the universe but Kodkod is still passed a bitwidth that allows arithmetic operations as long as they are not cast back into tuple set. This bitwidth is the one needed to calculate the cardinality of the universe.

Although I have my doubts about this behaviour in general, at the moment this bitwidth is not being correctly calculated (it's using log base e rather than log base 2).

solver_opts.setBitwidth(bitwidth > 0 ? bitwidth : (int) Math.ceil(Math.log(atoms.size())) + 1);

@nmacedo nmacedo added the bug label May 2, 2024
@nmacedo nmacedo self-assigned this May 2, 2024
@grayswandyr grayswandyr added this to the A6.1 milestone May 2, 2024
nmacedo added a commit to nmacedo/org.alloytools.alloy that referenced this issue May 2, 2024
@nmacedo nmacedo closed this as completed Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants