Closed kwon-young closed 2 years ago
Sorry for the delay in responding. We've been without power for the last 5 days as the result of a bad storm.
Thanks for reporting this bug. The special cases with precise values are not currently handled well and need to be fixed. Imprecise values fair a little better:
?- {2**N==1.0}.
N::real(-1.6017132519074596e-16, 3.2034265038149186e-16).
?- N::integer(-10,10), {2**N==1.0}.
N = 0.
The crash occurs because N::integer
produces, by default, an interval with very large endpoint values:
?- N::integer.
N::integer(-72057594037927936, 72057594037927935).
When the GMP library tries to generate the result of 2**N
using these endpoints, the result is an integer so large it exceeds available memory and SWI-Prolog crashes. Currently this is expected behaviour of the GMP library supporting big integers and rationals. Note that if N is initially defined with a small range (as shown above), things work as expected.
I'll post a followup message here when I push the special case fix. Let me know if this is something you urgently need.
I'll post a followup message here when I push the special case fix. Let me know if this is something you urgently need.
Absolutely not :)
Thank you for your response, I now understand better what is happening and I'll make sure to specify the intervals on my variables.
I'll test the fix as soon as you push it
I decided to push a small update fixing this issue rather than bundling it with current development a work. See Version 0.9.13 alpha
.
Thanks again for reporting.
I've tested the change and now it is working as expected.
Thank you for your help !
Hello,
Thank you for this wonderful library. I think I found a bug with 0 exponents.
Let me know if you need more information.
And if I do: