[issue29815] Fail at divide a negative integer number for a positive integer number

2017-03-15 Thread Marcos Thomaz

New submission from Marcos Thomaz:

At divide a negative integer number for a positive integer number, the result 
is wrong. For example, in operation:

a, b, c = -7, 2, 7
d = divmod(a, b)
print a//b, a%b, c[0], c // b, c%b

The values printed are -4  1 3 1

--
components: Interpreter Core
messages: 289647
nosy: marcosthomazs
priority: normal
severity: normal
status: open
title: Fail at divide a negative integer number for a positive integer number
type: crash
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 
<http://bugs.python.org/issue29815>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29815] Fail at divide a negative integer number for a positive integer number

2017-03-15 Thread Marcos Thomaz

Marcos Thomaz added the comment:

I'm sorry, but was a typing error. Try this operations:

a, b, c = 7, -7, 2
print "1:", a // c, a % c
print "2:", b // c, b % c

the result is:
1: 3 1
2: -4 1

The division is the same, except by the signal (variable b is negative, but 
both, variables "a" and "b" are integers).

--

___
Python tracker 
<http://bugs.python.org/issue29815>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29815] Fail at divide a negative integer number for a positive integer number

2017-03-15 Thread Marcos Thomaz

Marcos Thomaz added the comment:

Try this operations, in interactive environment:

>> 7 // 2
3
>> -7 // 2
-4

--
resolution: not a bug -> 
status: closed -> open
versions: +Python 3.3

___
Python tracker 
<http://bugs.python.org/issue29815>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29815] Fail at divide a negative integer number for a positive integer number

2017-03-15 Thread Marcos Thomaz

Marcos Thomaz added the comment:

Note that mathematic expression is wrong. -7 divided by 2 is -3, not -4

--
resolution:  -> rejected
type: behavior -> crash

___
Python tracker 
<http://bugs.python.org/issue29815>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com