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

hidden types in (is)/2 while computing with rational numbers #538

Closed
ghost opened this issue Jan 23, 2020 · 5 comments
Closed

hidden types in (is)/2 while computing with rational numbers #538

ghost opened this issue Jan 23, 2020 · 5 comments

Comments

@ghost
Copy link

ghost commented Jan 23, 2020

There is some hidden types somewhere. Possibly rdiv(A,1) is displayed as A. Or somewhere inbetween converted to A. I get this “error”. First it tells me the sub result is 3.

Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.19)

?- X is 13 rdiv 4 - (1 rdiv 2)*(1 rdiv 2).
X = 3.

Now I use the sub result to get the final result:

?- Y is 1/3.
Y = 0.3333333333333333.

If I do it in one go I get the following result:

?- Z is 1/(13 rdiv 4 - (1 rdiv 2)*(1 rdiv 2)).
Z = 1 rdiv 3.

Thats a little strange.

@JanWielemaker
Copy link
Member

@JanWielemaker
Copy link
Member

This issue has been mentioned on SWI-Prolog. There might be relevant details there:

https://swi-prolog.discourse.group/t/future-of-support-for-rational-numbers/1779/10

@JanWielemaker
Copy link
Member

I now see what you mean. This indeed is a bug. I'll re-open it for the record, but I think it is a better idea to property support rationals than fixing this. And no, screen shots have no added value, so please stop using them.

@JanWielemaker JanWielemaker reopened this Jan 24, 2020
@JanWielemaker
Copy link
Member

This issue has been mentioned on SWI-Prolog. There might be relevant details there:

https://swi-prolog.discourse.group/t/using-screen-shots-and-images/1783/2

@ghost ghost closed this as completed Jan 24, 2020
@ghost
Copy link
Author

ghost commented Jan 24, 2020

The (^)/2 operator is also affected:

?- X is (13 rdiv 4 - (1 rdiv 2)*(1 rdiv 2))^(-1).
X = 1 rdiv 3.

?- Y is 13 rdiv 4 - (1 rdiv 2)*(1 rdiv 2), X is Y^(-1).
Y = 3,
X = 0.3333333333333333.

This issue was closed.
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

1 participant