Opened 6 years ago

Closed 6 years ago

#17758 closed defect (duplicate)

Intervals and numpy floats do not compare correctly

Reported by: f.poloni Owned by:
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: basic arithmetic Keywords:
Cc: Merged in:
Authors: Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


Comparison operators between real interval field members and numpy float numbers always return false:

sage: import numpy as np
sage: RIF(1) <= 2.0
sage: RIF(1) <= RealNumber(2.0)
sage: RIF(1) <= np.float64(2.0)

Change History (6)

comment:1 Changed 6 years ago by vdelecroix


See also #13386. The problem is that Sage needs to avoid loading numpy at startup. This is still doable but require a bit of work (see in #13386).


comment:2 Changed 6 years ago by f.poloni

I agree, it looks like a duplicate. Sorry for not finding #13386 myself, I was searching only for "interval".

I understand that loading numpy slows down the startup time, but on the other hand this quirky behavior can cause nasty bugs in user code.

comment:3 Changed 6 years ago by vdelecroix

  • Milestone changed from sage-6.5 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review


I propose to close this as duplicate because of #18076. With the branch applied

sage: import numpy as np
sage: RIF(1) <= np.float64(2.0)

Though, if the numpy element is on the left this is still an issue (see #8824).


comment:4 Changed 6 years ago by f.poloni

Original reporter here; your proposal sounds good to me, and I am looking forward for your patch to close #18076 to be included in master.

comment:5 Changed 6 years ago by jdemeyer

  • Reviewers set to Jeroen Demeyer
  • Status changed from needs_review to positive_review

comment:6 Changed 6 years ago by vbraun

  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.