Dave Hansen wrote:
> Probably not the "wrong" way, just a different way, especially if you
> write C code.
Oh, how poorly you know me! ;) I started learning C# a year ago, just
for fun, but that's about all I know (aside from HTML and CSS). I did
have a high school class in C++ a long, long t
On Sat, 11 Feb 2006 16:43:33 -0500 in comp.lang.python, John Salerno
<[EMAIL PROTECTED]> wrote:
>John Salerno wrote:
>> Hi all. I'm just starting out with Python, so I'm a little slow right
>> now. :)
>>
>> Can someone explain to me why the expression 5 / -2 evaluates to -3,
>> especially consi
Paul Rubin wrote:
> John Salerno <[EMAIL PROTECTED]> writes:
> > Can someone explain to me why the expression 5 / -2 evaluates to -3,
> > especially considering that -2 * -3 evaluates to 6?
> >
> > I'm sure it has something to do with the negative number and the
> > current way that the / operator
John Salerno wrote:
> Hi all. I'm just starting out with Python, so I'm a little slow right
> now. :)
>
> Can someone explain to me why the expression 5 / -2 evaluates to -3,
> especially considering that -2 * -3 evaluates to 6?
>
> I'm sure it has something to do with the negative number and t
Rinzwind wrote:
> '/' is a floor division (1/2 == 0) unless validated by a from
> __future__ import division.
>
> So:
> 5/2=2.5 -> nearest lowest non-decimal number makes it 2.
> 5/-2=-2.5 -> nearest lowest non-decilmal number makes it -3
>
Ah, this makes the most sense to me. -2.5 rounded down
"John Salerno" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can someone explain to me why the expression 5 / -2 evaluates to -3,
> especially considering that -2 * -3 evaluates to 6?
With same sign int division, one can think of the result as either being
rounding down or round
John Salerno <[EMAIL PROTECTED]> writes:
> Can someone explain to me why the expression 5 / -2 evaluates to -3,
> especially considering that -2 * -3 evaluates to 6?
>
> I'm sure it has something to do with the negative number and the
> current way that the / operator is implemented, but why doesn
'/' is a floor division (1/2 == 0) unless validated by a from
__future__ import division.
So:
5/2=2.5 -> nearest lowest non-decimal number makes it 2.
5/-2=-2.5 -> nearest lowest non-decilmal number makes it -3
--
http://mail.python.org/mailman/listinfo/python-list
John Salerno wrote:
> Hi all. I'm just starting out with Python, so I'm a little slow right
> now. :)
>
> Can someone explain to me why the expression 5 / -2 evaluates to -3,
> especially considering that -2 * -3 evaluates to 6?
>
> I'm sure it has something to do with the negative number and t
Em Sáb, 2006-02-11 às 14:52 -0500, John Salerno escreveu:
> Hi all. I'm just starting out with Python, so I'm a little slow right
> now. :)
>
> Can someone explain to me why the expression 5 / -2 evaluates to -3,
> especially considering that -2 * -3 evaluates to 6?
>
> I'm sure it has somethin
10 matches
Mail list logo