Re: simple math question

2006-02-13 Thread John Salerno
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

Re: simple math question

2006-02-13 Thread Dave Hansen
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

Re: simple math question

2006-02-11 Thread Dan Bishop
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

Re: simple math question

2006-02-11 Thread John Salerno
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

Re: simple math question

2006-02-11 Thread John Salerno
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

Re: simple math question

2006-02-11 Thread Terry Reedy
"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

Re: simple math question

2006-02-11 Thread Paul Rubin
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

Re: simple math question

2006-02-11 Thread Rinzwind
'/' 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

Re: simple math question

2006-02-11 Thread James Stroud
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

Re: simple math question

2006-02-11 Thread Felipe Almeida Lessa
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

simple math question

2006-02-11 Thread John Salerno
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 the current way that the / operato