Opened 7 years ago

Closed 7 years ago

#18337 closed enhancement (fixed)

Add methods `real` and `imag` to real interval field

Reported by: vdelecroix Owned by:
Priority: major Milestone: sage-6.7
Component: basic arithmetic Keywords:
Cc: Merged in:
Authors: Vincent Delecroix Reviewers: Marc Mezzarobba
Report Upstream: N/A Work issues:
Branch: 5f5d792 (Commits, GitHub, GitLab) Commit: 5f5d7922635f713194f0f3f9a9215148828a4e4f
Dependencies: Stopgaps:

Status badges

Description (last modified by vdelecroix)

For coherence we should have imag defined on real intervals:

sage: RR(3).real()
3.00000000000000
sage: RR(3).imag()
0

see also: #18334

Change History (6)

comment:1 Changed 7 years ago by vdelecroix

  • Branch set to u/vdelecroix/18337
  • Commit set to 58dbde182a2c1e174946be9ff87f74439d8c4535
  • Status changed from new to needs_review

New commits:

d96885cTrac 18334: sign and truncations for real intervals
58dbde1Trac 18337: .imag() for real intervals

comment:2 Changed 7 years ago by git

  • Commit changed from 58dbde182a2c1e174946be9ff87f74439d8c4535 to 5f5d7922635f713194f0f3f9a9215148828a4e4f

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

5f5d792Trac 18337: .imag() for real intervals

comment:3 Changed 7 years ago by vdelecroix

  • Description modified (diff)

comment:4 follow-up: Changed 7 years ago by mmezzarobba

  • Reviewers set to Marc Mezzarobba
  • Status changed from needs_review to positive_review

Lgtm. But I more and more think that there should be common base classes for all “real-like” and “complex-like” fields rather than separate implementations of stuff like that in every single one.

comment:5 in reply to: ↑ 4 Changed 7 years ago by vdelecroix

Replying to mmezzarobba:

Lgtm. But I more and more think that there should be common base classes for all “real-like” and “complex-like” fields rather than separate implementations of stuff like that in every single one.

+1... and some normalization too, I found the following very bad

sage: RDF(-1)**(1/3)
NaN
sage: RR(-1)**(1/3)
0.500000000000000 + 0.866025403784439*I
sage: AA(-1)**(1/3)
-1

Thanks for the review.

comment:6 Changed 7 years ago by vbraun

  • Branch changed from u/vdelecroix/18337 to 5f5d7922635f713194f0f3f9a9215148828a4e4f
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.