[issue17821] Different division results with / and // operators with large numbers

Philippe Rouquier report at bugs.python.org
Tue Apr 23 11:19:59 CEST 2013


New submission from Philippe Rouquier:

Hi,

the following statement yields different results in python2 and python3:
284397269195572115652769428988866694680//17 - int(284397269195572115652769428988866694680/17)

In python3 it yields:
309657313492949847071

In python2 it yields:
OL

Python2's result seems to be correct as (284397269195572115652769428988866694680//17) and (int(284397269195572115652769428988866694680/17)) should return the same result (as far as I understand).

With smaller numbers, this difference in results does not appear with python3.

Note: I noticed this, while working on RSA; 284397269195572115652769428988866694680 is (p-1)(q-1) and 17 is e. I just mention this in case it could help.

I used linux version 3.3.3.0 and 2.7.3 for the tests on a 64 bits processor.

Sorry if I am missing something here.

----------
components: Interpreter Core
messages: 187623
nosy: Philippe.Rouquier
priority: normal
severity: normal
status: open
title: Different division results with / and // operators with large numbers
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17821>
_______________________________________


More information about the Python-bugs-list mailing list