Changes between Initial Version and Version 4 of Ticket #12353


Ignore:
Timestamp:
Jan 30, 2012, 3:48:44 PM (11 years ago)
Author:
zimmerma
Comment:

after some investigation, the function _richcmp in structure/element.pyx computes r = cmp(type(left), type(right)), which gives r=-1 on sage.math, and r=1 on my workstation (both with Sage 4.8).

Note that the *types* only are compared, thus by swapping the values I can produce a bug on sage.math too:

sage: RealIntervalField(54)(1) > RR(-1)
False

Something is badly wrong by comparing the types, not the values. Here we need help from someone more fluent in the Sage internals.

Paul

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12353

    • Property Cc robertwb was added
  • Ticket #12353 – Description

    initial v4  
    1 consider the following:
     1on some machines we get the following:
    22{{{
    33sage: RealIntervalField(53)(-1) > RR(1)
     
    66True
    77}}}
    8 The second answer is clearly wrong.
     8The second answer {{{True}}} is clearly wrong.
    99
    10 The problem seems to be the following: the {{{_richcmp}}} function
    11 from {{{structure/element.pyx}}} is called. With precision 54, the
    12 call to {{{coercion_model.canonical_coercion}}} fails, then we have
    13 {{{r=1}}}, the two tests around line 853 fail, and the returned value is {{{_rich_to_bool(op, r)}}} which does not depend on {{{left}}} and {{{right}}}!
    14 
    15 Paul
     10If your machine gets the correct answer {{{False}}} in both cases, then it most probably gives:
     11{{{
     12sage: RealIntervalField(54)(1) > RR(-1)
     13True
     14sage: RealIntervalField(54)(1) > RR(-1)
     15False
     16}}}
     17where the second answer {{{False}}} is wrong.