<div dir="ltr"><span lang="en"><span>No,</span> <span>python</span> <span>calculates</span> <span>correctly.</span><br> <span>Just</span> <span>the results</span> <span>differ from the results</span> <span>of these calculations</span> <span>in other languages</span><span>.</span><br><br> <span>In </span><span>python</span> <span>implemented</span> <span>the so-called</span> <span>floor</span><span>-division:<br><br><a href="https://docs.python.org/2/reference/expressions.html#binary-arithmetic-operations" target="_blank">https://docs.python.org/2/reference/expressions.html#binary-arithmetic-operations</a><br><a href="https://docs.python.org/3/reference/expressions.html#binary-arithmetic-operations" target="_blank">https://docs.python.org/3/reference/expressions.html#binary-arithmetic-operations</a><br><a href="https://www.python.org/dev/peps/pep-0238/" target="_blank">https://www.python.org/dev/peps/pep-0238/</a><br><a href="http://python-history.blogspot.ru/2010/08/why-pythons-integer-division-floors.html" target="_blank">http://python-history.blogspot.ru/2010/08/why-pythons-integer-division-floors.html</a><br><br></span></span><div class="gmail_extra"><br><div class="gmail_quote">2016-02-03 2:30 GMT+03:00 Miguel  Alejandro Fernandez <span dir="ltr"><<a href="mailto:alejandrogroso@hotmail.com" target="_blank">alejandrogroso@hotmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p><span lang="en"><span>Error</span>
<span>python</span><span>,</span> <span>not</span> <span>
have the slightest</span> <span>sense!</span></span></p>
<p><br>
<span lang="en"><span></span></span></p>
<p><span lang="en"><span>Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:15:05) [MSC v.1600 32 bit (In<br>
tel)] on win32<br>
Type "help", "copyright", "credits" or "license" for more information.<br>
>>><br>
>>><br>
>>><br>
>>> 5//50, 5%50<br>
(0, 5)<br>
>>><br>
>>><br>
>>> -1//50, -1%50<br>
(-1, 49)<br>
>>><br>
>>><br>
>>><br>
>>> -1//50<br>
-1<br>
>>><br>
>>><br>
>>> -1/50<br>
-0.02<br>
>>><br>
>>><br>
>>><br>
>>> -1/10<br>
-0.1<br>
>>><br>
>>><br>
>>> -(1//10)<br>
0<br>
>>><br>
>>> -21//10<br>
-3<br>
>>><br>
>>> -2//10<br>
-1<br>
>>><br>
>>><br>
>>> -1.0//10<br>
-1.0<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> -1.0//10.0<br>
-1.0<br>
>>><br>
>>> 0//10<br>
0<br>
>>><br>
>>><br>
>>><br>
>>> 0//10.0<br>
0.0<br>
>>><br>
>>><br>
>>><br>
>>> 2//10.0<br>
0.0<br>
>>> 1//10.0<br>
0.0<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> -1//10<br>
-1<br>
>>> 2//10.0<br>
0.0<br>
>>><br>
>>><br>
>>> -1//10.0<br>
-1.0<br>
>>><br>
>>><br>
>>><br>
>>> -10//10.0<br>
-1.0<br>
>>> -20//10.0<br>
-2.0<br>
>>><br>
>>><br>
>>><br>
>>> 2-1//10<br>
2<br>
>>><br>
>>><br>
>>> -1//10<br>
-1<br>
>>><br>
>>> 2+1//(-10)<br>
1<br>
>>><br>
>>> 1//(-10)<br>
-1<br>
>>> +1//(-10)<br>
-1<br>
>>><br>
>>></span></span></p>
<p><span lang="en"><span><br>
</span></span></p>
<p><span lang="en"><span><br>
</span></span></p>
<p><span lang="en"><span>pypy</span><span>-</span><span>2.4.0</span><span>-win32</span>
<span>also</span> <span>returns the same results.</span></span></p>
<p><br>
<span lang="en"><span></span></span></p>
<p><span lang="en"><span>any ideas?</span></span></p>
</div>
</div>

<br>_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br></div></div>