Opened 7 years ago
Last modified 7 years ago
#13213 closed enhancement
Comparisons in real number field — at Version 4
Reported by: | vdelecroix | Owned by: | vdelecroix |
---|---|---|---|
Priority: | major | Milestone: | sage-5.10 |
Component: | number fields | Keywords: | real number field, comparison |
Cc: | Merged in: | ||
Authors: | Vincent Delecroix | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
Provide the order from RR for number field embedded in RR as in
sage: K.<sqrt2> = NumberField(x^2 - 2, 'sqrt2', embedding=1.4142) sage: sqrt2 - 1 > 0 True sage: sqrt2 < 2 True sage: sqrt2.floor() 1
There is a patch for quadratic field. Another one is comming for general number fields. Note that this patch is partly a duplicate because of #7160.
Timings with the patch
sage: K.<sqrt2> = QuadraticField(2,'sqrt2',embedding=1.4142) sage: b = (5*sqrt2 + 14)/5 sage: a = (3*sqrt2 + 18)/7 sage: %timeit a < b 625 loops, best of 3: 6.68 µs per loop
Timings without the patch
sage: sage: K.<sqrt2> = QuadraticField(2,'sqrt2',embedding=1.4142) sage: a = (3*sqrt2 + 18)/7 sage: b = (5*sqrt2 + 14)/5 sage: %timeit a < b 625 loops, best of 3: 478 ns per loop
Change History (4)
comment:1 Changed 7 years ago by
comment:2 Changed 7 years ago by
- Description modified (diff)
comment:3 Changed 7 years ago by
- Description modified (diff)
comment:4 Changed 7 years ago by
- Description modified (diff)
Note: See
TracTickets for help on using
tickets.
I had a short look at your patch. Could you use Python 3 compatible syntax to raise errors. E.g.