Skip to content

Moved floating point rounding mode into Program#1019

Open
ThomasHaas wants to merge 4 commits intodevelopmentfrom
refactorFloatingPointRoundingMode
Open

Moved floating point rounding mode into Program#1019
ThomasHaas wants to merge 4 commits intodevelopmentfrom
refactorFloatingPointRoundingMode

Conversation

@ThomasHaas
Copy link
Copy Markdown
Collaborator

This is basically the less controversial half of #978 :)
I kept the Program.SemanticConfig class even though it contains only a single option right now.

The biggest question is where to best inject the Configuration into the Program. For simplicity, I do this when constructing the VerificationTask, but it is a bit sketchy.

// We only show the condition if this is the reason of the failure
String condition = "";
final boolean ignoreFilter = task.getConfig().hasProperty(IGNORE_FILTER_SPECIFICATION) && task.getConfig().getProperty(IGNORE_FILTER_SPECIFICATION).equals("true");
final boolean ignoreFilter = Objects.equals(task.getConfig().getProperty(IGNORE_FILTER_SPECIFICATION), "true");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this now handle the case where we do not have the property?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it seems getProperty just returns NULL in that case.

this.witness = checkNotNull(witness);
this.config = checkNotNull(config);

// TODO: Is it a good idea to inject configs into the program here?
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the alternative?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inject it right after parsing the program.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-wise that would be bad, because we have different "places" where program is parsed (CLI, UI, unit tests) and we would have to inject it in all of them.

One could claim that we do not care the rounding mode unless we are doing the verification (and thus having the inject the VerificationTask is ok), but then this raises the question if the rounding mode should then indeed be part of the Program.

Copy link
Copy Markdown
Collaborator Author

@ThomasHaas ThomasHaas Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we have a central ProgramParser that is always used to parse the program. If that class was configurable via a Configuration, we could inject the settings there. Generally, making the parsers configurable would be a good idea and allow us to give options like ignore inline assembly or throw on unknown inline assembly etc.

If the rounding mode was part of the verification task, we would need to lift all program passes to verification task passes (at least in principle) for otherwise the rounding mode was inaccessible.

But for now, I think having the injection in VerificationTask is okayish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants