-
-
Couldn't load subscription status.
- Fork 683
Open
Description
For any subset of the real numbers we change the modulo operator to be
x%y is the unique x' between [0,y) of the form x + ny with n integer
The main reason for the shift are the following incoherences
sage: 5 % 3
2
sage: 5. % 3.
-1.00000000000000
and
sage: 2/5 % 3
1
sage: 2./5. % 3.
0.400000000000000
The change mainly affects QQ and RR. This ticket concentrates on QQ. For other numbers see #21747.
The specifications for the transition period are as follows:
- both
//and%with rational arguments will return rationals - there will be a deprecation warning with
(p/q) % (r/s)whenp/qorr/sis not an exact integer - there will be a deprecation warning with
(p/q) // (r/s)when the result is not an exact integer
See this sage-devel thread and also #15260
CC: @sagetrac-tmonteil
Component: basic arithmetic
Author: Vincent Delecroix
Branch/Commit: u/vdelecroix/21745 @ 39f4053
Issue created by migration from https://trac.sagemath.org/ticket/21745