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

__floordiv__ should be part of coercion model #2034

Closed
malb opened this issue Feb 2, 2008 · 19 comments
Closed

__floordiv__ should be part of coercion model #2034

malb opened this issue Feb 2, 2008 · 19 comments

Comments

@malb
Copy link
Member

malb commented Feb 2, 2008

Add __floordiv__ to the coercion model for RingElement and change __floordiv__ to _floordiv_ where applicable.

This does not change any semantics of floor division, but it does fix floor division in a few cases where coercion is involved. It also fixes various segmentation faults like

sage: R.<x> = QQbar[]
sage: int(1) // x
...

Finally, we also implement __itruediv__, which was forgotten when adding __truediv__.

Component: coercion

Author: Jeroen Demeyer

Branch/Commit: 3e0e5b8

Reviewer: Vincent Delecroix

Issue created by migration from https://trac.sagemath.org/ticket/2034

@malb malb added this to the sage-5.11 milestone Feb 2, 2008
@aghitza aghitza changed the title {{{__floordiv__}}} should be part of coercion modell {{{__floordiv__}}} should be part of coercion model Jul 11, 2009
@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link

Author: Jeroen Demeyer

@jdemeyer jdemeyer modified the milestones: sage-6.4, sage-7.1 Jan 19, 2016
@jdemeyer jdemeyer changed the title {{{__floordiv__}}} should be part of coercion model __floordiv__ should be part of coercion model Jan 19, 2016
@jdemeyer

This comment has been minimized.

@jdemeyer

This comment has been minimized.

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link

@jdemeyer
Copy link

New commits:

5e8a5e3Implement `__floordiv__` in the coercion model

@jdemeyer
Copy link

Commit: 5e8a5e3

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 20, 2016

Changed commit from 5e8a5e3 to 835059f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 20, 2016

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

835059fRemove redundant `__floordiv__` from number field elements

@jdemeyer

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 20, 2016

Changed commit from 835059f to 3e0e5b8

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 20, 2016

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

3e0e5b8Add more doctests for floor division

@jdemeyer

This comment has been minimized.

@videlec
Copy link
Contributor

videlec commented Jan 20, 2016

comment:16

According to the "principle of least surprise", supporting floordiv for finite fields looks suspicious

sage: ZZ(5) // ZZ(3)
1
sage: GF(7)(5) // GF(7)(3)
4

If this is just an alias of division, why do we need it?

@jdemeyer
Copy link

comment:17

Replying to @videlec:

According to the "principle of least surprise", supporting floordiv for finite fields looks suspicious

That's outside the scope of this ticket. This ticket only implements coercion for __floordiv__, it doesn't otherwise change the semantics of floor division. There shouldn't be anything controversial in this ticket.

@videlec
Copy link
Contributor

videlec commented Jan 20, 2016

Reviewer: Vincent Delecroix

@videlec
Copy link
Contributor

videlec commented Jan 20, 2016

comment:18

All right. Hope this will be fixed with #15260.

@vbraun
Copy link
Member

vbraun commented Jan 23, 2016

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

6 participants