Division help in python
garabik-news-2005-05 at kassiopeia.juls.savba.sk
garabik-news-2005-05 at kassiopeia.juls.savba.sk
Sat Sep 8 03:03:12 EDT 2012
Chris Angelico <rosuav at gmail.com> wrote:
> On Fri, Sep 7, 2012 at 10:53 PM, Ramyasri Dodla <ramyasri20 at gmail.com> wrote:
>> I am brand new to python. checking over basic stuff. I came across the
>> problem while doing so. If any body aware of the problem, kindly respond me.
>>
>>>>> 5/10
>> 0
>>>>> - 5/10
>> -1
>>
>> The second case also should yield a 'zero' but it is giving a -1
>
>
...
> The reason for this is that / (or in Python 3, //) rounds toward
> negative infinity, not toward zero. This allows the modulo operator
I think he means the non-obvious unary minus precedence.
--
-----------------------------------------------------------
| Radovan GarabĂk http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__ garabik @ kassiopeia.juls.savba.sk |
-----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!
More information about the Python-list
mailing list