Comment #15 on issue 1473 by [email protected]: __mod__ does not work on reals
http://code.google.com/p/sympy/issues/detail?id=1473
It works:
>>> Real(2.3) % 2
0.300000000000000
>>> 2.3 % 2
0.3
>>> oo % 2
>>> nan
It is not but exception is right (in my opinion):
>>> 231 % pi
TypeError: unsupported operand type(s) for %: 'int' and 'Pi'
This raise the less readable exception than above:
>>> Real(2.3) % x
>>> Real(2.3) % pi
But I think that it is a separate discussion about:
"In those cases I think it should return a relational type (like the ones
returned by
Real(2.3) < x)"
I think it is out of sense mathematically.
Especially for transcendence Pi.
I think that second operand of this binary operation must by only integer.
If it is, then assumption mechanism must be used for case "Real(2.3) % x",
and if assumtion of x symbol is integer, then representation of Mod
expression must be used only:
2.3 % x
2.3 % n
2.3 % x
2.3 mod n
[1] http://en.wikipedia.org/wiki/Modulo_operation
[2] http://en.wikipedia.org/wiki/Modular_arithmetic
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" 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/sympy-issues?hl=en.