Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

inline cause Floating-point arithmetic exception without divide-by-zero #2339

Open
DerZc opened this issue Oct 25, 2022 · 1 comment
Open

Comments

@DerZc
Copy link

DerZc commented Oct 25, 2022

Hi,

I find a Floating-point arithmetic exception caused by inline, consider the following program:

.decl bydd(A:symbol, B:number)
.decl unoa(A:number, B:number, C:number, D:number, E:number, F:number, G:symbol, H:symbol) inline
.decl ycuc(A:number, B:number, C:number, D:symbol, E:number, F:symbol, G:number, H:symbol)
.decl lwug(B:symbol, E:symbol)

bydd("T", -3).
ycuc(0, 0, 0, "m", 0, "m", 0, "m").

unoa(B/B, B, B, -B, B, B, A, cat(A,A)) :- bydd(A, B).
lwug(H, J) :- ycuc(L, K, K, E, L, B, L, I), unoa(K, K, K, L, K, L, J, H).

.output lwug

I execute this program with souffle -w example.dl and get the output:

Floating-point arithmetic exception signal in rule:
lwug(cat(J,J),J) :- 
   ycuc(K,K,K,_,K,_,K,_),
   bydd(J,K),
   K = (K/K),
   K = -(K).
in file example.dl [11:1-11:74]

There is only one division in this program as B/B in the head of rule of unoa, but B only equals to -3. So there can't be divide-by-zero. The program can execute correctly if I remove the inline.

The version of Souffle is 29c5921

@DerZc
Copy link
Author

DerZc commented Oct 31, 2022

I reduce it to a simpler version:

.decl bydd(A:number)
.decl unoa(A:number, B:number) inline
.decl ycuc(A:number)
.decl lwug(B:number)

bydd(-3).
ycuc(0).

unoa(B/B, B) :- bydd(B).
lwug(K) :- ycuc(K), unoa(K, K).

.output lwug

Output is:

Floating-point arithmetic exception signal in rule:
lwug(K) :- 
   ycuc(K),
   bydd(K),
   K = (K/K).

Hope this is useful.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant