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

frem discrepancy between alive2 and llvm #1175

Open
bongjunj opened this issue Feb 25, 2025 · 1 comment
Open

frem discrepancy between alive2 and llvm #1175

bongjunj opened this issue Feb 25, 2025 · 1 comment

Comments

@bongjunj
Copy link

bongjunj commented Feb 25, 2025

llvm/llvm-project#128457

3.0 frem 2.0 should result in 1.0 in llvm while alive2 thinks it to be -1.0

The value produced is the floating-point remainder of the two operands. This is the same output as a libm ‘fmod’ function, but without any possibility of setting errno. The remainder has the same sign as the dividend. This instruction is assumed to execute in the default floating-point environment. This instruction can also take any number of fast-math flags, which are optimization hints to enable otherwise unsafe floating-point optimizations:
frem Semantics, LLVM Reference

@aqjune
Copy link
Member

aqjune commented Feb 25, 2025

Can we encode z = frem ty x, y as something like x - y * floor(x / y) on the SMT side? This can again be approximation because x / y cannot be infinitely precise, but still will be a better approximation.

@bongjunj bongjunj changed the title frem discrepancy between alive2 and llvm frem discrepancy between alive2 and llvm Feb 25, 2025
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

No branches or pull requests

2 participants