Changes between Initial Version and Version 8 of Ticket #24219


Ignore:
Timestamp:
Nov 16, 2017, 8:49:59 AM (5 years ago)
Author:
Jeroen Demeyer
Comment:

The behaviour that you see is by design, so by definition it's a feature and not a bug.

Note also that what you see is consistent with subtraction, which is a good thing:

sage: RealField(2)(1) - 5/4
0.00

I don't see a simple fix here... it would require substantial changes to the coercion model.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24219

    • Property Component changed from basic arithmetic to coercion
  • Ticket #24219 – Description

    initial v8  
    11{{{
    2 sage: t = RealField(2)(1)
    3 sage: t >= 5/4
     2sage: RealField(2)(1) >= 5/4
    43True
    54}}}
    6 This is clearly wrong. My guess is that {{{5/4}}} is first converted to a 2-bit
     5This is clearly wrong.
     6
     7The reason is that {{{5/4}}} is first converted to a 2-bit
    78floating-point number, which is {{{1}}} in mode to nearest, then the comparison is made.
    8 
    9 The fix is either to convert {{{5/4}}} with directed rounding (here toward +infinity),
    10 or to convert {{{t}}} to rational using {{{exact_rational}}}.