id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,merged,author,reviewer,upstream,work_issues,branch,commit,dependencies,stopgaps
9752,sorting of number field elements is broken,was,davidloeffler,"The design of number field elements (and other aspects of sage) assumes that cmp defines a total ordering, which of course doesn't respect the algebraic field structure. Unfortunately, the actual implementation (in number_field_element.pyx) is buggy and doesn't define a total ordering. Look at the code and you'll see. Or just look at this example:
{{{
sage: L.** = NumberField(x^3-10001)
sage: b+1 < L(1667)
False
sage: L(1667) < b+1
False
}}}
I think the best correct implementation of cmp should be one that is efficient and *also* agrees with the lexicographic ordering of elements based on their representation as a polynomial in the generator of the number field. I did implement this as part of the patch bomb #9541. The point of the present ticket is to ""backport"" something like this out of #9541, or implement a new fix from scratch. This is motivated by #9400. ",defect,closed,major,sage-duplicate/invalid/wontfix,number fields,duplicate,,,,,William Stein,N/A,,,,,
**