taschini / pyinterval

PyInterval — Interval arithmetic in Python
http://pyinterval.readthedocs.io
Other
83 stars 25 forks source link

Invalid interval component due to precision? #18

Open b1rd1e opened 7 years ago

b1rd1e commented 7 years ago

Hi,

Could you tell why the following error is being thrown? Are the operators used not able to handle this much precision?

Error1: Traceback (most recent call last): File "c.py", line 78, in input_prev[index] = interval(lower,upper) File "path/python2.7/site-packages/interval/init.py", line 101, in new return cls.union(process(x) for x in args) File "path/python2.7/site-packages/interval/init.py", line 185, in union return cls._canonical(c for i in intervals for c in i) File "path/python2.7/site-packages/interval/init.py", line 162, in _canonical components = [c for c in components if c.inf <= c.sup] File "path/python2.7/site-packages/interval/init.py", line 185, in return cls._canonical(c for i in intervals for c in i) File "path/python2.7/site-packages/interval/init.py", line 101, in return cls.union(process(x) for x in args) File "path/python2.7/site-packages/interval/init.py", line 100, in process raise cls.ComponentError("Invalid interval component: " + repr(x)) interval.ComponentError: Invalid interval component: interval([0.020530565167243362, 0.020530565167243373])

Similarly, File "/path/python2.7/site-packages/interval/init.py", line 100, in process raise cls.ComponentError("Invalid interval component: " + repr(x)) interval.ComponentError: Invalid interval component: interval([0.004029219530949634, 0.004029219530949636])

taschini commented 7 years ago

I cannot reproduce it. Both intervals seem to be perfectly fine:

>>> from interval import interval
>>> interval([0.020530565167243362, 0.020530565167243373])
>>> interval([0.004029219530949634, 0.004029219530949636])

I need more context to be able to diagnose what is wrong.