id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
13213 Comparisons in real number field vdelecroix vdelecroix "Provide the order from RR for number field embedded in RR as in
{{{
sage: K. = 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. = 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. = 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
}}}" enhancement new major sage-5.10 number fields real number field, comparison Vincent Delecroix N/A