Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize modulo operator % on real numbers (step 1) #21745

Open
videlec opened this issue Oct 23, 2016 · 25 comments
Open

Standardize modulo operator % on real numbers (step 1) #21745

videlec opened this issue Oct 23, 2016 · 25 comments

Comments

@videlec
Copy link
Contributor

videlec commented Oct 23, 2016

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) when p/q or r/s is 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

@videlec videlec added this to the sage-7.5 milestone Oct 23, 2016
@videlec
Copy link
Contributor Author

videlec commented Oct 23, 2016

Dependencies: #21746

@videlec

This comment has been minimized.

@videlec

This comment has been minimized.

@videlec
Copy link
Contributor Author

videlec commented Oct 23, 2016

Author: Vincent Delecroix

@videlec
Copy link
Contributor Author

videlec commented Oct 23, 2016

Branch: u/vdelecroix/21745

@videlec videlec changed the title Standardize modulo operator % on real numbers Standardize modulo operator % on real numbers (step 1) Oct 23, 2016
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 23, 2016

Commit: 710eee2

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 23, 2016

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

624c32221745: fix integer mod ring initialization with rationals
cc204ef21745: fix doctests in integer.pyx
0e5730421745: use / instead of // in one place
5735ee121745: include real_mod_floordiv in the documentation
7e1a28121745: fix bernoulli mod p tests
6435af121745: fix pari ffelt initialization
f62f8bf21745: fix doctests in ideal.py and integer_ring.pyx
f70825b21745: doctest finite field initialization
05657ad21745: fix quadratic form of ideals
710eee221745: fix some french book examples

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 23, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

71f5d5921745: fix a UTF8 character

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 23, 2016

Changed commit from 710eee2 to 71f5d59

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 23, 2016

Changed commit from 71f5d59 to 1bbc03c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 23, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

1bbc03c21745: better documentation in real_mod_floordiv.py

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 23, 2016

Changed commit from 1bbc03c to 8517922

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 23, 2016

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

851792221745: better documentation in real_mod_floordiv.py

@videlec

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 24, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

c97709521745: fix quadratic_forms
84a893721745: fix in root system
691237121745: two fixes in graphs/

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 24, 2016

Changed commit from 8517922 to 6912371

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 25, 2016

Changed commit from 6912371 to 2bd9c73

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 25, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

2bd9c7321745: make floordiv returns a rational

@videlec

This comment has been minimized.

@videlec

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 17, 2016

Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:

9decbae21745: doctest finite field initialization
25a335e21745: fix quadratic form of ideals
ad9f81821745: fix some french book examples
f2ceaf121745: fix a UTF8 character
2d78c1d21745: better documentation in real_mod_floordiv.py
5b720f421745: fix quadratic_forms
c45b55321745: fix in root system
6e16f4d21745: two fixes in graphs/
7aa12c521745: make floordiv returns a rational
39f405321745: fix projective_morphism.py

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 17, 2016

Changed commit from 2bd9c73 to 39f4053

@videlec
Copy link
Contributor Author

videlec commented Dec 17, 2016

Changed dependencies from #21746 to none

@videlec
Copy link
Contributor Author

videlec commented Dec 17, 2016

comment:15

rebased on 7.5.beta6

@cheuberg
Copy link
Contributor

cheuberg commented Jan 7, 2017

comment:16

failing doctests (see patchbot)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants