#5132: [with patch, needs review] real numbers don't support __mod__
------------------------------+---------------------------------------------
Reporter: burcin | Owner: somebody
Type: defect | Status: new
Priority: major | Milestone: sage-3.3
Component: basic arithmetic | Keywords:
------------------------------+---------------------------------------------
{{{
sage: 10.0 % 2r
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/home/burcin/.sage/temp/karr/24765/_home_burcin__sage_init_sage_0.py in
<module>()
----> 1
2
3
4
5
TypeError: unsupported operand type(s) for %:
'sage.rings.real_mpfr.RealLiteral' and 'int'
}}}
A quick look through sage/rings/real_mpfr.pyx reveals that there is no
`__mod__` method defined.
MPFR documentation here:
http://www.mpfr.org/mpfr-current/mpfr.html#Integer-Related-Functions
suggests that one of `mpfr_fmod()` or `mpfr_remainder()` should be used,
depending on the desired rounding properties. Since I live blissfully in
the exact arithmetic world, I have no idea which one is more suitable for
Sage.
Nevertheless, a patch that uses `mpfr_remainder()` is attached.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5132>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---